Updated Hide Prayers Plugin (#220)
* Delete HidePrayersConfig.java * Delete HidePrayersPlugin.java * Delete PrayerTabState.java * Updated Hide Prayers Plugin -Issue #219 Fixed -Split Prayer Swap for PVP and PVM -Added in full PVP suite prayer customization -Added in custom PVM prayer sets for individual bosses
This commit is contained in:
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, https://runelitepl.us
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 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;
|
||||
|
||||
@ConfigGroup("hideprayers")
|
||||
public interface HidePrayersConfig extends Config
|
||||
{
|
||||
@ConfigItem
|
||||
(
|
||||
position = 0,
|
||||
keyName = "pk prayers",
|
||||
name = "Hides none pk prayers",
|
||||
description = "Hides widget icons."
|
||||
)
|
||||
default boolean showPrayers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem
|
||||
(
|
||||
position = 1,
|
||||
keyName = "eagle",
|
||||
name = "Shows Eagle Eye Prayer",
|
||||
description = "Hides widget icons."
|
||||
)
|
||||
default boolean showEagle()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem
|
||||
(
|
||||
position = 2,
|
||||
keyName = "mystic",
|
||||
name = "Shows Mystic Might Prayer",
|
||||
description = "Hides widget icons."
|
||||
)
|
||||
default boolean showMystic()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem
|
||||
(
|
||||
position = 3,
|
||||
keyName = "ultstr",
|
||||
name = "Shows Ultimate Strength/Incredible Reflex/Steel Skin",
|
||||
description = "Hides widget icons."
|
||||
)
|
||||
default boolean showUltStrength()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem
|
||||
(
|
||||
position = 4,
|
||||
keyName = "preserve",
|
||||
name = "Shows Preserve",
|
||||
description = "unides widget icons."
|
||||
)
|
||||
default boolean showPreserve()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem
|
||||
(
|
||||
position = 5,
|
||||
keyName = "redemption",
|
||||
name = "Shows Redemption",
|
||||
description = "unides widget icons."
|
||||
)
|
||||
default boolean showRedemption()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem
|
||||
(
|
||||
position = 6,
|
||||
keyName = "rapidheal",
|
||||
name = "Shows Rapid Heal",
|
||||
description = "unides widget icons."
|
||||
)
|
||||
default boolean showRapidHeal()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem
|
||||
(
|
||||
position = 7,
|
||||
keyName = "rapidRestore",
|
||||
name = "Shows Rapid restore",
|
||||
description = "unides widget icons."
|
||||
)
|
||||
default boolean showRapidRestore()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,319 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, https://runelitepl.us
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 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 net.runelite.client.eventbus.Subscribe;
|
||||
import com.google.inject.Provides;
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
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.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginType;
|
||||
import javax.inject.Inject;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@PluginDescriptor
|
||||
(
|
||||
name = "Hide Prayers",
|
||||
description = "Hides specific Prayers in the Prayer tab.",
|
||||
type = PluginType.UTILITY
|
||||
)
|
||||
public class HidePrayersPlugin extends Plugin
|
||||
{
|
||||
private static final int PRAYER_COUNT = Prayer.values().length;
|
||||
|
||||
private static final List<WidgetInfo> 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;
|
||||
|
||||
@Provides
|
||||
HidePrayersConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(HidePrayersConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
hidePrayers();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
restorePrayers();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChanged(GameStateChanged event)
|
||||
{
|
||||
if (event.getGameState() == GameState.LOGGED_IN)
|
||||
{
|
||||
hidePrayers();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (event.getGroup().equals("hideprayers"))
|
||||
{
|
||||
hidePrayers();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onWidgetLoaded(WidgetLoaded event)
|
||||
{
|
||||
if (event.getGroupId() == WidgetID.PRAYER_GROUP_ID || event.getGroupId() == WidgetID.QUICK_PRAYERS_GROUP_ID)
|
||||
{
|
||||
hidePrayers();
|
||||
}
|
||||
}
|
||||
|
||||
private PrayerTabState getPrayerTabState()
|
||||
{
|
||||
HashTable<WidgetNode> 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 restorePrayers()
|
||||
{
|
||||
if (client.getGameState() != GameState.LOGGED_IN)
|
||||
return;
|
||||
|
||||
PrayerTabState prayerTabState = getPrayerTabState();
|
||||
|
||||
if (prayerTabState == PrayerTabState.PRAYERS)
|
||||
{
|
||||
List<Widget> 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 < PRAYER_COUNT; index++)
|
||||
prayerWidgets.get(Prayer.values()[index].ordinal()).setHidden(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void hidePrayers()
|
||||
{
|
||||
if (client.getGameState() != GameState.LOGGED_IN)
|
||||
return;
|
||||
|
||||
PrayerTabState prayerTabState = getPrayerTabState();
|
||||
|
||||
if (prayerTabState == PrayerTabState.PRAYERS)
|
||||
{
|
||||
List<Widget> 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 < PRAYER_COUNT; index++)
|
||||
{
|
||||
Prayer prayer = Prayer.values()[index];
|
||||
Widget prayerWidget = prayerWidgets.get(prayer.ordinal());
|
||||
|
||||
if (!config.showPrayers() && !config.showEagle())
|
||||
prayerWidget.setHidden(false);
|
||||
if (!config.showPrayers() && !config.showMystic())
|
||||
prayerWidget.setHidden(false);
|
||||
if (!config.showPrayers() && !config.showUltStrength())
|
||||
prayerWidget.setHidden(false);
|
||||
if (!config.showPrayers() && !config.showPreserve())
|
||||
prayerWidget.setHidden(false);
|
||||
if (!config.showPrayers() && !config.showRapidHeal())
|
||||
prayerWidget.setHidden(false);
|
||||
if (!config.showPrayers() && !config.showRapidRestore())
|
||||
prayerWidget.setHidden(false);
|
||||
if (!config.showPrayers() && !config.showRedemption())
|
||||
prayerWidget.setHidden(false);
|
||||
|
||||
if (config.showPrayers())
|
||||
{
|
||||
prayerWidget.setHidden(true);
|
||||
prayerWidgets.get(Prayer.values()[10].ordinal()).setHidden(false);// protect item
|
||||
prayerWidgets.get(Prayer.values()[16].ordinal()).setHidden(false);// mage
|
||||
prayerWidgets.get(Prayer.values()[17].ordinal()).setHidden(false);// range
|
||||
prayerWidgets.get(Prayer.values()[18].ordinal()).setHidden(false);// melee
|
||||
prayerWidgets.get(Prayer.values()[23].ordinal()).setHidden(false);// smite
|
||||
if (config.showEagle())
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[27].ordinal()).setHidden(true);// rigour
|
||||
}
|
||||
else
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[27].ordinal()).setHidden(false);// rigour
|
||||
}
|
||||
if (config.showMystic())
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[28].ordinal()).setHidden(true);// augury
|
||||
}
|
||||
else
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[28].ordinal()).setHidden(false);// augury
|
||||
}
|
||||
if (config.showUltStrength())
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[26].ordinal()).setHidden(true);// piety
|
||||
}
|
||||
else
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[26].ordinal()).setHidden(false);// piety
|
||||
}
|
||||
if (config.showPreserve())
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[24].ordinal()).setHidden(true);// Preserve
|
||||
}
|
||||
else
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[24].ordinal()).setHidden(false);// Preserve
|
||||
}
|
||||
if (config.showRedemption())
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[22].ordinal()).setHidden(true);// Redemption
|
||||
}
|
||||
else
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[22].ordinal()).setHidden(false);// Redemption
|
||||
}
|
||||
if (config.showRapidRestore())
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[8].ordinal()).setHidden(true);// Rapid Restore
|
||||
}
|
||||
else
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[8].ordinal()).setHidden(false);// Rapid Restore
|
||||
}
|
||||
if (config.showRapidHeal())
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[9].ordinal()).setHidden(true);// Rapid Heal
|
||||
}
|
||||
else
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[9].ordinal()).setHidden(false);// Rapid Heal
|
||||
}
|
||||
}
|
||||
if (config.showEagle())
|
||||
{
|
||||
prayerWidget.setHidden(true);
|
||||
prayerWidgets.get(Prayer.values()[19].ordinal()).setHidden(false);// eagle
|
||||
prayerWidgets.get(Prayer.values()[27].ordinal()).setHidden(true);// rigour
|
||||
}
|
||||
if (config.showMystic())
|
||||
{
|
||||
prayerWidget.setHidden(true);
|
||||
prayerWidgets.get(Prayer.values()[20].ordinal()).setHidden(false);// mystic
|
||||
prayerWidgets.get(Prayer.values()[28].ordinal()).setHidden(true);// augury
|
||||
}
|
||||
if (config.showUltStrength())
|
||||
{
|
||||
prayerWidget.setHidden(true);
|
||||
prayerWidgets.get(Prayer.values()[13].ordinal()).setHidden(false);// Steel Skin
|
||||
prayerWidgets.get(Prayer.values()[14].ordinal()).setHidden(false);// Ult Strength
|
||||
prayerWidgets.get(Prayer.values()[15].ordinal()).setHidden(false);// Incredible Reflexes
|
||||
prayerWidgets.get(Prayer.values()[26].ordinal()).setHidden(true);// piety
|
||||
}
|
||||
if (config.showPreserve())
|
||||
{
|
||||
prayerWidget.setHidden(true);
|
||||
prayerWidgets.get(Prayer.values()[24].ordinal()).setHidden(false);// Preserve
|
||||
}
|
||||
if (config.showRedemption())
|
||||
{
|
||||
prayerWidget.setHidden(true);
|
||||
prayerWidgets.get(Prayer.values()[22].ordinal()).setHidden(false);// Redemption
|
||||
}
|
||||
if (config.showRapidRestore())
|
||||
{
|
||||
prayerWidget.setHidden(true);
|
||||
prayerWidgets.get(Prayer.values()[8].ordinal()).setHidden(false);// Rapid Restore
|
||||
}
|
||||
if (config.showRapidHeal())
|
||||
{
|
||||
prayerWidget.setHidden(true);
|
||||
prayerWidgets.get(Prayer.values()[9].ordinal()).setHidden(false);// Rapid Heal
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright (c) 2018, https://runelitepl.us
|
||||
* Copyright (c) 2019, Kyle <https://github.com/kyleeld>
|
||||
* Copyright (c) 2018, Raiever <https://github.com/Raieverr>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 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.PVM;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup("hideprayersPVM")
|
||||
public interface HidePrayersPVMConfig extends Config
|
||||
{
|
||||
@ConfigItem
|
||||
(
|
||||
position = 0,
|
||||
keyName = "barrowscheap",
|
||||
name = "Barrows Eagle Eye/Mystic Might",
|
||||
description = "Shows prayers for Barrows"
|
||||
)
|
||||
default boolean showBarrowsCheap()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem
|
||||
(
|
||||
position = 1,
|
||||
keyName = "barrowsexpensive",
|
||||
name = "Barrows Augury/Rigour",
|
||||
description = "Shows prayers for Barrows"
|
||||
)
|
||||
default boolean showBarrowsExpensive()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem
|
||||
(
|
||||
position = 2,
|
||||
keyName = "zulrahcheap",
|
||||
name = "Zulrah Eagle Eye/Mystic Might",
|
||||
description = "Hide/Show Eagle Eye/Mystic Might for Zulrah"
|
||||
)
|
||||
default boolean showZulrahCheap()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem
|
||||
(
|
||||
position = 3,
|
||||
keyName = "zulrahexpensive",
|
||||
name = "Zulrah Augury/Rigour",
|
||||
description = "Shows prayers needed for Zulrah"
|
||||
)
|
||||
default boolean showZulrahExpensive()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,253 @@
|
||||
/*
|
||||
* Copyright (c) 2018, https://runelitepl.us
|
||||
* Copyright (c) 2019, Kyle <https://github.com/kyleeld>
|
||||
* Copyright (c) 2018, Raiever <https://github.com/Raieverr>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 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.PVM;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.inject.Provides;
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
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.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginType;
|
||||
import net.runelite.client.plugins.hideprayers.util.PrayerTabStates;
|
||||
import javax.inject.Inject;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@PluginDescriptor
|
||||
(
|
||||
name = "Show/Hide PVM Prayers",
|
||||
description = "Hides specific Prayers in the Prayer tab for PVM.",
|
||||
enabledByDefault = false,
|
||||
type = PluginType.PVM
|
||||
)
|
||||
|
||||
public class HidePrayersPVMPlugin extends Plugin
|
||||
{
|
||||
private static final int PRAYER_COUNT = Prayer.values().length;
|
||||
|
||||
private static final List<WidgetInfo> 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 HidePrayersPVMConfig config;
|
||||
|
||||
@Provides
|
||||
HidePrayersPVMConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(HidePrayersPVMConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
hidePrayers();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
restorePrayers();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChanged(GameStateChanged event)
|
||||
{
|
||||
if (event.getGameState() == GameState.LOGGED_IN)
|
||||
{
|
||||
hidePrayers();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (event.getGroup().equals("hideprayersPVM"))
|
||||
{
|
||||
hidePrayers();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onWidgetLoaded(WidgetLoaded event)
|
||||
{
|
||||
if (event.getGroupId() == WidgetID.PRAYER_GROUP_ID || event.getGroupId() == WidgetID.QUICK_PRAYERS_GROUP_ID)
|
||||
{
|
||||
hidePrayers();
|
||||
}
|
||||
}
|
||||
|
||||
private PrayerTabStates getPrayerTabState()
|
||||
{
|
||||
HashTable<WidgetNode> 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<Widget> 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 < PRAYER_COUNT; index++)
|
||||
prayerWidgets.get(Prayer.values()[index].ordinal()).setHidden(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void hidePrayers()
|
||||
{
|
||||
if (client.getGameState() != GameState.LOGGED_IN)
|
||||
return;
|
||||
|
||||
PrayerTabStates prayerTabState = getPrayerTabState();
|
||||
|
||||
if (prayerTabState == PrayerTabStates.PRAYERS)
|
||||
{
|
||||
List<Widget> 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 < PRAYER_COUNT; index++)
|
||||
{
|
||||
Prayer prayer = Prayer.values()[index];
|
||||
Widget prayerWidget = prayerWidgets.get(prayer.ordinal());
|
||||
|
||||
if (!config.showZulrahCheap()
|
||||
&& !config.showZulrahExpensive()
|
||||
&& !config.showBarrowsCheap()
|
||||
&& !config.showBarrowsExpensive())
|
||||
prayerWidget.setHidden(false);
|
||||
|
||||
if (config.showZulrahCheap())
|
||||
{
|
||||
prayerWidget.setHidden(true);
|
||||
prayerWidgets.get(Prayer.values()[16].ordinal()).setHidden(false);// Protect from Magic
|
||||
prayerWidgets.get(Prayer.values()[17].ordinal()).setHidden(false);// Protect from Range
|
||||
prayerWidgets.get(Prayer.values()[19].ordinal()).setHidden(false);// eagle eye
|
||||
prayerWidgets.get(Prayer.values()[20].ordinal()).setHidden(false);// mystic might
|
||||
prayerWidgets.get(Prayer.values()[22].ordinal()).setHidden(false);// Redemption
|
||||
}
|
||||
|
||||
if (config.showZulrahExpensive())
|
||||
{
|
||||
prayerWidget.setHidden(true);
|
||||
prayerWidgets.get(Prayer.values()[16].ordinal()).setHidden(false);// Protect from Magic
|
||||
prayerWidgets.get(Prayer.values()[17].ordinal()).setHidden(false);// Protect from Range
|
||||
prayerWidgets.get(Prayer.values()[27].ordinal()).setHidden(false);// Rigour
|
||||
prayerWidgets.get(Prayer.values()[28].ordinal()).setHidden(false);// Augury
|
||||
prayerWidgets.get(Prayer.values()[22].ordinal()).setHidden(false);// Redemption
|
||||
}
|
||||
|
||||
if (config.showBarrowsCheap())
|
||||
{
|
||||
prayerWidget.setHidden(true);
|
||||
prayerWidgets.get(Prayer.values()[16].ordinal()).setHidden(false);// Protect from Magic
|
||||
prayerWidgets.get(Prayer.values()[17].ordinal()).setHidden(false);// Protect from Range
|
||||
prayerWidgets.get(Prayer.values()[18].ordinal()).setHidden(false);// Protect from Melee
|
||||
prayerWidgets.get(Prayer.values()[19].ordinal()).setHidden(false);// eagle eye
|
||||
prayerWidgets.get(Prayer.values()[20].ordinal()).setHidden(false);// mystic might
|
||||
prayerWidgets.get(Prayer.values()[22].ordinal()).setHidden(false);// Redemption
|
||||
}
|
||||
|
||||
if (config.showBarrowsExpensive())
|
||||
{
|
||||
prayerWidget.setHidden(true);
|
||||
prayerWidgets.get(Prayer.values()[16].ordinal()).setHidden(false);// Protect from Magic
|
||||
prayerWidgets.get(Prayer.values()[17].ordinal()).setHidden(false);// Protect from Range
|
||||
prayerWidgets.get(Prayer.values()[18].ordinal()).setHidden(false);// Protect from Melee
|
||||
prayerWidgets.get(Prayer.values()[27].ordinal()).setHidden(false);// Rigour
|
||||
prayerWidgets.get(Prayer.values()[28].ordinal()).setHidden(false);// Augury
|
||||
prayerWidgets.get(Prayer.values()[22].ordinal()).setHidden(false);// Redemption
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,263 @@
|
||||
/*
|
||||
* Copyright (c) 2018, https://runelitepl.us
|
||||
* Copyright (c) 2019, Kyle <https://github.com/kyleeld>
|
||||
* Copyright (c) 2018, Raiever <https://github.com/Raieverr>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 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.PVP;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup("hideprayersPVP")
|
||||
public interface HidePrayersPVPConfig extends Config
|
||||
{
|
||||
@ConfigItem
|
||||
(
|
||||
position = 0,
|
||||
keyName = "pk prayers",
|
||||
name = "Hide Non-PK Prayers",
|
||||
description = "Hide/Show PK Prayers."
|
||||
)
|
||||
default boolean showPVPPrayers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem
|
||||
(
|
||||
position = 1,
|
||||
keyName = "rapid restore",
|
||||
name = "Hide Rapid Restore",
|
||||
description = "Hide/Show Rapid Restore"
|
||||
)
|
||||
default boolean HideRapidRestore()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem
|
||||
(
|
||||
position = 2,
|
||||
keyName = "rapid heal",
|
||||
name = "Hide Rapid Heal",
|
||||
description = "Hide/Show Rapid Heal"
|
||||
)
|
||||
default boolean HideRapidHeal()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ConfigItem
|
||||
(
|
||||
position = 3,
|
||||
keyName = "protectitem",
|
||||
name = "Hide Protect Item",
|
||||
description = "Hide/Show Protect Item"
|
||||
)
|
||||
default boolean HideProtectItem()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem
|
||||
(
|
||||
position = 4,
|
||||
keyName = "steelskin",
|
||||
name = "Hide Steel Skin",
|
||||
description = "Hide/Show Steel skin"
|
||||
)
|
||||
default boolean HideSteelSkin()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem
|
||||
(
|
||||
position = 5,
|
||||
keyName = "ultimatestrength",
|
||||
name = "Hide Ultimate Strength",
|
||||
description = "Hide/Show Ultimate strength"
|
||||
)
|
||||
default boolean HideUltimateStrength()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem
|
||||
(
|
||||
position = 6,
|
||||
keyName = "incrediblereflex",
|
||||
name = "Hide Incredible Reflex",
|
||||
description = "Hide/Show Incredible Reflex"
|
||||
)
|
||||
default boolean HideIncredibleReflex()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem
|
||||
(
|
||||
position = 7,
|
||||
keyName = "PTFMagic",
|
||||
name = "Hide Protect From Magic",
|
||||
description = "Hide/Show Protect From Magic"
|
||||
)
|
||||
default boolean HidePTFMagic()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem
|
||||
(
|
||||
position = 8,
|
||||
keyName = "PTFRange",
|
||||
name = "Hide Protect From Range",
|
||||
description = "Hide/Show Protect from Range"
|
||||
)
|
||||
default boolean HidePTFRange()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem
|
||||
(
|
||||
position = 9,
|
||||
keyName = "PTFMelee",
|
||||
name = "Hide Protect From Melee",
|
||||
description = "Hide/Show Protect From Melee"
|
||||
)
|
||||
default boolean HidePTFMelee()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem
|
||||
(
|
||||
position = 10,
|
||||
keyName = "eagle",
|
||||
name = "Hide Eagle Eye",
|
||||
description = "Hide/Show Eagle Eye"
|
||||
)
|
||||
default boolean HideEagle()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem
|
||||
(
|
||||
position = 11,
|
||||
keyName = "mystic",
|
||||
name = "Hide Mystic Might",
|
||||
description = "Hide/Show Mystic Might"
|
||||
)
|
||||
default boolean HideMystic()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem
|
||||
(
|
||||
position = 12,
|
||||
keyName = "redemption",
|
||||
name = "Hide Redemption",
|
||||
description = "Hide/Show Redemption"
|
||||
)
|
||||
default boolean HideRedemption()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem
|
||||
(
|
||||
position = 13,
|
||||
keyName = "smite",
|
||||
name = "Hide Smite",
|
||||
description = "Hide/Show Smite"
|
||||
)
|
||||
default boolean HideSmite()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem
|
||||
(
|
||||
position = 14,
|
||||
keyName = "preserve",
|
||||
name = "Hide Preserve",
|
||||
description = "Hide/Show Preserve"
|
||||
)
|
||||
default boolean HidePreserve()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem
|
||||
(
|
||||
position = 15,
|
||||
keyName = "Chivalry",
|
||||
name = "Hide Chivalry",
|
||||
description = "Hide/Show Chivalry"
|
||||
)
|
||||
default boolean HideChivalry()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem
|
||||
(
|
||||
position = 16,
|
||||
keyName = "Piety",
|
||||
name = "Hide Piety",
|
||||
description = "Hide/Show Piety"
|
||||
)
|
||||
default boolean HidePiety()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem
|
||||
(
|
||||
position = 17,
|
||||
keyName = "Rigour",
|
||||
name = "Hide Rigour",
|
||||
description = "Hide/Show Rigour"
|
||||
)
|
||||
default boolean HideRigour()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem
|
||||
(
|
||||
position = 18,
|
||||
keyName = "Augury",
|
||||
name = "Hide Augury",
|
||||
description = "Hide/Show Augury"
|
||||
)
|
||||
default boolean HideAugury()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,337 @@
|
||||
/*
|
||||
* Copyright (c) 2018, https://runelitepl.us
|
||||
* Copyright (c) 2019, Kyle <https://github.com/kyleeld>
|
||||
* Copyright (c) 2018, Raiever <https://github.com/Raieverr>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 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.PVP;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.inject.Provides;
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
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.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginType;
|
||||
import net.runelite.client.plugins.hideprayers.util.PrayerTabStates;
|
||||
import javax.inject.Inject;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@PluginDescriptor
|
||||
(
|
||||
name = "Show/Hide PVP Prayers",
|
||||
description = "Hides specific Prayers in the Prayer tab for PVP.",
|
||||
enabledByDefault = false,
|
||||
type = PluginType.PVP
|
||||
)
|
||||
|
||||
public class HidePrayersPVPPlugin extends Plugin
|
||||
{
|
||||
private static final int PRAYER_COUNT = Prayer.values().length;
|
||||
|
||||
private static final List<WidgetInfo> 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 HidePrayersPVPConfig config;
|
||||
|
||||
@Provides
|
||||
HidePrayersPVPConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(HidePrayersPVPConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
hidePrayers();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
restorePrayers();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChanged(GameStateChanged event)
|
||||
{
|
||||
if (event.getGameState() == GameState.LOGGED_IN)
|
||||
{
|
||||
hidePrayers();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (event.getGroup().equals("hideprayersPVP"))
|
||||
{
|
||||
hidePrayers();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onWidgetLoaded(WidgetLoaded event)
|
||||
{
|
||||
if (event.getGroupId() == WidgetID.PRAYER_GROUP_ID || event.getGroupId() == WidgetID.QUICK_PRAYERS_GROUP_ID)
|
||||
{
|
||||
hidePrayers();
|
||||
}
|
||||
}
|
||||
|
||||
private PrayerTabStates getPrayerTabState()
|
||||
{
|
||||
HashTable<WidgetNode> 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<Widget> 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 < PRAYER_COUNT; index++)
|
||||
prayerWidgets.get(Prayer.values()[index].ordinal()).setHidden(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void hidePrayers()
|
||||
{
|
||||
if (client.getGameState() != GameState.LOGGED_IN)
|
||||
return;
|
||||
|
||||
PrayerTabStates prayerTabState = getPrayerTabState();
|
||||
|
||||
if (prayerTabState == PrayerTabStates.PRAYERS)
|
||||
{
|
||||
List<Widget> 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 < PRAYER_COUNT; index++)
|
||||
{
|
||||
Prayer prayer = Prayer.values()[index];
|
||||
Widget prayerWidget = prayerWidgets.get(prayer.ordinal());
|
||||
|
||||
if (!config.showPVPPrayers()
|
||||
&& !config.HideRapidRestore()
|
||||
&& !config.HideRapidHeal()
|
||||
&& !config.HideProtectItem()
|
||||
&& !config.HideSteelSkin()
|
||||
&& !config.HideUltimateStrength()
|
||||
&& !config.HideIncredibleReflex()
|
||||
&& !config.HidePTFMagic()
|
||||
&& !config.HidePTFRange()
|
||||
&& !config.HidePTFMelee()
|
||||
&& !config.HideEagle()
|
||||
&& !config.HideMystic()
|
||||
&& !config.HideRedemption()
|
||||
&& !config.HideSmite()
|
||||
&& !config.HidePreserve()
|
||||
&& !config.HideChivalry()
|
||||
&& !config.HidePiety()
|
||||
&& !config.HideRigour()
|
||||
&& !config.HideAugury())
|
||||
prayerWidget.setHidden(false);
|
||||
|
||||
if (config.showPVPPrayers())
|
||||
{
|
||||
prayerWidget.setHidden(true);
|
||||
prayerWidgets.get(Prayer.values()[8].ordinal()).setHidden(false);// Rapid Restore
|
||||
prayerWidgets.get(Prayer.values()[9].ordinal()).setHidden(false);// Rapid Heal
|
||||
prayerWidgets.get(Prayer.values()[10].ordinal()).setHidden(false);// Protect Item
|
||||
prayerWidgets.get(Prayer.values()[13].ordinal()).setHidden(false);// Steel Skin
|
||||
prayerWidgets.get(Prayer.values()[14].ordinal()).setHidden(false);// Ultimate Strength
|
||||
prayerWidgets.get(Prayer.values()[15].ordinal()).setHidden(false);// Incredible Reflexes
|
||||
prayerWidgets.get(Prayer.values()[16].ordinal()).setHidden(false);// Protect from Magic
|
||||
prayerWidgets.get(Prayer.values()[17].ordinal()).setHidden(false);// Protect from Range
|
||||
prayerWidgets.get(Prayer.values()[18].ordinal()).setHidden(false);// Protect from Melee
|
||||
prayerWidgets.get(Prayer.values()[19].ordinal()).setHidden(false);// Eagle Eye
|
||||
prayerWidgets.get(Prayer.values()[20].ordinal()).setHidden(false);// Mystic Might
|
||||
prayerWidgets.get(Prayer.values()[22].ordinal()).setHidden(false);// Redemption
|
||||
prayerWidgets.get(Prayer.values()[23].ordinal()).setHidden(false);// Smite
|
||||
prayerWidgets.get(Prayer.values()[24].ordinal()).setHidden(false);// Preserve
|
||||
prayerWidgets.get(Prayer.values()[25].ordinal()).setHidden(false);// Chivalry
|
||||
prayerWidgets.get(Prayer.values()[26].ordinal()).setHidden(false);// Piety
|
||||
prayerWidgets.get(Prayer.values()[27].ordinal()).setHidden(false);// Rigour
|
||||
prayerWidgets.get(Prayer.values()[28].ordinal()).setHidden(false);// Augury
|
||||
|
||||
if (config.HideRapidRestore())
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[8].ordinal()).setHidden(true);// Rapid Restore
|
||||
}
|
||||
|
||||
if (config.HideRapidHeal())
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[9].ordinal()).setHidden(true);// Rapid Heal
|
||||
}
|
||||
|
||||
if (config.HideProtectItem())
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[10].ordinal()).setHidden(true);// Protect Item
|
||||
}
|
||||
|
||||
if (config.HideSteelSkin())
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[13].ordinal()).setHidden(true);// Steel Skin
|
||||
}
|
||||
|
||||
if (config.HideUltimateStrength())
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[14].ordinal()).setHidden(true);// Ultimate Strength
|
||||
}
|
||||
|
||||
if (config.HideIncredibleReflex())
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[15].ordinal()).setHidden(true);// Incredible Reflexes
|
||||
}
|
||||
|
||||
if (config.HidePTFMagic())
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[16].ordinal()).setHidden(true);// Protect from Magic
|
||||
}
|
||||
|
||||
if (config.HidePTFRange())
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[17].ordinal()).setHidden(true);// Protect from Range
|
||||
}
|
||||
|
||||
if (config.HidePTFMelee())
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[18].ordinal()).setHidden(true);// Protect from Melee
|
||||
}
|
||||
|
||||
if (config.HideEagle())
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[19].ordinal()).setHidden(true);// eagle eye
|
||||
}
|
||||
|
||||
if (config.HideMystic())
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[20].ordinal()).setHidden(true);// Mystic Might
|
||||
}
|
||||
|
||||
if (config.HideRedemption())
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[22].ordinal()).setHidden(true);// Redemption
|
||||
}
|
||||
|
||||
if (config.HideSmite())
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[23].ordinal()).setHidden(true);// Smite
|
||||
}
|
||||
|
||||
if (config.HidePreserve())
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[24].ordinal()).setHidden(true);// Preserve
|
||||
}
|
||||
|
||||
if (config.HideChivalry())
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[25].ordinal()).setHidden(true);// Chivalry
|
||||
}
|
||||
|
||||
if (config.HidePiety())
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[26].ordinal()).setHidden(true);// Piety
|
||||
}
|
||||
|
||||
if (config.HideRigour())
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[27].ordinal()).setHidden(true);// Rigour
|
||||
}
|
||||
|
||||
if (config.HideAugury())
|
||||
{
|
||||
prayerWidgets.get(Prayer.values()[28].ordinal()).setHidden(true);// Augury
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) 2018, https://runelitepl.us
|
||||
* Copyright (c) 2019, Kyle <https://github.com/kyleeld>
|
||||
* Copyright (c) 2018, Raiever <https://github.com/Raieverr>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -23,9 +25,9 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.runelite.client.plugins.hideprayers;
|
||||
package net.runelite.client.plugins.hideprayers.util;
|
||||
|
||||
public enum PrayerTabState
|
||||
public enum PrayerTabStates
|
||||
{
|
||||
NONE,
|
||||
PRAYERS,
|
||||
Reference in New Issue
Block a user