Merge pull request #3838 from Abextm/fairy-ring-search
Fairy ring search
This commit is contained in:
@@ -26,6 +26,48 @@ package net.runelite.api;
|
|||||||
|
|
||||||
public final class ScriptID
|
public final class ScriptID
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Updates the scrollbar handle and container to the new height of the content container
|
||||||
|
* <ul>
|
||||||
|
* <li> int (WidgetID) Scrollbar's widget ID </li>
|
||||||
|
* <li> int (WidgetID) Container widget ID </li>
|
||||||
|
* <li> int how far down to scroll </li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
public static final int UPDATE_SCROLLBAR = 72;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a chat message
|
||||||
|
* <ul>
|
||||||
|
* <li> int (byte) Flags </li>
|
||||||
|
* <li> String Message to send </li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
public static final int CHATBOX_INPUT = 96;
|
public static final int CHATBOX_INPUT = 96;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes the chatbox input
|
||||||
|
* <ul>
|
||||||
|
* <li> int (boolean) Clear the current text </li>
|
||||||
|
* <li> int (boolean) Unknown; set to 1 </li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
public static final int CLOSE_CHATBOX_INPUT = 299;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the chatbox input to use RuneLite callbacks
|
||||||
|
* <ul>
|
||||||
|
* <li> String Prompt text </li>
|
||||||
|
* <li> String Default value </li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
public static final int RUNELITE_CHATBOX_INPUT_INIT = 10001;
|
public static final int RUNELITE_CHATBOX_INPUT_INIT = 10001;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does nothing
|
||||||
|
*
|
||||||
|
* This is used to eat events when you want a menu action attached to it
|
||||||
|
* because you need an op listener attached to it for it to work
|
||||||
|
*/
|
||||||
|
public static final int NULL = 10003;
|
||||||
}
|
}
|
||||||
|
|||||||
30
runelite-api/src/main/java/net/runelite/api/WidgetType.java
Normal file
30
runelite-api/src/main/java/net/runelite/api/WidgetType.java
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* 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.api;
|
||||||
|
|
||||||
|
public final class WidgetType
|
||||||
|
{
|
||||||
|
public static final int GRAPHIC = 5;
|
||||||
|
}
|
||||||
@@ -267,6 +267,11 @@ public interface Widget
|
|||||||
*/
|
*/
|
||||||
void setHidden(boolean hidden);
|
void setHidden(boolean hidden);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The index of this widget in it's parent's children array
|
||||||
|
*/
|
||||||
|
int getIndex();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the location the widget is being drawn on the canvas.
|
* Gets the location the widget is being drawn on the canvas.
|
||||||
* <p>
|
* <p>
|
||||||
@@ -354,14 +359,46 @@ public interface Widget
|
|||||||
*/
|
*/
|
||||||
boolean contains(Point point);
|
boolean contains(Point point);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the amount of pixels the widget is scrolled in the X axis
|
||||||
|
*/
|
||||||
int getScrollX();
|
int getScrollX();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the amount of pixels the widget is scrolled in the X axis
|
||||||
|
*/
|
||||||
void setScrollX(int scrollX);
|
void setScrollX(int scrollX);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the amount of pixels the widget is scrolled in the Y axis
|
||||||
|
*/
|
||||||
int getScrollY();
|
int getScrollY();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* sets the amount of pixels the widget is scrolled in the Y axis
|
||||||
|
*/
|
||||||
void setScrollY(int scrollY);
|
void setScrollY(int scrollY);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the size of the widget's viewport in the X axis
|
||||||
|
*/
|
||||||
|
int getScrollWidth();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the size of the widget's viewport in the X axis
|
||||||
|
*/
|
||||||
|
void setScrollWidth(int width);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the size of the widget's viewport in the Y axis
|
||||||
|
*/
|
||||||
|
int getScrollHeight();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the size of the widget's viewport in the Y axis
|
||||||
|
*/
|
||||||
|
void setScrollHeight(int height);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the original x-axis coordinate.
|
* Gets the original x-axis coordinate.
|
||||||
*
|
*
|
||||||
@@ -452,4 +489,53 @@ public interface Widget
|
|||||||
* @return the actions
|
* @return the actions
|
||||||
*/
|
*/
|
||||||
String[] getActions();
|
String[] getActions();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a dynamic widget child
|
||||||
|
*
|
||||||
|
* @param index the index of the new widget in the children list or -1 to append to the back
|
||||||
|
* @param type the type of the widget
|
||||||
|
*/
|
||||||
|
Widget createChild(int index, int type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a menu action on the widget
|
||||||
|
*
|
||||||
|
* @param index The index of the menu
|
||||||
|
* @param action The string to be displayed next to the widget's name in the context menu
|
||||||
|
*/
|
||||||
|
void setAction(int index, String action);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a script to be ran when the a menu action is clicked.
|
||||||
|
* hasListener must be true for this to take effect
|
||||||
|
*
|
||||||
|
* @param args A ScriptID, then the args for the script
|
||||||
|
*/
|
||||||
|
void setOnOpListener(Object ...args);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If this widget has any listeners on it
|
||||||
|
*/
|
||||||
|
boolean hasListener();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets if the widget has any listeners. This should be called whenever a setXListener function is called
|
||||||
|
*/
|
||||||
|
void setHasListener(boolean hasListener);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is true if the widget is from an if3 interface, or is dynamically created
|
||||||
|
*/
|
||||||
|
boolean isIf3();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recomputes this widget's x/y/w/h, excluding scroll
|
||||||
|
*/
|
||||||
|
void revalidate();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Recomputes this widget's group's x/y/w/h including scroll
|
||||||
|
*/
|
||||||
|
void revalidateScroll();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ 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_PANEL_GROUP_ID = 381;
|
||||||
public static final int FAIRY_RING_GROUP_ID = 398;
|
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;
|
||||||
@@ -510,6 +510,15 @@ public class WidgetID
|
|||||||
static final int BOTTOM_BAR = 14;
|
static final int BOTTOM_BAR = 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static class FairyRingPanel
|
||||||
|
{
|
||||||
|
static final int HEADER = 2;
|
||||||
|
static final int LIST = 7;
|
||||||
|
static final int FAVORITES = 8;
|
||||||
|
static final int SEPARATOR = 9;
|
||||||
|
static final int SCROLLBAR = 152;
|
||||||
|
}
|
||||||
|
|
||||||
static class FairyRing
|
static class FairyRing
|
||||||
{
|
{
|
||||||
static final int LEFT_ORB_CLOCKWISE = 19;
|
static final int LEFT_ORB_CLOCKWISE = 19;
|
||||||
|
|||||||
@@ -31,8 +31,6 @@ 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_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_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_CLOCKWISE(WidgetID.FAIRY_RING_GROUP_ID, WidgetID.FairyRing.MIDDLE_ORB_CLOCKWISE),
|
||||||
@@ -346,6 +344,14 @@ public enum WidgetInfo
|
|||||||
MTA_ENCHANTMENT_BONUS_TEXT(WidgetID.MTA_ENCHANTMENT_GROUP_ID, WidgetID.MTA.BONUS_TEXT_COMPONENT),
|
MTA_ENCHANTMENT_BONUS_TEXT(WidgetID.MTA_ENCHANTMENT_GROUP_ID, WidgetID.MTA.BONUS_TEXT_COMPONENT),
|
||||||
MTA_ENCHANTMENT_BONUS(WidgetID.MTA_ENCHANTMENT_GROUP_ID, WidgetID.MTA.BONUS_COMPONENT),
|
MTA_ENCHANTMENT_BONUS(WidgetID.MTA_ENCHANTMENT_GROUP_ID, WidgetID.MTA.BONUS_COMPONENT),
|
||||||
|
|
||||||
|
FAIRY_RING(WidgetID.FAIRY_RING_GROUP_ID, 0),
|
||||||
|
|
||||||
|
FAIRY_RING_HEADER(WidgetID.FAIRY_RING_PANEL_GROUP_ID, WidgetID.FairyRingPanel.HEADER),
|
||||||
|
FAIRY_RING_LIST(WidgetID.FAIRY_RING_PANEL_GROUP_ID, WidgetID.FairyRingPanel.LIST),
|
||||||
|
FAIRY_RING_FAVORITES(WidgetID.FAIRY_RING_PANEL_GROUP_ID, WidgetID.FairyRingPanel.FAVORITES),
|
||||||
|
FAIRY_RING_LIST_SEPARATOR(WidgetID.FAIRY_RING_PANEL_GROUP_ID, WidgetID.FairyRingPanel.SEPARATOR),
|
||||||
|
FAIRY_RING_LIST_SCROLLBAR(WidgetID.FAIRY_RING_PANEL_GROUP_ID, WidgetID.FairyRingPanel.SCROLLBAR),
|
||||||
|
|
||||||
DESTROY_ITEM(WidgetID.DESTROY_ITEM_GROUP_ID, 0),
|
DESTROY_ITEM(WidgetID.DESTROY_ITEM_GROUP_ID, 0),
|
||||||
DESTROY_ITEM_NAME(WidgetID.DESTROY_ITEM_GROUP_ID, WidgetID.DestroyItem.DESTROY_ITEM_NAME),
|
DESTROY_ITEM_NAME(WidgetID.DESTROY_ITEM_GROUP_ID, WidgetID.DestroyItem.DESTROY_ITEM_NAME),
|
||||||
DESTROY_ITEM_YES(WidgetID.DESTROY_ITEM_GROUP_ID, WidgetID.DestroyItem.DESTROY_ITEM_YES),
|
DESTROY_ITEM_YES(WidgetID.DESTROY_ITEM_GROUP_ID, WidgetID.DestroyItem.DESTROY_ITEM_YES),
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import com.google.common.eventbus.Subscribe;
|
|||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Singleton;
|
import com.google.inject.Singleton;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.ScriptID;
|
import net.runelite.api.ScriptID;
|
||||||
@@ -39,13 +40,17 @@ import net.runelite.client.callback.ClientThread;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class ChatboxInputManager
|
public class ChatboxInputManager
|
||||||
{
|
{
|
||||||
private static final int NO_LIMIT = Integer.MAX_VALUE;
|
public static final int NO_LIMIT = Integer.MAX_VALUE;
|
||||||
private final Client client;
|
private final Client client;
|
||||||
private final ClientThread clientThread;
|
private final ClientThread clientThread;
|
||||||
|
|
||||||
private Consumer<String> done;
|
private Consumer<String> done;
|
||||||
|
private Consumer<String> changed;
|
||||||
private int characterLimit = NO_LIMIT;
|
private int characterLimit = NO_LIMIT;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private boolean open = false;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ChatboxInputManager(Client client, ClientThread clientThread, EventBus eventBus)
|
public ChatboxInputManager(Client client, ClientThread clientThread, EventBus eventBus)
|
||||||
{
|
{
|
||||||
@@ -67,9 +72,16 @@ public class ChatboxInputManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void openInputWindow(String text, String defaul, int characterLimit, Consumer<String> done)
|
public void openInputWindow(String text, String defaul, int characterLimit, Consumer<String> done)
|
||||||
|
{
|
||||||
|
openInputWindow(text, defaul, characterLimit, null, done);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void openInputWindow(String text, String defaul, int characterLimit, Consumer<String> changed, Consumer<String> done)
|
||||||
{
|
{
|
||||||
this.done = done;
|
this.done = done;
|
||||||
|
this.changed = changed;
|
||||||
this.characterLimit = characterLimit;
|
this.characterLimit = characterLimit;
|
||||||
|
this.open = true;
|
||||||
clientThread.invokeLater(() -> client.runScript(
|
clientThread.invokeLater(() -> client.runScript(
|
||||||
ScriptID.RUNELITE_CHATBOX_INPUT_INIT,
|
ScriptID.RUNELITE_CHATBOX_INPUT_INIT,
|
||||||
text,
|
text,
|
||||||
@@ -77,6 +89,23 @@ public class ChatboxInputManager
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Closes the RuneScape-style chatbox input
|
||||||
|
*/
|
||||||
|
public void closeInputWindow()
|
||||||
|
{
|
||||||
|
if (!this.open)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.open = false;
|
||||||
|
clientThread.invokeLater(() -> client.runScript(
|
||||||
|
ScriptID.CLOSE_CHATBOX_INPUT,
|
||||||
|
1,
|
||||||
|
1
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void scriptCallback(ScriptCallbackEvent ev)
|
public void scriptCallback(ScriptCallbackEvent ev)
|
||||||
{
|
{
|
||||||
@@ -93,9 +122,17 @@ public class ChatboxInputManager
|
|||||||
{
|
{
|
||||||
case 27: // Escape
|
case 27: // Escape
|
||||||
str = "";
|
str = "";
|
||||||
|
if (changed != null)
|
||||||
|
{
|
||||||
|
changed.accept(str);
|
||||||
|
}
|
||||||
// fallthrough
|
// fallthrough
|
||||||
case '\n':
|
case '\n':
|
||||||
done.accept(str);
|
if (done != null)
|
||||||
|
{
|
||||||
|
done.accept(str);
|
||||||
|
}
|
||||||
|
this.open = false;
|
||||||
retval = 1;
|
retval = 1;
|
||||||
break;
|
break;
|
||||||
case '\b':
|
case '\b':
|
||||||
@@ -111,6 +148,11 @@ public class ChatboxInputManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (changed != null)
|
||||||
|
{
|
||||||
|
changed.accept(str);
|
||||||
|
}
|
||||||
|
|
||||||
client.getStringStack()[stringStackSize++] = str;
|
client.getStringStack()[stringStackSize++] = str;
|
||||||
client.getIntStack()[intStackSize++] = retval;
|
client.getIntStack()[intStackSize++] = retval;
|
||||||
client.setIntStackSize(intStackSize);
|
client.setIntStackSize(intStackSize);
|
||||||
|
|||||||
@@ -134,12 +134,16 @@ public class WidgetInfoTableModel extends AbstractTableModel
|
|||||||
out.add(new WidgetField<>("RelativeY", Widget::getRelativeY, Widget::setRelativeY, Integer.class));
|
out.add(new WidgetField<>("RelativeY", Widget::getRelativeY, Widget::setRelativeY, Integer.class));
|
||||||
out.add(new WidgetField<>("CanvasLocation", Widget::getCanvasLocation));
|
out.add(new WidgetField<>("CanvasLocation", Widget::getCanvasLocation));
|
||||||
out.add(new WidgetField<>("Bounds", Widget::getBounds));
|
out.add(new WidgetField<>("Bounds", Widget::getBounds));
|
||||||
out.add(new WidgetField<>("ScrollX", Widget::getScrollX));
|
out.add(new WidgetField<>("ScrollX", Widget::getScrollX, Widget::setScrollX, Integer.class));
|
||||||
out.add(new WidgetField<>("ScrollY", Widget::getScrollY));
|
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<>("OriginalX", Widget::getOriginalX));
|
out.add(new WidgetField<>("OriginalX", Widget::getOriginalX));
|
||||||
out.add(new WidgetField<>("OriginalY", Widget::getOriginalY));
|
out.add(new WidgetField<>("OriginalY", Widget::getOriginalY));
|
||||||
out.add(new WidgetField<>("PaddingX", Widget::getPaddingX));
|
out.add(new WidgetField<>("PaddingX", Widget::getPaddingX));
|
||||||
out.add(new WidgetField<>("PaddingY", Widget::getPaddingY));
|
out.add(new WidgetField<>("PaddingY", Widget::getPaddingY));
|
||||||
|
out.add(new WidgetField<>("IsIf3", Widget::isIf3));
|
||||||
|
out.add(new WidgetField<>("HasListener", Widget::hasListener, Widget::setHasListener, Boolean.class));
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,8 +49,21 @@ class WidgetTreeNode extends DefaultMutableTreeNode
|
|||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
Widget widget = getWidget();
|
Widget widget = getWidget();
|
||||||
|
|
||||||
int id = widget.getId();
|
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);
|
WidgetInfo info = WidgetInspector.getWidgetInfo(id);
|
||||||
return type + " " + TO_GROUP(id) + "." + TO_CHILD(id) + ((info != null) ? " " + info.name() : "");
|
if (info != null)
|
||||||
|
{
|
||||||
|
str += " " + info.name();
|
||||||
|
}
|
||||||
|
|
||||||
|
return str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
|
* Copyright (c) 2018 Abex
|
||||||
|
* Copyright (c) 2017, Tyler <https://github.com/tylerthardy>
|
||||||
* Copyright (c) 2018, Yoav Ram <https://github.com/yoyo421>
|
* Copyright (c) 2018, Yoav Ram <https://github.com/yoyo421>
|
||||||
* Copyright (c) 2018, Infinitay <https://github.com/Infinitay>
|
* Copyright (c) 2018, Infinitay <https://github.com/Infinitay>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
@@ -26,20 +28,38 @@
|
|||||||
|
|
||||||
package net.runelite.client.plugins.fairyring;
|
package net.runelite.client.plugins.fairyring;
|
||||||
|
|
||||||
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.eventbus.Subscribe;
|
import com.google.common.eventbus.Subscribe;
|
||||||
|
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.Inject;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.ScriptID;
|
||||||
|
import net.runelite.api.SoundEffectID;
|
||||||
|
import net.runelite.api.SpriteID;
|
||||||
import net.runelite.api.Varbits;
|
import net.runelite.api.Varbits;
|
||||||
|
import net.runelite.api.WidgetType;
|
||||||
|
import net.runelite.api.events.GameTick;
|
||||||
|
import net.runelite.api.events.MenuOptionClicked;
|
||||||
import net.runelite.api.events.VarbitChanged;
|
import net.runelite.api.events.VarbitChanged;
|
||||||
import net.runelite.api.events.WidgetLoaded;
|
import net.runelite.api.events.WidgetLoaded;
|
||||||
import net.runelite.api.widgets.Widget;
|
import net.runelite.api.widgets.Widget;
|
||||||
import net.runelite.api.widgets.WidgetID;
|
import net.runelite.api.widgets.WidgetID;
|
||||||
import net.runelite.api.widgets.WidgetInfo;
|
import net.runelite.api.widgets.WidgetInfo;
|
||||||
|
import net.runelite.client.config.ConfigManager;
|
||||||
|
import net.runelite.client.game.ChatboxInputManager;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
|
import net.runelite.client.util.Text;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Fairy Ring Helper",
|
name = "Fairy Rings",
|
||||||
description = "Show the location of the fairy ring teleport",
|
description = "Show the location of the fairy ring teleport",
|
||||||
tags = {"teleportation"}
|
tags = {"teleportation"}
|
||||||
)
|
)
|
||||||
@@ -49,9 +69,44 @@ public class FairyRingPlugin extends Plugin
|
|||||||
private static final String[] middleDial = new String[]{"I", "L", "K", "J"};
|
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 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
|
@Inject
|
||||||
private Client client;
|
private Client client;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private FairyRingConfig config;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ChatboxInputManager chatboxInputManager;
|
||||||
|
|
||||||
|
private Widget searchBtn;
|
||||||
|
private boolean chatboxOpenLastTick = false;
|
||||||
|
private boolean clearFilter = false;
|
||||||
|
private Collection<CodeWidgets> codes = null;
|
||||||
|
|
||||||
|
@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;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
FairyRingConfig getConfig(ConfigManager configManager)
|
||||||
|
{
|
||||||
|
return configManager.getConfig(FairyRingConfig.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onVarbitChanged(VarbitChanged event)
|
public void onVarbitChanged(VarbitChanged event)
|
||||||
{
|
{
|
||||||
@@ -61,9 +116,55 @@ public class FairyRingPlugin extends Plugin
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onWidgetLoaded(WidgetLoaded widgetLoaded)
|
public void onWidgetLoaded(WidgetLoaded widgetLoaded)
|
||||||
{
|
{
|
||||||
if (widgetLoaded.getGroupId() == WidgetID.FAIRY_RING_CODE_GROUP_ID)
|
if (widgetLoaded.getGroupId() == WidgetID.FAIRY_RING_PANEL_GROUP_ID)
|
||||||
{
|
{
|
||||||
setWidgetTextToDestination();
|
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.setOnOpListener(ScriptID.NULL);
|
||||||
|
searchBtn.setHasListener(true);
|
||||||
|
searchBtn.setAction(1, MENU_OPEN);
|
||||||
|
searchBtn.setName("Search");
|
||||||
|
searchBtn.revalidate();
|
||||||
|
|
||||||
|
codes = null;
|
||||||
|
|
||||||
|
if (config.autoOpen())
|
||||||
|
{
|
||||||
|
openSearch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onMenuOptionClicked(MenuOptionClicked ev)
|
||||||
|
{
|
||||||
|
if (searchBtn != null && searchBtn.getId() == ev.getWidgetId())
|
||||||
|
{
|
||||||
|
switch (ev.getMenuOption())
|
||||||
|
{
|
||||||
|
case MENU_OPEN:
|
||||||
|
ev.consume();
|
||||||
|
openSearch();
|
||||||
|
client.playSoundEffect(SoundEffectID.UI_BOOP);
|
||||||
|
break;
|
||||||
|
case MENU_CLOSE:
|
||||||
|
ev.consume();
|
||||||
|
updateFilter("");
|
||||||
|
searchBtn.setAction(1, MENU_OPEN);
|
||||||
|
chatboxInputManager.closeInputWindow();
|
||||||
|
client.playSoundEffect(SoundEffectID.UI_BOOP);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,4 +193,178 @@ public class FairyRingPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
return FairyRings.valueOf(leftDial[varbitValueDialLeft] + middleDial[varbitValueDialMiddle] + rightDial[varbitValueDialRight]);
|
return FairyRings.valueOf(leftDial[varbitValueDialLeft] + middleDial[varbitValueDialMiddle] + rightDial[varbitValueDialRight]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void openSearch()
|
||||||
|
{
|
||||||
|
updateFilter("");
|
||||||
|
searchBtn.setAction(1, MENU_CLOSE);
|
||||||
|
chatboxInputManager.openInputWindow("Filter fairy rings", "", ChatboxInputManager.NO_LIMIT, this::updateFilter, s ->
|
||||||
|
{
|
||||||
|
// We can't run it right now because scripts can't run other scripts in their callbacks
|
||||||
|
clearFilter = true;
|
||||||
|
searchBtn.setAction(1, MENU_OPEN);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onGameTick(GameTick t)
|
||||||
|
{
|
||||||
|
if (clearFilter)
|
||||||
|
{
|
||||||
|
updateFilter("");
|
||||||
|
clearFilter = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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 = chatboxInputManager.isOpen();
|
||||||
|
|
||||||
|
if (!fairyRingWidgetOpen && chatboxOpen && chatboxOpenLastTick)
|
||||||
|
{
|
||||||
|
searchBtn.setAction(1, MENU_OPEN);
|
||||||
|
chatboxInputManager.closeInputWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
chatboxOpenLastTick = chatboxOpen && fairyRingWidgetOpen;
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
if (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<Integer, CodeWidgets> 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.length() > 0)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
list.setScrollHeight(y);
|
||||||
|
list.revalidateScroll();
|
||||||
|
client.runScript(
|
||||||
|
ScriptID.UPDATE_SCROLLBAR,
|
||||||
|
WidgetInfo.FAIRY_RING_LIST_SCROLLBAR.getId(),
|
||||||
|
WidgetInfo.FAIRY_RING_LIST.getId(),
|
||||||
|
0
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,10 +26,8 @@
|
|||||||
|
|
||||||
package net.runelite.client.plugins.fairyring;
|
package net.runelite.client.plugins.fairyring;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@AllArgsConstructor
|
|
||||||
public enum FairyRings
|
public enum FairyRings
|
||||||
{
|
{
|
||||||
// A
|
// A
|
||||||
@@ -50,7 +48,7 @@ public enum FairyRings
|
|||||||
BIQ("Kalphite Hive"),
|
BIQ("Kalphite Hive"),
|
||||||
BIS("Ardougne Zoo - Unicorns"),
|
BIS("Ardougne Zoo - Unicorns"),
|
||||||
BJR("Realm of the Fisher King"),
|
BJR("Realm of the Fisher King"),
|
||||||
BJS("(Island) Near Zul-Andra"),
|
BJS("(Island) Near Zul-Andra", "zulrah"),
|
||||||
BKP("South of Castle Wars"),
|
BKP("South of Castle Wars"),
|
||||||
BKQ("Enchanted Valley"),
|
BKQ("Enchanted Valley"),
|
||||||
BKR("Mort Myre Swamp, south of Canifis"),
|
BKR("Mort Myre Swamp, south of Canifis"),
|
||||||
@@ -73,7 +71,7 @@ public enum FairyRings
|
|||||||
// D
|
// D
|
||||||
DIP("(Sire Boss) Abyssal Nexus"),
|
DIP("(Sire Boss) Abyssal Nexus"),
|
||||||
DIR("Gorak's Plane"),
|
DIR("Gorak's Plane"),
|
||||||
DIQ("Player-owned house"),
|
DIQ("Player-owned house", "poh home"),
|
||||||
DIS("Wizards' Tower"),
|
DIS("Wizards' Tower"),
|
||||||
DJP("Tower of Life"),
|
DJP("Tower of Life"),
|
||||||
DJR("Chasm of Fire"),
|
DJR("Chasm of Fire"),
|
||||||
@@ -86,4 +84,19 @@ public enum FairyRings
|
|||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final String destination;
|
private final String destination;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private final String tags;
|
||||||
|
|
||||||
|
FairyRings(String destination)
|
||||||
|
{
|
||||||
|
this(destination, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
FairyRings(String destination, String tags)
|
||||||
|
{
|
||||||
|
this.destination = destination;
|
||||||
|
this.tags = tags.toLowerCase() + " " + destination.toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -477,4 +477,62 @@ public abstract class RSWidgetMixin implements RSWidget
|
|||||||
WidgetPositioned widgetPositioned = new WidgetPositioned();
|
WidgetPositioned widgetPositioned = new WidgetPositioned();
|
||||||
client.getCallbacks().postDeferred(widgetPositioned);
|
client.getCallbacks().postDeferred(widgetPositioned);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@Override
|
||||||
|
public Widget createChild(int index, int type)
|
||||||
|
{
|
||||||
|
RSWidget w = client.createWidget();
|
||||||
|
w.setType(type);
|
||||||
|
w.setParentId(getId());
|
||||||
|
w.setId(getId());
|
||||||
|
w.setIsIf3(true);
|
||||||
|
|
||||||
|
RSWidget[] siblings = getChildren();
|
||||||
|
|
||||||
|
if (index < 0)
|
||||||
|
{
|
||||||
|
if (siblings == null)
|
||||||
|
{
|
||||||
|
index = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
index = siblings.length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (siblings == null)
|
||||||
|
{
|
||||||
|
siblings = new RSWidget[index + 1];
|
||||||
|
setChildren(siblings);
|
||||||
|
}
|
||||||
|
else if (siblings.length <= index)
|
||||||
|
{
|
||||||
|
RSWidget[] newSiblings = new RSWidget[index + 1];
|
||||||
|
System.arraycopy(siblings, 0, newSiblings, 0, siblings.length);
|
||||||
|
siblings = newSiblings;
|
||||||
|
setChildren(siblings);
|
||||||
|
}
|
||||||
|
|
||||||
|
siblings[index] = w;
|
||||||
|
w.setIndex(index);
|
||||||
|
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@Override
|
||||||
|
public void revalidate()
|
||||||
|
{
|
||||||
|
client.revalidateWidget(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@Override
|
||||||
|
public void revalidateScroll()
|
||||||
|
{
|
||||||
|
client.revalidateWidget(this);
|
||||||
|
client.revalidateWidgetScroll(client.getWidgets()[TO_GROUP(this.getId())], this, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
37
runelite-scripts/scripts/null.rs2asm
Normal file
37
runelite-scripts/scripts/null.rs2asm
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
; 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.
|
||||||
|
|
||||||
|
;;
|
||||||
|
; Does nothing
|
||||||
|
;
|
||||||
|
; This is used to eat events when you want a menu action attached to it
|
||||||
|
; because you need an op listener attached to it for it to work
|
||||||
|
;;
|
||||||
|
|
||||||
|
.id 10003
|
||||||
|
.int_stack_count 0
|
||||||
|
.string_stack_count 0
|
||||||
|
.int_var_count 0
|
||||||
|
.string_var_count 0
|
||||||
|
|
||||||
|
return
|
||||||
@@ -648,4 +648,13 @@ public interface RSClient extends RSGameEngine, Client
|
|||||||
RSItem getLastItemDespawn();
|
RSItem getLastItemDespawn();
|
||||||
|
|
||||||
void setLastItemDespawn(RSItem lastItemDespawn);
|
void setLastItemDespawn(RSItem lastItemDespawn);
|
||||||
|
|
||||||
|
@Construct
|
||||||
|
RSWidget createWidget();
|
||||||
|
|
||||||
|
@Import("revalidateWidget")
|
||||||
|
void revalidateWidget(Widget w);
|
||||||
|
|
||||||
|
@Import("revalidateWidgetScroll")
|
||||||
|
void revalidateWidgetScroll(Widget[] group, Widget w, boolean postEvent);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,9 @@ public interface RSWidget extends Widget
|
|||||||
@Override
|
@Override
|
||||||
RSWidget[] getChildren();
|
RSWidget[] getChildren();
|
||||||
|
|
||||||
|
@Import("children")
|
||||||
|
void setChildren(RSWidget[] children);
|
||||||
|
|
||||||
@Import("id")
|
@Import("id")
|
||||||
@Override
|
@Override
|
||||||
int getId();
|
int getId();
|
||||||
@@ -46,9 +49,15 @@ public interface RSWidget extends Widget
|
|||||||
|
|
||||||
void setRenderY(int y);
|
void setRenderY(int y);
|
||||||
|
|
||||||
|
@Import("id")
|
||||||
|
void setId(int id);
|
||||||
|
|
||||||
@Import("parentId")
|
@Import("parentId")
|
||||||
int getRSParentId();
|
int getRSParentId();
|
||||||
|
|
||||||
|
@Import("parentId")
|
||||||
|
void setParentId(int id);
|
||||||
|
|
||||||
@Import("clickMask")
|
@Import("clickMask")
|
||||||
int getClickMask();
|
int getClickMask();
|
||||||
|
|
||||||
@@ -141,6 +150,9 @@ public interface RSWidget extends Widget
|
|||||||
@Import("index")
|
@Import("index")
|
||||||
int getIndex();
|
int getIndex();
|
||||||
|
|
||||||
|
@Import("index")
|
||||||
|
void setIndex(int index);
|
||||||
|
|
||||||
@Import("rotationX")
|
@Import("rotationX")
|
||||||
int getRotationX();
|
int getRotationX();
|
||||||
|
|
||||||
@@ -182,6 +194,22 @@ public interface RSWidget extends Widget
|
|||||||
@Override
|
@Override
|
||||||
void setScrollY(int scrollY);
|
void setScrollY(int scrollY);
|
||||||
|
|
||||||
|
@Import("scrollWidth")
|
||||||
|
@Override
|
||||||
|
int getScrollWidth();
|
||||||
|
|
||||||
|
@Import("scrollWidth")
|
||||||
|
@Override
|
||||||
|
void setScrollWidth(int width);
|
||||||
|
|
||||||
|
@Import("scrollHeight")
|
||||||
|
@Override
|
||||||
|
int getScrollHeight();
|
||||||
|
|
||||||
|
@Import("scrollHeight")
|
||||||
|
@Override
|
||||||
|
void setScrollHeight(int height);
|
||||||
|
|
||||||
@Import("spriteId")
|
@Import("spriteId")
|
||||||
@Override
|
@Override
|
||||||
int getSpriteId();
|
int getSpriteId();
|
||||||
@@ -250,4 +278,27 @@ public interface RSWidget extends Widget
|
|||||||
void setPaddingY(int paddingY);
|
void setPaddingY(int paddingY);
|
||||||
|
|
||||||
void broadcastHidden(boolean hidden);
|
void broadcastHidden(boolean hidden);
|
||||||
|
|
||||||
|
@Import("onOpListener")
|
||||||
|
@Override
|
||||||
|
void setOnOpListener(Object ...args);
|
||||||
|
|
||||||
|
@Import("setAction")
|
||||||
|
@Override
|
||||||
|
void setAction(int idx, String action);
|
||||||
|
|
||||||
|
@Import("isIf3")
|
||||||
|
@Override
|
||||||
|
boolean isIf3();
|
||||||
|
|
||||||
|
@Import("isIf3")
|
||||||
|
void setIsIf3(boolean isIf3);
|
||||||
|
|
||||||
|
@Import("hasListener")
|
||||||
|
@Override
|
||||||
|
boolean hasListener();
|
||||||
|
|
||||||
|
@Import("hasListener")
|
||||||
|
@Override
|
||||||
|
void setHasListener(boolean hasListener);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user