Merge pull request #1714 from Infinitay/fairy-ring-interface
Add Fairy Ring Helper Plugin
This commit is contained in:
@@ -269,7 +269,7 @@ public enum Varbits
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Barrows
|
* Barrows
|
||||||
*/
|
*/
|
||||||
BARROWS_KILLED_AHRIM(457),
|
BARROWS_KILLED_AHRIM(457),
|
||||||
BARROWS_KILLED_DHAROK(458),
|
BARROWS_KILLED_DHAROK(458),
|
||||||
BARROWS_KILLED_GUTHAN(459),
|
BARROWS_KILLED_GUTHAN(459),
|
||||||
@@ -302,7 +302,15 @@ public enum Varbits
|
|||||||
*/
|
*/
|
||||||
DAILY_HERB_BOX(3961),
|
DAILY_HERB_BOX(3961),
|
||||||
DAILY_STAVES(4539),
|
DAILY_STAVES(4539),
|
||||||
DAILY_ESSENCE(4547);
|
DAILY_ESSENCE(4547),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fairy Ring
|
||||||
|
*/
|
||||||
|
FAIR_RING_LAST_DESTINATION(5374),
|
||||||
|
FAIRY_RING_DIAL_ADCB(3985), //Left dial
|
||||||
|
FAIRY_RIGH_DIAL_ILJK(3986), //Middle dial
|
||||||
|
FAIRY_RING_DIAL_PSRQ(3987); //Right dial
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* varbit id
|
* varbit id
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ package net.runelite.api.widgets;
|
|||||||
|
|
||||||
public class WidgetID
|
public class WidgetID
|
||||||
{
|
{
|
||||||
|
public static final int FAIRY_RING_CODE_GROUP_ID = 381;
|
||||||
|
public static final int FAIRY_RING_GROUP_ID = 398;
|
||||||
public static final int LOGOUT_PANEL_ID = 182;
|
public static final int LOGOUT_PANEL_ID = 182;
|
||||||
public static final int BANK_GROUP_ID = 12;
|
public static final int BANK_GROUP_ID = 12;
|
||||||
public static final int BANK_INVENTORY_GROUP_ID = 15;
|
public static final int BANK_INVENTORY_GROUP_ID = 15;
|
||||||
@@ -396,4 +398,20 @@ public class WidgetID
|
|||||||
static final int WIDGET = 1;
|
static final int WIDGET = 1;
|
||||||
static final int BOTTOM_BAR = 14;
|
static final int BOTTOM_BAR = 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static class FairyRing
|
||||||
|
{
|
||||||
|
static final int LEFT_ORB_CLOCKWISE = 19;
|
||||||
|
static final int LEFT_ORB_COUNTER_CLOCKWISE = 20;
|
||||||
|
static final int MIDDLE_ORB_CLOCKWISE = 21;
|
||||||
|
static final int MIDDLE_ORB_COUNTER_CLOCKWISE = 22;
|
||||||
|
static final int RIGHT_ORB_CLOCKWISE = 23;
|
||||||
|
static final int RIGHT_ORB_COUNTER_CLOCKWISE = 24;
|
||||||
|
static final int TELEPORT_BUTTON = 26;
|
||||||
|
}
|
||||||
|
|
||||||
|
static class FairyRingCode
|
||||||
|
{
|
||||||
|
static final int FAIRY_QUEEN_HIDEOUT = 139;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,17 @@ package net.runelite.api.widgets;
|
|||||||
|
|
||||||
public enum WidgetInfo
|
public enum WidgetInfo
|
||||||
{
|
{
|
||||||
|
FAIRY_QUEEN_HIDEOUT_CODE(WidgetID.FAIRY_RING_CODE_GROUP_ID, WidgetID.FairyRingCode.FAIRY_QUEEN_HIDEOUT),
|
||||||
|
|
||||||
|
FAIRY_RING_LEFT_ORB_CLOCKWISE(WidgetID.FAIRY_RING_GROUP_ID, WidgetID.FairyRing.LEFT_ORB_CLOCKWISE),
|
||||||
|
FAIRY_RING_LEFT_ORB_COUNTER_CLOCKWISE(WidgetID.FAIRY_RING_GROUP_ID, WidgetID.FairyRing.LEFT_ORB_COUNTER_CLOCKWISE),
|
||||||
|
FAIRY_RING_MIDDLE_ORB_CLOCKWISE(WidgetID.FAIRY_RING_GROUP_ID, WidgetID.FairyRing.MIDDLE_ORB_CLOCKWISE),
|
||||||
|
FAIRY_RING_MIDDLE_ORB_COUNTER_CLOCKWISE(WidgetID.FAIRY_RING_GROUP_ID, WidgetID.FairyRing.MIDDLE_ORB_COUNTER_CLOCKWISE),
|
||||||
|
FAIRY_RING_RIGHT_ORB_CLOCKWISE(WidgetID.FAIRY_RING_GROUP_ID, WidgetID.FairyRing.RIGHT_ORB_CLOCKWISE),
|
||||||
|
FAIRY_RING_RIGHT_ORB_COUNTER_CLOCKWISE(WidgetID.FAIRY_RING_GROUP_ID, WidgetID.FairyRing.RIGHT_ORB_COUNTER_CLOCKWISE),
|
||||||
|
|
||||||
|
FAIRY_RING_TELEPORT_BUTTON(WidgetID.FAIRY_RING_GROUP_ID, WidgetID.FairyRing.TELEPORT_BUTTON),
|
||||||
|
|
||||||
LOGOUT_BUTTON(WidgetID.LOGOUT_PANEL_ID, WidgetID.LogoutPanel.LOGOUT_BUTTON),
|
LOGOUT_BUTTON(WidgetID.LOGOUT_PANEL_ID, WidgetID.LogoutPanel.LOGOUT_BUTTON),
|
||||||
|
|
||||||
INVENTORY(WidgetID.INVENTORY_GROUP_ID, 0),
|
INVENTORY(WidgetID.INVENTORY_GROUP_ID, 0),
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Yoav Ram <https://github.com/yoyo421>
|
||||||
|
* Copyright (c) 2018, Infinitay <https://github.com/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.eventbus.Subscribe;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.Varbits;
|
||||||
|
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.plugins.Plugin;
|
||||||
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
|
|
||||||
|
@PluginDescriptor(
|
||||||
|
name = "Fairy Ring Helper"
|
||||||
|
)
|
||||||
|
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"};
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Client client;
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onVarbitChanged(VarbitChanged event)
|
||||||
|
{
|
||||||
|
setWidgetTextToDestination();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onWidgetLoaded(WidgetLoaded widgetLoaded)
|
||||||
|
{
|
||||||
|
if (widgetLoaded.getGroupId() == WidgetID.FAIRY_RING_CODE_GROUP_ID)
|
||||||
|
{
|
||||||
|
setWidgetTextToDestination();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setWidgetTextToDestination()
|
||||||
|
{
|
||||||
|
Widget fairyRingTeleportButton = client.getWidget(WidgetInfo.FAIRY_RING_TELEPORT_BUTTON);
|
||||||
|
if (fairyRingTeleportButton != null && !fairyRingTeleportButton.isHidden())
|
||||||
|
{
|
||||||
|
String destination;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FairyRings fairyRingDestination = getFairyRingDestination(client.getSetting(Varbits.FAIRY_RING_DIAL_ADCB),
|
||||||
|
client.getSetting(Varbits.FAIRY_RIGH_DIAL_ILJK), client.getSetting(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]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Yoav Ram <https://github.com/yoyo421>
|
||||||
|
* Copyright (c) 2018, Infinitay <https://github.com/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.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
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"),
|
||||||
|
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 House Library"),
|
||||||
|
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"),
|
||||||
|
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
|
||||||
|
private final String destination;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user