spellbook: bugfixes/improvements (#1427)
* Add InterfaceTab enum, remove duplicate varbit * Add widget.containsMouse rs-api method, sort scriptids, add various wids * Refactor/improve/fix spellbook I even made everything I could final to please goban * Fix bugs/cleanup/improvements * Update SpellbookPlugin.java
This commit is contained in:
@@ -26,6 +26,18 @@ package net.runelite.api;
|
|||||||
|
|
||||||
public final class ScriptID
|
public final class ScriptID
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Handles zoom input
|
||||||
|
*
|
||||||
|
* Updates the VarClientInts (73, 74) to this same value
|
||||||
|
* <ul>
|
||||||
|
* <li> int Reset zoom position </li>
|
||||||
|
* <li> int Reset zoom position </li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
@ScriptArguments(integer = 2)
|
||||||
|
public static final int CAMERA_DO_ZOOM = 42;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the scrollbar handle and container to the new height of the content container
|
* Updates the scrollbar handle and container to the new height of the content container
|
||||||
* <ul>
|
* <ul>
|
||||||
@@ -47,12 +59,6 @@ public final class ScriptID
|
|||||||
@ScriptArguments(integer = 1, string = 1)
|
@ScriptArguments(integer = 1, string = 1)
|
||||||
public static final int CHATBOX_INPUT = 96;
|
public static final int CHATBOX_INPUT = 96;
|
||||||
|
|
||||||
/**
|
|
||||||
* Rebuilds the chatbox
|
|
||||||
*/
|
|
||||||
@ScriptArguments()
|
|
||||||
public static final int BUILD_CHATBOX = 216;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens the Private Message chat interface
|
* Opens the Private Message chat interface
|
||||||
*
|
*
|
||||||
@@ -64,6 +70,12 @@ public final class ScriptID
|
|||||||
@ScriptArguments(string = 1)
|
@ScriptArguments(string = 1)
|
||||||
public static final int OPEN_PRIVATE_MESSAGE_INTERFACE = 107;
|
public static final int OPEN_PRIVATE_MESSAGE_INTERFACE = 107;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rebuilds the chatbox
|
||||||
|
*/
|
||||||
|
@ScriptArguments()
|
||||||
|
public static final int BUILD_CHATBOX = 216;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rebuilds the text input widget inside the chat interface
|
* Rebuilds the text input widget inside the chat interface
|
||||||
* <ul>
|
* <ul>
|
||||||
@@ -73,6 +85,12 @@ public final class ScriptID
|
|||||||
@ScriptArguments(string = 1)
|
@ScriptArguments(string = 1)
|
||||||
public static final int CHAT_TEXT_INPUT_REBUILD = 222;
|
public static final int CHAT_TEXT_INPUT_REBUILD = 222;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the chatbox input widget
|
||||||
|
*/
|
||||||
|
@ScriptArguments()
|
||||||
|
public static final int CHAT_PROMPT_INIT = 223;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Closes the chatbox input
|
* Closes the chatbox input
|
||||||
* <ul>
|
* <ul>
|
||||||
@@ -94,21 +112,10 @@ public final class ScriptID
|
|||||||
public static final int MESSAGE_LAYER_OPEN = 677;
|
public static final int MESSAGE_LAYER_OPEN = 677;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the chatbox input widget
|
* Clicking bank pin buttons runs this
|
||||||
*/
|
*/
|
||||||
@ScriptArguments()
|
@ScriptArguments(integer = 20)
|
||||||
public static final int CHAT_PROMPT_INIT = 223;
|
public static final int BANK_PIN_OP = 685;
|
||||||
|
|
||||||
/**
|
|
||||||
* Displays the game messages when clicking on an item inside the Items Kept on Death interface
|
|
||||||
* <ul>
|
|
||||||
* <li> int (boolean) Item kept on death </li>
|
|
||||||
* <li> int Item Quantity </li>
|
|
||||||
* <li> String Item Name </li>
|
|
||||||
* </ul>
|
|
||||||
*/
|
|
||||||
@ScriptArguments(integer = 2, string = 1)
|
|
||||||
public static final int DEATH_KEEP_ITEM_EXAMINE = 1603;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks the state of the given stash unit.
|
* Checks the state of the given stash unit.
|
||||||
@@ -123,10 +130,31 @@ public final class ScriptID
|
|||||||
*/
|
*/
|
||||||
@ScriptArguments(integer = 4)
|
@ScriptArguments(integer = 4)
|
||||||
public static final int WATSON_STASH_UNIT_CHECK = 1479;
|
public static final int WATSON_STASH_UNIT_CHECK = 1479;
|
||||||
|
/**
|
||||||
|
* Displays the game messages when clicking on an item inside the Items Kept on Death interface
|
||||||
|
* <ul>
|
||||||
|
* <li> int (boolean) Item kept on death </li>
|
||||||
|
* <li> int Item Quantity </li>
|
||||||
|
* <li> String Item Name </li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
@ScriptArguments(integer = 2, string = 1)
|
||||||
|
public static final int DEATH_KEEP_ITEM_EXAMINE = 1603;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Queries the completion state of a quest by its struct id
|
* Creates a disabled experience drop
|
||||||
|
*
|
||||||
* <ul>
|
* <ul>
|
||||||
|
* <li>int (Skill ordinal) Sets what icon to use</li>
|
||||||
|
* <li>int Amount of exp to drop</li>
|
||||||
|
* </ul>
|
||||||
|
*/
|
||||||
|
@ScriptArguments(integer = 2)
|
||||||
|
public static final int XPDROP_DISABLED = 2091;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <ul>
|
||||||
|
* Queries the completion state of a quest by its struct id
|
||||||
* <li> int (struct) The id of the quest
|
* <li> int (struct) The id of the quest
|
||||||
* </ul>
|
* </ul>
|
||||||
* Returns
|
* Returns
|
||||||
@@ -148,16 +176,10 @@ public final class ScriptID
|
|||||||
public static final int DIARY_QUEST_UPDATE_LINECOUNT = 2523;
|
public static final int DIARY_QUEST_UPDATE_LINECOUNT = 2523;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles zoom input
|
* Rebuilds the Spellbook
|
||||||
*
|
|
||||||
* Updates the VarClientInts (73, 74) to this same value
|
|
||||||
* <ul>
|
|
||||||
* <li> int Reset zoom position </li>
|
|
||||||
* <li> int Reset zoom position </li>
|
|
||||||
* </ul>
|
|
||||||
*/
|
*/
|
||||||
@ScriptArguments(integer = 2)
|
@ScriptArguments(integer = 10, string = 2)
|
||||||
public static final int CAMERA_DO_ZOOM = 42;
|
public static final int MAGIC_SPELLBOOK_REDRAW = 2611;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does nothing
|
* Does nothing
|
||||||
@@ -174,17 +196,6 @@ public final class ScriptID
|
|||||||
@ScriptArguments(string = 2)
|
@ScriptArguments(string = 2)
|
||||||
public static final int PRIVMSG = 10004;
|
public static final int PRIVMSG = 10004;
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a disabled experience drop
|
|
||||||
*
|
|
||||||
* <ul>
|
|
||||||
* <li>int (Skill ordinal) Sets what icon to use</li>
|
|
||||||
* <li>int Amount of exp to drop</li>
|
|
||||||
* </ul>
|
|
||||||
*/
|
|
||||||
@ScriptArguments(integer = 2)
|
|
||||||
public static final int XPDROP_DISABLED = 2091;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Join a clan, duh
|
* Join a clan, duh
|
||||||
*/
|
*/
|
||||||
@@ -196,10 +207,5 @@ public final class ScriptID
|
|||||||
*/
|
*/
|
||||||
@ScriptArguments(string = 1)
|
@ScriptArguments(string = 1)
|
||||||
public static final int PUBLICMSG = 13337;
|
public static final int PUBLICMSG = 13337;
|
||||||
|
|
||||||
/**
|
|
||||||
* Clicking bank pin buttons runs this
|
|
||||||
*/
|
|
||||||
@ScriptArguments(integer = 20)
|
|
||||||
public static final int BANK_PIN_OP = 685;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,24 +51,10 @@ public enum VarClientInt
|
|||||||
MEMBERSHIP_STATUS(103),
|
MEMBERSHIP_STATUS(103),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 0 = Combat
|
* The currently open interface tab
|
||||||
* 1 = Stats
|
* @see net.runelite.api.vars.InterfaceTab
|
||||||
* 2 = Quest
|
|
||||||
* 3 = Inventory
|
|
||||||
* 4 = Equipment
|
|
||||||
* 5 = Prayer
|
|
||||||
* 6 = Spellbook
|
|
||||||
* 7 = Clan
|
|
||||||
* 8 = Account Managment
|
|
||||||
* 9 = Friends
|
|
||||||
* 10 = Logout
|
|
||||||
* 11 = Options
|
|
||||||
* 12 = Emotes
|
|
||||||
* 13 = Music
|
|
||||||
*/
|
*/
|
||||||
PLAYER_INTERFACE_CONTAINER_OPENED(171),
|
INTERFACE_TAB(171),
|
||||||
|
|
||||||
INVENTORY_TAB(171),
|
|
||||||
|
|
||||||
WORLD_MAP_SEARCH_FOCUSED(190);
|
WORLD_MAP_SEARCH_FOCUSED(190);
|
||||||
|
|
||||||
|
|||||||
@@ -498,13 +498,7 @@ public enum Varbits
|
|||||||
* 2 = lunars
|
* 2 = lunars
|
||||||
* 3 = arrceus
|
* 3 = arrceus
|
||||||
**/
|
**/
|
||||||
SPELLBOOK_ID(4070),
|
SPELLBOOK(4070),
|
||||||
|
|
||||||
/**
|
|
||||||
* 0 = no
|
|
||||||
* 1 = yes
|
|
||||||
**/
|
|
||||||
SPELLBOOK_HIDDEN(6718),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Amount of items in each bank tab
|
* Amount of items in each bank tab
|
||||||
@@ -647,11 +641,6 @@ public enum Varbits
|
|||||||
//TODO
|
//TODO
|
||||||
QUEST_IN_SEARCH_OF_KNOWLEDGE(6067),
|
QUEST_IN_SEARCH_OF_KNOWLEDGE(6067),
|
||||||
|
|
||||||
/**
|
|
||||||
* Active spellbook (see enumID)
|
|
||||||
*/
|
|
||||||
SPELLBOOK(4070),
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Spellbook filtering (1 = unfiltered, 0 = filtered)
|
* Spellbook filtering (1 = unfiltered, 0 = filtered)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ public interface WidgetNode extends Node
|
|||||||
* The ID of the widget.
|
* The ID of the widget.
|
||||||
*
|
*
|
||||||
* @return the ID of the widget
|
* @return the ID of the widget
|
||||||
* @see api.widgets.Widget
|
* @see net.runelite.api.widgets.Widget
|
||||||
*/
|
*/
|
||||||
int getId();
|
int getId();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ package net.runelite.api.events;
|
|||||||
import lombok.Value;
|
import lombok.Value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An event where a varbit integer has changed.
|
* An event where a client int var has changed.
|
||||||
*/
|
*/
|
||||||
@Value
|
@Value
|
||||||
public class VarClientIntChanged implements Event
|
public class VarClientIntChanged implements Event
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ package net.runelite.api.events;
|
|||||||
import lombok.Value;
|
import lombok.Value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An event where a varbit string has changed.
|
* An event where a client var string has changed.
|
||||||
*/
|
*/
|
||||||
@Value
|
@Value
|
||||||
public class VarClientStrChanged implements Event
|
public class VarClientStrChanged implements Event
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019, Lucas <https://github.com/Lucwousin>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR 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.vars;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Getter
|
||||||
|
public enum InterfaceTab
|
||||||
|
{
|
||||||
|
COMBAT(0),
|
||||||
|
STATS(1),
|
||||||
|
QUEST(2),
|
||||||
|
INVENTORY(3),
|
||||||
|
EQUIPMENT(4),
|
||||||
|
PRAYER(5),
|
||||||
|
SPELLBOOK(6),
|
||||||
|
CLAN(7),
|
||||||
|
ACCOUNT_MANAGMENT(8),
|
||||||
|
FRIENDS(9),
|
||||||
|
LOGOUT(10),
|
||||||
|
OPTIONS(11),
|
||||||
|
EMOTES(12),
|
||||||
|
MUSIC(13);
|
||||||
|
|
||||||
|
private final int id;
|
||||||
|
}
|
||||||
@@ -29,6 +29,7 @@ import java.util.Collection;
|
|||||||
|
|
||||||
import net.runelite.api.FontTypeFace;
|
import net.runelite.api.FontTypeFace;
|
||||||
import net.runelite.api.Point;
|
import net.runelite.api.Point;
|
||||||
|
import net.runelite.api.Sprite;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an on-screen UI element that is drawn on the canvas.
|
* Represents an on-screen UI element that is drawn on the canvas.
|
||||||
@@ -845,4 +846,14 @@ public interface Widget
|
|||||||
* Seems like this needs to set to true when creating new widgets
|
* Seems like this needs to set to true when creating new widgets
|
||||||
*/
|
*/
|
||||||
void setIsIf3(boolean isIf3);
|
void setIsIf3(boolean isIf3);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns yes if your mouse pointer is over this widget or any of it's children.
|
||||||
|
*/
|
||||||
|
boolean containsMouse();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the image which is (or should be) drawn on this widget
|
||||||
|
*/
|
||||||
|
Sprite getSprite();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -817,6 +817,7 @@ public class WidgetID
|
|||||||
|
|
||||||
static class SpellBook
|
static class SpellBook
|
||||||
{
|
{
|
||||||
|
static final int FILTERED_SPELLS_PARENT = 1;
|
||||||
static final int FILTERED_SPELLS_BOUNDS = 3;
|
static final int FILTERED_SPELLS_BOUNDS = 3;
|
||||||
|
|
||||||
// NORMAL SPELLS
|
// NORMAL SPELLS
|
||||||
@@ -968,6 +969,12 @@ public class WidgetID
|
|||||||
|
|
||||||
// ARCEUUS SPELLS
|
// ARCEUUS SPELLS
|
||||||
static final int ARCEUUS_HOME_TELEPORT = 143;
|
static final int ARCEUUS_HOME_TELEPORT = 143;
|
||||||
|
static final int BATTLEFRONT_TELEPORT = 178;
|
||||||
|
|
||||||
|
static final int FILTER_SECTION_PARENT = 181;
|
||||||
|
static final int FILTER_BUTTONS_PARENT = 184;
|
||||||
|
static final int FILTER_BUTTON_PARENT = 185;
|
||||||
|
static final int FILTER_BUTTON = 187;
|
||||||
}
|
}
|
||||||
|
|
||||||
static class Pvp
|
static class Pvp
|
||||||
|
|||||||
@@ -517,6 +517,8 @@ public enum WidgetInfo
|
|||||||
PVP_BOUNTY_HUNTER_INFO(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.BOUNTY_HUNTER_INFO),
|
PVP_BOUNTY_HUNTER_INFO(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.BOUNTY_HUNTER_INFO),
|
||||||
PVP_KILLDEATH_COUNTER(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.KILLDEATH_RATIO),
|
PVP_KILLDEATH_COUNTER(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.KILLDEATH_RATIO),
|
||||||
|
|
||||||
|
SPELLBOOK(WidgetID.SPELLBOOK_GROUP_ID, 0),
|
||||||
|
SPELLBOOK_FILTERED_SPELLS_PARENT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.FILTERED_SPELLS_PARENT),
|
||||||
SPELLBOOK_FILTERED_BOUNDS(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.FILTERED_SPELLS_BOUNDS),
|
SPELLBOOK_FILTERED_BOUNDS(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.FILTERED_SPELLS_BOUNDS),
|
||||||
|
|
||||||
/* STANDARD SPELL BOOK WIDGETS*/
|
/* STANDARD SPELL BOOK WIDGETS*/
|
||||||
@@ -671,7 +673,13 @@ public enum WidgetInfo
|
|||||||
SPELL_TOOLTIP(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.TOOLTIP),
|
SPELL_TOOLTIP(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.TOOLTIP),
|
||||||
/* ARCEUUS SPELL BOOK WIDGETS*/
|
/* ARCEUUS SPELL BOOK WIDGETS*/
|
||||||
SPELL_ARCEUUS_HOME_TELEPORT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.ARCEUUS_HOME_TELEPORT),
|
SPELL_ARCEUUS_HOME_TELEPORT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.ARCEUUS_HOME_TELEPORT),
|
||||||
|
SPELL_BATTLEFRONT_TELEPORT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.BATTLEFRONT_TELEPORT),
|
||||||
/* END OF ARCEUUS SPELL BOOK WIDGETS*/
|
/* END OF ARCEUUS SPELL BOOK WIDGETS*/
|
||||||
|
SPELLBOOK_FILTER_SECTION_PARENT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.FILTER_SECTION_PARENT),
|
||||||
|
SPELLBOOK_FILTER_BUTTONS_PARENT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.FILTER_BUTTONS_PARENT),
|
||||||
|
SPELLBOOK_FILTER_BUTTON_PARENT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.FILTER_BUTTON_PARENT),
|
||||||
|
SPELLBOOK_FILTER_BUTTON(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.FILTER_BUTTON),
|
||||||
|
|
||||||
|
|
||||||
KOUREND_FAVOUR_OVERLAY(WidgetID.KOUREND_FAVOUR_GROUP_ID, WidgetID.KourendFavour.KOUREND_FAVOUR_OVERLAY),
|
KOUREND_FAVOUR_OVERLAY(WidgetID.KOUREND_FAVOUR_GROUP_ID, WidgetID.KourendFavour.KOUREND_FAVOUR_OVERLAY),
|
||||||
ZEAH_MESS_HALL_COOKING_DISPLAY(WidgetID.ZEAH_MESS_HALL_GROUP_ID, WidgetID.Zeah.MESS_HALL_COOKING_DISPLAY),
|
ZEAH_MESS_HALL_COOKING_DISPLAY(WidgetID.ZEAH_MESS_HALL_GROUP_ID, WidgetID.Zeah.MESS_HALL_COOKING_DISPLAY),
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public final class WidgetMenuOption
|
|||||||
public WidgetMenuOption(String menuOption, String menuTarget, WidgetInfo widget)
|
public WidgetMenuOption(String menuOption, String menuTarget, WidgetInfo widget)
|
||||||
{
|
{
|
||||||
this.menuOption = menuOption;
|
this.menuOption = menuOption;
|
||||||
setMenuTarget(menuTarget);
|
this.menuTarget = menuTarget;
|
||||||
this.widget = widget;
|
this.widget = widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import net.runelite.api.Item;
|
|||||||
import net.runelite.api.ItemDefinition;
|
import net.runelite.api.ItemDefinition;
|
||||||
import net.runelite.api.ItemContainer;
|
import net.runelite.api.ItemContainer;
|
||||||
import net.runelite.api.VarClientInt;
|
import net.runelite.api.VarClientInt;
|
||||||
|
import net.runelite.api.vars.InterfaceTab;
|
||||||
import net.runelite.client.game.ItemManager;
|
import net.runelite.client.game.ItemManager;
|
||||||
import static net.runelite.client.plugins.lootingbagviewer.LootingBagViewerOverlay.PLACEHOLDER_WIDTH;
|
import static net.runelite.client.plugins.lootingbagviewer.LootingBagViewerOverlay.PLACEHOLDER_WIDTH;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
@@ -98,7 +99,7 @@ class InventoryViewerOverlay extends Overlay
|
|||||||
public Dimension render(Graphics2D graphics)
|
public Dimension render(Graphics2D graphics)
|
||||||
{
|
{
|
||||||
if (plugin.isHideWhenInvOpen()
|
if (plugin.isHideWhenInvOpen()
|
||||||
&& client.getVar(VarClientInt.PLAYER_INTERFACE_CONTAINER_OPENED) == 3)
|
&& client.getVar(VarClientInt.INTERFACE_TAB) == InterfaceTab.INVENTORY.getId())
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import net.runelite.api.VarClientInt;
|
|||||||
import net.runelite.api.events.GameStateChanged;
|
import net.runelite.api.events.GameStateChanged;
|
||||||
import net.runelite.api.events.VarClientIntChanged;
|
import net.runelite.api.events.VarClientIntChanged;
|
||||||
import net.runelite.api.events.WidgetLoaded;
|
import net.runelite.api.events.WidgetLoaded;
|
||||||
|
import net.runelite.api.vars.InterfaceTab;
|
||||||
import net.runelite.api.widgets.JavaScriptCallback;
|
import net.runelite.api.widgets.JavaScriptCallback;
|
||||||
import net.runelite.api.widgets.Widget;
|
import net.runelite.api.widgets.Widget;
|
||||||
import net.runelite.api.widgets.WidgetID;
|
import net.runelite.api.widgets.WidgetID;
|
||||||
@@ -182,7 +183,7 @@ public class MusicListPlugin extends Plugin
|
|||||||
|
|
||||||
private boolean isOnMusicTab()
|
private boolean isOnMusicTab()
|
||||||
{
|
{
|
||||||
return client.getVar(VarClientInt.INVENTORY_TAB) == 13;
|
return client.getVar(VarClientInt.INTERFACE_TAB) == InterfaceTab.MUSIC.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isChatboxOpen()
|
private boolean isChatboxOpen()
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ import net.runelite.api.events.GameStateChanged;
|
|||||||
import net.runelite.api.events.ScriptCallbackEvent;
|
import net.runelite.api.events.ScriptCallbackEvent;
|
||||||
import net.runelite.api.events.VarClientIntChanged;
|
import net.runelite.api.events.VarClientIntChanged;
|
||||||
import net.runelite.api.events.VarbitChanged;
|
import net.runelite.api.events.VarbitChanged;
|
||||||
|
import net.runelite.api.vars.InterfaceTab;
|
||||||
import net.runelite.api.widgets.JavaScriptCallback;
|
import net.runelite.api.widgets.JavaScriptCallback;
|
||||||
import net.runelite.api.widgets.Widget;
|
import net.runelite.api.widgets.Widget;
|
||||||
import net.runelite.api.widgets.WidgetInfo;
|
import net.runelite.api.widgets.WidgetInfo;
|
||||||
@@ -192,7 +193,7 @@ public class QuestListPlugin extends Plugin
|
|||||||
|
|
||||||
private void onVarClientIntChanged(VarClientIntChanged varClientIntChanged)
|
private void onVarClientIntChanged(VarClientIntChanged varClientIntChanged)
|
||||||
{
|
{
|
||||||
if (varClientIntChanged.getIndex() == VarClientInt.INVENTORY_TAB.getIndex() && isChatboxOpen() && isNotOnQuestTab())
|
if (varClientIntChanged.getIndex() == VarClientInt.INTERFACE_TAB.getIndex() && isChatboxOpen() && isNotOnQuestTab())
|
||||||
{
|
{
|
||||||
chatboxPanelManager.close();
|
chatboxPanelManager.close();
|
||||||
}
|
}
|
||||||
@@ -218,7 +219,7 @@ public class QuestListPlugin extends Plugin
|
|||||||
|
|
||||||
private boolean isNotOnQuestTab()
|
private boolean isNotOnQuestTab()
|
||||||
{
|
{
|
||||||
return client.getVar(Varbits.QUEST_TAB) != 0 || client.getVar(VarClientInt.INVENTORY_TAB) != 2;
|
return client.getVar(Varbits.QUEST_TAB) != 0 || client.getVar(VarClientInt.INTERFACE_TAB) != InterfaceTab.QUEST.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isChatboxOpen()
|
private boolean isChatboxOpen()
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public interface SpellbookConfig extends Config
|
|||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "size",
|
keyName = "size",
|
||||||
name = "Spell size",
|
name = "Spell size",
|
||||||
description = "Size (in px) of spells. Normal mobile size is 40px, use common sense for this setting please",
|
description = "Size (in px) of spells. Normal mobile size is 40px, use common sense for this setting",
|
||||||
position = 4
|
position = 4
|
||||||
)
|
)
|
||||||
default int size()
|
default int size()
|
||||||
@@ -78,7 +78,7 @@ public interface SpellbookConfig extends Config
|
|||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "filter",
|
keyName = "filter",
|
||||||
name = "Unfiltered spells",
|
name = "Unfiltered spells",
|
||||||
description = "Spells you don't want to filter, seperated with a comma. <br> \"'s can be used in front and behind spells (eg: '\"c' matches all spells starting with a c"
|
description = "Spells you don't want to filter, seperated by a comma. <br> \"'s can be used in front and behind spells (eg: '\"c' matches all spells starting with a c"
|
||||||
) // ^ JAJAJJAJAJAJAJA BRAZIL
|
) // ^ JAJAJJAJAJAJAJA BRAZIL
|
||||||
default String filter()
|
default String filter()
|
||||||
{
|
{
|
||||||
@@ -103,4 +103,51 @@ public interface SpellbookConfig extends Config
|
|||||||
hidden = true
|
hidden = true
|
||||||
)
|
)
|
||||||
void canDrag(boolean canDrag);
|
void canDrag(boolean canDrag);
|
||||||
|
|
||||||
|
// Next 4 methods have to be here, or the reset configuration
|
||||||
|
// button won't reset em like it should.
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "standard",
|
||||||
|
name = "",
|
||||||
|
description = "",
|
||||||
|
hidden = true
|
||||||
|
)
|
||||||
|
default String standard()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "ancient",
|
||||||
|
name = "",
|
||||||
|
description = "",
|
||||||
|
hidden = true
|
||||||
|
)
|
||||||
|
default String ancient()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "lunar",
|
||||||
|
name = "",
|
||||||
|
description = "",
|
||||||
|
hidden = true
|
||||||
|
)
|
||||||
|
default String lunar()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "arceuus",
|
||||||
|
name = "",
|
||||||
|
description = "",
|
||||||
|
hidden = true
|
||||||
|
)
|
||||||
|
default String arceuus()
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,12 +27,10 @@ package net.runelite.client.plugins.spellbook;
|
|||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
import java.awt.Rectangle;
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.client.game.SpriteManager;
|
import net.runelite.api.Sprite;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
@@ -43,21 +41,19 @@ public class SpellbookDragOverlay extends Overlay
|
|||||||
{
|
{
|
||||||
private final SpellbookPlugin plugin;
|
private final SpellbookPlugin plugin;
|
||||||
private final Client client;
|
private final Client client;
|
||||||
private final SpriteManager spriteManager;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private SpellbookDragOverlay(final SpellbookPlugin plugin, final Client client, final SpriteManager spriteManager)
|
private SpellbookDragOverlay(final SpellbookPlugin plugin, final Client client)
|
||||||
{
|
{
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.spriteManager = spriteManager;
|
|
||||||
setPosition(OverlayPosition.TOOLTIP);
|
setPosition(OverlayPosition.TOOLTIP);
|
||||||
setPriority(OverlayPriority.HIGHEST);
|
setPriority(OverlayPriority.HIGH);
|
||||||
setLayer(OverlayLayer.ALWAYS_ON_TOP);
|
setLayer(OverlayLayer.ALWAYS_ON_TOP);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dimension render(Graphics2D g)
|
public Dimension render(final Graphics2D g)
|
||||||
{
|
{
|
||||||
if (!plugin.isDragging())
|
if (!plugin.isDragging())
|
||||||
{
|
{
|
||||||
@@ -66,16 +62,14 @@ public class SpellbookDragOverlay extends Overlay
|
|||||||
|
|
||||||
final net.runelite.api.Point mouseCanvasPosition = client.getMouseCanvasPosition();
|
final net.runelite.api.Point mouseCanvasPosition = client.getMouseCanvasPosition();
|
||||||
final net.runelite.api.Point draggingLocation = plugin.getDraggingLocation();
|
final net.runelite.api.Point draggingLocation = plugin.getDraggingLocation();
|
||||||
|
final Sprite sprite = plugin.getDraggingWidget().getSprite();
|
||||||
|
final Point drawPos = new Point(mouseCanvasPosition.getX() - draggingLocation.getX(), mouseCanvasPosition.getY() - draggingLocation.getY());
|
||||||
|
|
||||||
final int size = plugin.getDraggingWidget().getWidth();
|
if (sprite != null)
|
||||||
final int sprite = plugin.getDraggingWidget().getSpriteId();
|
{
|
||||||
final BufferedImage image = spriteManager.getSprite(sprite, 0);
|
sprite.drawAt(drawPos.x, drawPos.y);
|
||||||
|
}
|
||||||
|
|
||||||
final Point mousePosition = new Point(mouseCanvasPosition.getX() - draggingLocation.getX(), mouseCanvasPosition.getY() - draggingLocation.getY());
|
return null;
|
||||||
final Rectangle bounds = new Rectangle(mousePosition.x, mousePosition.y, size, size);
|
|
||||||
|
|
||||||
g.drawImage(image, mousePosition.x, mousePosition.y, size, size, null);
|
|
||||||
|
|
||||||
return bounds.getSize();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,16 +42,16 @@ class SpellbookMouseListener extends MouseAdapter implements MouseWheelListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MouseEvent mouseClicked(MouseEvent event)
|
public MouseEvent mouseClicked(final MouseEvent event)
|
||||||
{
|
{
|
||||||
if (plugin.isNotOnSpellWidget(event.getPoint()))
|
if (plugin.isNotOnSpellWidget())
|
||||||
{
|
{
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SwingUtilities.isMiddleMouseButton(event))
|
if (SwingUtilities.isMiddleMouseButton(event))
|
||||||
{
|
{
|
||||||
plugin.resetZoom(event.getPoint());
|
plugin.resetSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
event.consume();
|
event.consume();
|
||||||
@@ -59,21 +59,24 @@ class SpellbookMouseListener extends MouseAdapter implements MouseWheelListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MouseEvent mousePressed(MouseEvent event)
|
public MouseEvent mousePressed(final MouseEvent event)
|
||||||
{
|
{
|
||||||
if (!SwingUtilities.isLeftMouseButton(event) || plugin.isNotOnSpellWidget(event.getPoint()) || plugin.isDragging())
|
if (SwingUtilities.isRightMouseButton(event))
|
||||||
{
|
{
|
||||||
|
plugin.resetLocation();
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
else if (SwingUtilities.isLeftMouseButton(event) && !plugin.isNotOnSpellWidget() && !plugin.isDragging())
|
||||||
|
{
|
||||||
|
plugin.startDragging(event.getPoint());
|
||||||
|
event.consume();
|
||||||
|
}
|
||||||
|
|
||||||
plugin.startDragging(event.getPoint());
|
|
||||||
|
|
||||||
event.consume();
|
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MouseEvent mouseReleased(MouseEvent event)
|
public MouseEvent mouseReleased(final MouseEvent event)
|
||||||
{
|
{
|
||||||
if (!SwingUtilities.isLeftMouseButton(event) || !plugin.isDragging())
|
if (!SwingUtilities.isLeftMouseButton(event) || !plugin.isDragging())
|
||||||
{
|
{
|
||||||
@@ -87,22 +90,22 @@ class SpellbookMouseListener extends MouseAdapter implements MouseWheelListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MouseWheelEvent mouseWheelMoved(MouseWheelEvent event)
|
public MouseWheelEvent mouseWheelMoved(final MouseWheelEvent event)
|
||||||
{
|
{
|
||||||
if (plugin.isNotOnSpellWidget(event.getPoint()))
|
if (plugin.isNotOnSpellWidget())
|
||||||
{
|
{
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
int direction = event.getWheelRotation();
|
final int direction = event.getWheelRotation();
|
||||||
|
|
||||||
if (direction > 0)
|
if (direction > 0)
|
||||||
{
|
{
|
||||||
plugin.increaseSize(event.getPoint());
|
plugin.increaseSize();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
plugin.decreaseSize(event.getPoint());
|
plugin.decreaseSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
event.consume();
|
event.consume();
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ import java.util.Collection;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
@@ -42,15 +41,18 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.GameState;
|
import net.runelite.api.GameState;
|
||||||
import net.runelite.api.Point;
|
import net.runelite.api.Point;
|
||||||
|
import static net.runelite.api.ScriptID.MAGIC_SPELLBOOK_REDRAW;
|
||||||
import net.runelite.api.VarClientInt;
|
import net.runelite.api.VarClientInt;
|
||||||
import net.runelite.api.Varbits;
|
import net.runelite.api.Varbits;
|
||||||
import net.runelite.api.events.ConfigChanged;
|
import net.runelite.api.events.ConfigChanged;
|
||||||
import net.runelite.api.events.GameStateChanged;
|
import net.runelite.api.events.GameStateChanged;
|
||||||
import net.runelite.api.events.ScriptCallbackEvent;
|
import net.runelite.api.events.ScriptCallbackEvent;
|
||||||
import net.runelite.api.events.VarbitChanged;
|
import net.runelite.api.events.VarClientIntChanged;
|
||||||
import net.runelite.api.events.WidgetMenuOptionClicked;
|
import net.runelite.api.events.WidgetMenuOptionClicked;
|
||||||
|
import net.runelite.api.vars.InterfaceTab;
|
||||||
import net.runelite.api.widgets.Widget;
|
import net.runelite.api.widgets.Widget;
|
||||||
import net.runelite.api.widgets.WidgetInfo;
|
import net.runelite.api.widgets.WidgetInfo;
|
||||||
|
import static net.runelite.api.widgets.WidgetInfo.*;
|
||||||
import net.runelite.client.callback.ClientThread;
|
import net.runelite.client.callback.ClientThread;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.eventbus.EventBus;
|
import net.runelite.client.eventbus.EventBus;
|
||||||
@@ -63,6 +65,7 @@ import net.runelite.client.plugins.PluginType;
|
|||||||
import net.runelite.client.ui.overlay.OverlayManager;
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
import static net.runelite.client.util.MiscUtils.clamp;
|
import static net.runelite.client.util.MiscUtils.clamp;
|
||||||
import net.runelite.client.util.Text;
|
import net.runelite.client.util.Text;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Spellbook",
|
name = "Spellbook",
|
||||||
@@ -88,6 +91,8 @@ public class SpellbookPlugin extends Plugin
|
|||||||
private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_MAGIC_TAB_LOCK = new WidgetMenuOption(LOCK, MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_MAGIC_TAB);
|
private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_MAGIC_TAB_LOCK = new WidgetMenuOption(LOCK, MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_MAGIC_TAB);
|
||||||
private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_MAGIC_TAB_UNLOCK = new WidgetMenuOption(UNLOCK, MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_MAGIC_TAB);
|
private static final WidgetMenuOption RESIZABLE_BOTTOM_LINE_MAGIC_TAB_UNLOCK = new WidgetMenuOption(UNLOCK, MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_MAGIC_TAB);
|
||||||
private final Map<Integer, Spell> spells = new HashMap<>();
|
private final Map<Integer, Spell> spells = new HashMap<>();
|
||||||
|
private final SpellbookMouseListener mouseListener = new SpellbookMouseListener(this);
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private Client client;
|
private Client client;
|
||||||
|
|
||||||
@@ -123,78 +128,14 @@ public class SpellbookPlugin extends Plugin
|
|||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private Point draggingLocation;
|
private Point draggingLocation;
|
||||||
private Map<Integer, Spell> tmp = null;
|
|
||||||
private ImmutableSet<String> notFilteredSpells;
|
private ImmutableSet<String> notFilteredSpells;
|
||||||
private Spellbook spellbook;
|
private Spellbook spellbook;
|
||||||
private SpellbookMouseListener mouseListener;
|
private boolean mageTabOpen;
|
||||||
private boolean enableMobile;
|
private boolean enableMobile;
|
||||||
private boolean dragSpells;
|
private boolean dragSpells;
|
||||||
private boolean scroll;
|
private boolean scroll;
|
||||||
private int size;
|
private int size;
|
||||||
private String filter;
|
|
||||||
|
|
||||||
private static boolean isUnfiltered(String spell, Set<String> unfiltereds)
|
|
||||||
{
|
|
||||||
for (String str : unfiltereds)
|
|
||||||
{
|
|
||||||
WordFilterMode mode = getFilterMode(str);
|
|
||||||
str = removeFlyingComma(str).toLowerCase();
|
|
||||||
spell = spell.toLowerCase();
|
|
||||||
|
|
||||||
switch (mode)
|
|
||||||
{
|
|
||||||
case CONTAINS:
|
|
||||||
if (spell.contains(str))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case STARTSWITH:
|
|
||||||
if (spell.startsWith(str))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ENDSWITH:
|
|
||||||
if (spell.endsWith(str))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case EQUALS:
|
|
||||||
if (spell.equals(str))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static WordFilterMode getFilterMode(String s)
|
|
||||||
{
|
|
||||||
if (!s.contains("\""))
|
|
||||||
{
|
|
||||||
return WordFilterMode.CONTAINS;
|
|
||||||
}
|
|
||||||
if (s.startsWith("\""))
|
|
||||||
{
|
|
||||||
return s.endsWith("\"") ? WordFilterMode.EQUALS : WordFilterMode.STARTSWITH;
|
|
||||||
}
|
|
||||||
else if (s.endsWith("\""))
|
|
||||||
{
|
|
||||||
return WordFilterMode.ENDSWITH;
|
|
||||||
}
|
|
||||||
|
|
||||||
return WordFilterMode.CONTAINS; // but probably null soz
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String removeFlyingComma(String s)
|
|
||||||
{
|
|
||||||
return s.replaceAll("\"", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
SpellbookConfig getConfig(ConfigManager configManager)
|
SpellbookConfig getConfig(ConfigManager configManager)
|
||||||
@@ -205,12 +146,9 @@ public class SpellbookPlugin extends Plugin
|
|||||||
@Override
|
@Override
|
||||||
protected void startUp()
|
protected void startUp()
|
||||||
{
|
{
|
||||||
updateConfig();
|
|
||||||
addSubscriptions();
|
addSubscriptions();
|
||||||
|
updateConfig();
|
||||||
refreshMagicTabOption();
|
refreshMagicTabOption();
|
||||||
loadFilter();
|
|
||||||
mouseListener = new SpellbookMouseListener(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -222,60 +160,105 @@ public class SpellbookPlugin extends Plugin
|
|||||||
config.canDrag(false);
|
config.canDrag(false);
|
||||||
mouseManager.unregisterMouseListener(mouseListener);
|
mouseManager.unregisterMouseListener(mouseListener);
|
||||||
mouseManager.unregisterMouseWheelListener(mouseListener);
|
mouseManager.unregisterMouseWheelListener(mouseListener);
|
||||||
mouseListener = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addSubscriptions()
|
private void addSubscriptions()
|
||||||
{
|
{
|
||||||
|
eventBus.subscribe(VarClientIntChanged.class, this, this::onVarCIntChanged);
|
||||||
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
|
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
|
||||||
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
|
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
|
||||||
eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged);
|
|
||||||
eventBus.subscribe(WidgetMenuOptionClicked.class, this, this::onWidgetMenuOptionClicked);
|
eventBus.subscribe(WidgetMenuOptionClicked.class, this, this::onWidgetMenuOptionClicked);
|
||||||
eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent);
|
eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onGameStateChanged(GameStateChanged event)
|
private void updateConfig()
|
||||||
{
|
{
|
||||||
if (event.getGameState() == GameState.LOGGED_IN)
|
loadFilter();
|
||||||
{
|
this.enableMobile = config.enableMobile();
|
||||||
refreshMagicTabOption();
|
this.dragSpells = config.dragSpells();
|
||||||
}
|
this.scroll = config.scroll();
|
||||||
|
this.size = config.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onConfigChanged(ConfigChanged event)
|
private void onConfigChanged(final ConfigChanged event)
|
||||||
{
|
{
|
||||||
if (!"spellbook".equals(event.getGroup()))
|
if (!"spellbook".equals(event.getGroup()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
updateConfig();
|
switch (event.getKey())
|
||||||
|
|
||||||
String key = event.getKey();
|
|
||||||
|
|
||||||
if ("filter".equals(key))
|
|
||||||
{
|
{
|
||||||
loadFilter();
|
case "filter":
|
||||||
|
loadFilter();
|
||||||
|
break;
|
||||||
|
case "enableMobile":
|
||||||
|
enableMobile = config.enableMobile();
|
||||||
|
break;
|
||||||
|
case "dragSpells":
|
||||||
|
dragSpells = config.dragSpells();
|
||||||
|
break;
|
||||||
|
case "scroll":
|
||||||
|
scroll = config.scroll();
|
||||||
|
break;
|
||||||
|
case "size":
|
||||||
|
size = config.size();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
clientThread.invokeLater(this::runRebuild);
|
runRebuild();
|
||||||
refreshMagicTabOption();
|
refreshMagicTabOption();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onVarbitChanged(VarbitChanged event)
|
private void loadFilter()
|
||||||
{
|
{
|
||||||
if (client.getGameState() != GameState.LOGGED_IN)
|
notFilteredSpells = ImmutableSet.copyOf(Text.fromCSV(config.filter().toLowerCase()));
|
||||||
|
saveSpells();
|
||||||
|
loadSpells();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onGameStateChanged(final GameStateChanged event)
|
||||||
|
{
|
||||||
|
if (event.getGameState() == GameState.LOGGED_IN)
|
||||||
|
{
|
||||||
|
mageTabOpen = client.getVar(VarClientInt.INTERFACE_TAB) == InterfaceTab.SPELLBOOK.getId();
|
||||||
|
refreshMagicTabOption();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onVarCIntChanged(final VarClientIntChanged event)
|
||||||
|
{
|
||||||
|
if (event.getIndex() != VarClientInt.INTERFACE_TAB.getIndex())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.canDrag())
|
final boolean intfTab = client.getVar(VarClientInt.INTERFACE_TAB) == InterfaceTab.SPELLBOOK.getId();
|
||||||
|
if (intfTab != mageTabOpen)
|
||||||
{
|
{
|
||||||
config.canDrag(client.getVar(Varbits.FILTER_SPELLBOOK) == 1 && client.getVar(VarClientInt.INVENTORY_TAB) == 6);
|
mageTabOpen = intfTab;
|
||||||
|
refreshMagicTabOption();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!config.canDrag() || client.getGameState() != GameState.LOGGED_IN)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final boolean shouldBeAbleToDrag = mageTabOpen && client.getVar(Varbits.FILTER_SPELLBOOK) == 0;
|
||||||
|
if (shouldBeAbleToDrag)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mouseManager.unregisterMouseListener(mouseListener);
|
||||||
|
mouseManager.unregisterMouseWheelListener(mouseListener);
|
||||||
|
config.canDrag(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event)
|
private void onWidgetMenuOptionClicked(final WidgetMenuOptionClicked event)
|
||||||
{
|
{
|
||||||
if (event.getWidget() != WidgetInfo.FIXED_VIEWPORT_MAGIC_TAB
|
if (event.getWidget() != WidgetInfo.FIXED_VIEWPORT_MAGIC_TAB
|
||||||
&& event.getWidget() != WidgetInfo.RESIZABLE_VIEWPORT_MAGIC_TAB
|
&& event.getWidget() != WidgetInfo.RESIZABLE_VIEWPORT_MAGIC_TAB
|
||||||
@@ -284,12 +267,16 @@ public class SpellbookPlugin extends Plugin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
saveSpells();
|
||||||
|
loadSpells();
|
||||||
|
|
||||||
if (event.getMenuOption().equals(UNLOCK))
|
if (event.getMenuOption().equals(UNLOCK))
|
||||||
{
|
{
|
||||||
config.canDrag(true);
|
config.canDrag(true);
|
||||||
|
|
||||||
overlayManager.add(overlay);
|
overlayManager.add(overlay);
|
||||||
|
|
||||||
mouseManager.registerMouseListener(mouseListener);
|
mouseManager.registerMouseListener(mouseListener);
|
||||||
tmp = new HashMap<>();
|
|
||||||
|
|
||||||
if (this.scroll)
|
if (this.scroll)
|
||||||
{
|
{
|
||||||
@@ -299,12 +286,14 @@ public class SpellbookPlugin extends Plugin
|
|||||||
else if (event.getMenuOption().equals(LOCK))
|
else if (event.getMenuOption().equals(LOCK))
|
||||||
{
|
{
|
||||||
config.canDrag(false);
|
config.canDrag(false);
|
||||||
|
|
||||||
overlayManager.remove(overlay);
|
overlayManager.remove(overlay);
|
||||||
|
|
||||||
mouseManager.unregisterMouseListener(mouseListener);
|
mouseManager.unregisterMouseListener(mouseListener);
|
||||||
mouseManager.unregisterMouseWheelListener(mouseListener);
|
mouseManager.unregisterMouseWheelListener(mouseListener);
|
||||||
saveSpells();
|
|
||||||
tmp = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
refreshMagicTabOption();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearMagicTabMenus()
|
private void clearMagicTabMenus()
|
||||||
@@ -320,7 +309,8 @@ public class SpellbookPlugin extends Plugin
|
|||||||
private void refreshMagicTabOption()
|
private void refreshMagicTabOption()
|
||||||
{
|
{
|
||||||
clearMagicTabMenus();
|
clearMagicTabMenus();
|
||||||
if (client.getGameState() != GameState.LOGGED_IN || !this.dragSpells)
|
|
||||||
|
if (!this.dragSpells || !mageTabOpen)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -339,7 +329,7 @@ public class SpellbookPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onScriptCallbackEvent(ScriptCallbackEvent event)
|
private void onScriptCallbackEvent(final ScriptCallbackEvent event)
|
||||||
{
|
{
|
||||||
if (client.getVar(Varbits.FILTER_SPELLBOOK) != 0
|
if (client.getVar(Varbits.FILTER_SPELLBOOK) != 0
|
||||||
|| !this.enableMobile
|
|| !this.enableMobile
|
||||||
@@ -348,129 +338,135 @@ public class SpellbookPlugin extends Plugin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int[] iStack = client.getIntStack();
|
final int[] iStack = client.getIntStack();
|
||||||
int iStackSize = client.getIntStackSize();
|
final int iStackSize = client.getIntStackSize();
|
||||||
|
|
||||||
String[] sStack = client.getStringStack();
|
final String[] sStack = client.getStringStack();
|
||||||
int sStackSize = client.getStringStackSize();
|
final int sStackSize = client.getStringStackSize();
|
||||||
|
|
||||||
if ("startSpellRedraw".equals(event.getEventName()))
|
switch (event.getEventName())
|
||||||
{
|
{
|
||||||
if (config.canDrag())
|
case "startSpellRedraw":
|
||||||
{
|
final Spellbook pook = Spellbook.getByID(client.getVar(Varbits.SPELLBOOK));
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
spellbook = Spellbook.getByID(client.getVar(Varbits.SPELLBOOK));
|
if (pook != spellbook)
|
||||||
loadSpells();
|
|
||||||
}
|
|
||||||
else if ("shouldFilterSpell".equals(event.getEventName()))
|
|
||||||
{
|
|
||||||
String spell = sStack[sStackSize - 1].toLowerCase();
|
|
||||||
int widget = iStack[iStackSize - 1];
|
|
||||||
|
|
||||||
// Add the spell to spells
|
|
||||||
if (!spells.containsKey(widget))
|
|
||||||
{
|
|
||||||
Spell s = new Spell();
|
|
||||||
s.setWidget(widget);
|
|
||||||
s.setX(-1);
|
|
||||||
s.setY(-1);
|
|
||||||
s.setSize(0);
|
|
||||||
s.setName(spell);
|
|
||||||
|
|
||||||
spells.put(widget, s);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (notFilteredSpells.isEmpty())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImmutableSet<String> tmp = ImmutableSet.copyOf(notFilteredSpells);
|
|
||||||
|
|
||||||
iStack[iStackSize - 2] = isUnfiltered(spell, tmp) ? 1 : 0;
|
|
||||||
}
|
|
||||||
else if ("isMobileSpellbookEnabled".equals(event.getEventName()))
|
|
||||||
{
|
|
||||||
iStack[iStackSize - 1] = 1;
|
|
||||||
}
|
|
||||||
else if ("resizeSpell".equals(event.getEventName()))
|
|
||||||
{
|
|
||||||
int size = this.size;
|
|
||||||
int columns = clamp(FULL_WIDTH / size, 2, 3);
|
|
||||||
|
|
||||||
iStack[iStackSize - 2] = size;
|
|
||||||
iStack[iStackSize - 1] = columns;
|
|
||||||
}
|
|
||||||
else if ("setSpellAreaSize".equals(event.getEventName()))
|
|
||||||
{
|
|
||||||
if (!this.dragSpells)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
iStack[iStackSize - 2] = FULL_WIDTH;
|
|
||||||
iStack[iStackSize - 1] = FULL_HEIGHT;
|
|
||||||
}
|
|
||||||
else if ("resizeIndividualSpells".equals(event.getEventName()))
|
|
||||||
{
|
|
||||||
int widget = iStack[iStackSize - 1];
|
|
||||||
|
|
||||||
int visibleCount = 0;
|
|
||||||
for (Spell spell1 : spells.values())
|
|
||||||
{
|
|
||||||
String s = spell1.getName();
|
|
||||||
if (isUnfiltered(s, notFilteredSpells))
|
|
||||||
{
|
{
|
||||||
visibleCount++;
|
saveSpells();
|
||||||
|
spellbook = pook;
|
||||||
|
loadSpells();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (visibleCount > 20 || visibleCount == 0)
|
break;
|
||||||
|
case "shouldFilterSpell":
|
||||||
{
|
{
|
||||||
return;
|
final String spell = sStack[sStackSize - 1].toLowerCase();
|
||||||
|
final int widget = iStack[iStackSize - 1];
|
||||||
|
|
||||||
|
if (!spells.containsKey(widget))
|
||||||
|
{
|
||||||
|
final Spell s = new Spell();
|
||||||
|
s.setWidget(widget);
|
||||||
|
s.setX(-1);
|
||||||
|
s.setY(-1);
|
||||||
|
s.setSize(0);
|
||||||
|
s.setName(spell);
|
||||||
|
|
||||||
|
spells.put(widget, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (notFilteredSpells.isEmpty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
iStack[iStackSize - 2] = isUnfiltered(spell, notFilteredSpells) ? 1 : 0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
case "isMobileSpellbookEnabled":
|
||||||
|
iStack[iStackSize - 1] = 1;
|
||||||
|
break;
|
||||||
|
case "resizeSpell":
|
||||||
|
final int size = this.size;
|
||||||
|
final int columns = clamp(FULL_WIDTH / size, 2, 3);
|
||||||
|
|
||||||
Spell spell = spells.get(widget);
|
iStack[iStackSize - 2] = size;
|
||||||
|
iStack[iStackSize - 1] = columns;
|
||||||
|
break;
|
||||||
|
case "setSpellAreaSize":
|
||||||
|
if (!this.dragSpells)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int newSize = clamp(trueSize(spell), 0, FULL_WIDTH);
|
iStack[iStackSize - 2] = FULL_WIDTH;
|
||||||
|
iStack[iStackSize - 1] = FULL_HEIGHT;
|
||||||
iStack[iStackSize - 3] = newSize;
|
break;
|
||||||
iStack[iStackSize - 2] = newSize;
|
case "resizeIndividualSpells":
|
||||||
}
|
|
||||||
else if ("setSpellPosition".equals(event.getEventName()))
|
|
||||||
{
|
|
||||||
if (!this.dragSpells)
|
|
||||||
{
|
{
|
||||||
return;
|
final int widget = iStack[iStackSize - 1];
|
||||||
|
|
||||||
|
int visibleCount = 0;
|
||||||
|
for (Spell spell : spells.values())
|
||||||
|
{
|
||||||
|
final String s = spell.getName();
|
||||||
|
if (isUnfiltered(s, notFilteredSpells))
|
||||||
|
{
|
||||||
|
visibleCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (visibleCount > 20 || visibleCount == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final Spell spell = spells.get(widget);
|
||||||
|
final int newSize = clamp(trueSize(spell), 0, FULL_WIDTH);
|
||||||
|
|
||||||
|
iStack[iStackSize - 3] = newSize;
|
||||||
|
iStack[iStackSize - 2] = newSize;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
case "setSpellPosition":
|
||||||
int widget = iStack[iStackSize - 1];
|
|
||||||
Spell s = spells.get(widget);
|
|
||||||
int x = s.getX();
|
|
||||||
int y = s.getY();
|
|
||||||
|
|
||||||
if (x == -1 || y == -1)
|
|
||||||
{
|
{
|
||||||
return;
|
if (!this.dragSpells)
|
||||||
}
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
iStack[iStackSize - 5] = x;
|
final int widget = iStack[iStackSize - 1];
|
||||||
iStack[iStackSize - 4] = y;
|
final Spell s = spells.get(widget);
|
||||||
|
final int x = s.getX();
|
||||||
|
final int y = s.getY();
|
||||||
|
|
||||||
|
if (x == -1 || y == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
iStack[iStackSize - 5] = x;
|
||||||
|
iStack[iStackSize - 4] = y;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadSpells()
|
private void loadSpells()
|
||||||
{
|
{
|
||||||
if (client.getGameState() != GameState.LOGGED_IN || spellbook == null)
|
spells.clear();
|
||||||
|
|
||||||
|
if (client.getGameState() != GameState.LOGGED_IN)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
spells.clear();
|
if (spellbook == null)
|
||||||
|
{
|
||||||
|
log.debug("Spellbook is null?");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String cfg = configManager.getConfiguration("spellbook", spellbook.getConfigKey());
|
final String cfg = configManager.getConfiguration("spellbook", spellbook.getConfigKey());
|
||||||
|
|
||||||
if (Strings.isNullOrEmpty(cfg))
|
if (Strings.isNullOrEmpty(cfg))
|
||||||
{
|
{
|
||||||
@@ -478,151 +474,147 @@ public class SpellbookPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CHECKSTYLE:OFF
|
// CHECKSTYLE:OFF
|
||||||
Collection<Spell> gson = GSON.fromJson(cfg, new TypeToken<List<Spell>>()
|
final Collection<Spell> gson = GSON.fromJson(cfg, new TypeToken<List<Spell>>()
|
||||||
{
|
{
|
||||||
}.getType());
|
}
|
||||||
|
.getType());
|
||||||
// CHECKSTYLE:ON
|
// CHECKSTYLE:ON
|
||||||
gson.stream().filter(Objects::nonNull).forEach(s -> spells.put(s.getWidget(), s));
|
|
||||||
|
|
||||||
if (tmp != null)
|
for (final Spell s : gson)
|
||||||
{
|
{
|
||||||
for (Map.Entry<Integer, Spell> entry : tmp.entrySet())
|
spells.put(s.getWidget(), s);
|
||||||
{
|
|
||||||
spells.replace(entry.getKey(), entry.getValue());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveSpells()
|
private void saveSpells()
|
||||||
{
|
{
|
||||||
if (spells.isEmpty() || tmp == null || tmp.isEmpty())
|
if (spells.isEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Map.Entry<Integer, Spell> entry : tmp.entrySet())
|
configManager.setConfiguration("spellbook", spellbook.getConfigKey(), GSON.toJson(spells.values()));
|
||||||
{
|
|
||||||
spells.replace(entry.getKey(), entry.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
String key = spellbook.getConfigKey();
|
|
||||||
|
|
||||||
configManager.setConfiguration("spellbook", key, GSON.toJson(spells.values()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void runRebuild()
|
private void runRebuild()
|
||||||
{
|
{
|
||||||
if (client.getGameState() != GameState.LOGGED_IN)
|
if (client.getGameState() != GameState.LOGGED_IN || !mageTabOpen)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Runs magic_spellbook_rebuild
|
// Runs magic_spellbook_rebuild
|
||||||
|
// The magic numbers probably are mobile specific widgetids
|
||||||
|
// runeliteplus mobile when?
|
||||||
clientThread.invoke(() ->
|
clientThread.invoke(() ->
|
||||||
client.runScript(2611, 14286851, 14287027, 14287036, 14286849, 14287033, 14287034, 14287035, 14286850, 14287029, 14287032, "Info", "Filters", false)
|
client.runScript(
|
||||||
|
MAGIC_SPELLBOOK_REDRAW,
|
||||||
|
SPELLBOOK_FILTERED_BOUNDS.getId(),
|
||||||
|
0x00da00b3,
|
||||||
|
SPELL_TOOLTIP.getId(),
|
||||||
|
SPELLBOOK_FILTERED_SPELLS_PARENT.getId(),
|
||||||
|
SPELLBOOK_FILTER_BUTTON_PARENT.getId(),
|
||||||
|
0x00da00ba,
|
||||||
|
SPELLBOOK_FILTER_BUTTON.getId(),
|
||||||
|
0x00da0002,
|
||||||
|
SPELLBOOK_FILTER_SECTION_PARENT.getId(),
|
||||||
|
SPELLBOOK_FILTER_BUTTONS_PARENT.getId(),
|
||||||
|
"Info",
|
||||||
|
"Filters",
|
||||||
|
false
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isNotOnSpellWidget(java.awt.Point point)
|
boolean isNotOnSpellWidget()
|
||||||
{
|
{
|
||||||
Widget boundsWidget = client.getWidget(WidgetInfo.SPELLBOOK_FILTERED_BOUNDS);
|
if (client.isMenuOpen() || !mageTabOpen)
|
||||||
if (client.getVar(VarClientInt.INVENTORY_TAB) != 6
|
|
||||||
|| client.isMenuOpen()
|
|
||||||
|| boundsWidget == null
|
|
||||||
|| !boundsWidget.getBounds().contains(point))
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return currentWidget(point) == null;
|
return currentWidget() == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadFilter()
|
private Widget currentWidget()
|
||||||
{
|
{
|
||||||
notFilteredSpells = ImmutableSet.copyOf(Text.fromCSV(this.filter.toLowerCase()));
|
final Widget parent = client.getWidget(SPELLBOOK_FILTERED_BOUNDS);
|
||||||
|
if (parent == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (final Widget w : parent.getStaticChildren())
|
||||||
|
{
|
||||||
|
if (w.containsMouse())
|
||||||
|
{
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void startDragging(java.awt.Point point)
|
void startDragging(final java.awt.Point point)
|
||||||
{
|
{
|
||||||
draggingWidget = currentWidget(point);
|
draggingWidget = currentWidget();
|
||||||
|
|
||||||
if (draggingWidget == null)
|
if (draggingWidget == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Point widgetPos = draggingWidget.getCanvasLocation();
|
final Point widgetPos = draggingWidget.getCanvasLocation();
|
||||||
|
|
||||||
int x = point.x - widgetPos.getX();
|
final int x = point.x - widgetPos.getX();
|
||||||
int y = point.y - widgetPos.getY();
|
final int y = point.y - widgetPos.getY();
|
||||||
|
|
||||||
draggingLocation = new Point(x, y);
|
draggingLocation = new Point(x, y);
|
||||||
draggingWidget.setHidden(true);
|
draggingWidget.setHidden(true);
|
||||||
dragging = true;
|
dragging = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void completeDragging(java.awt.Point point)
|
void completeDragging(final java.awt.Point point)
|
||||||
{
|
{
|
||||||
Point parentPos = client.getWidget(WidgetInfo.SPELLBOOK_FILTERED_BOUNDS).getCanvasLocation();
|
final Point parentPos = client.getWidget(SPELLBOOK_FILTERED_BOUNDS).getCanvasLocation();
|
||||||
|
|
||||||
int x = point.x - draggingLocation.getX() - parentPos.getX();
|
int x = point.x - draggingLocation.getX() - parentPos.getX();
|
||||||
int y = point.y - draggingLocation.getY() - parentPos.getY();
|
int y = point.y - draggingLocation.getY() - parentPos.getY();
|
||||||
int size = draggingWidget.getWidth();
|
final int size = draggingWidget.getWidth();
|
||||||
|
|
||||||
x = clamp(x, 0, FULL_WIDTH - size);
|
x = clamp(x, 0, FULL_WIDTH - size);
|
||||||
y = clamp(y, 0, FULL_HEIGHT - size);
|
y = clamp(y, 0, FULL_HEIGHT - size);
|
||||||
|
|
||||||
int draggedID = draggingWidget.getId();
|
final int draggedID = draggingWidget.getId();
|
||||||
Spell n = spells.get(draggedID);
|
final Spell n = spells.get(draggedID);
|
||||||
|
|
||||||
n.setX(x);
|
n.setX(x);
|
||||||
n.setY(y);
|
n.setY(y);
|
||||||
|
|
||||||
tmp.put(draggedID, n);
|
|
||||||
|
|
||||||
draggingWidget.setHidden(false);
|
draggingWidget.setHidden(false);
|
||||||
dragging = false;
|
dragging = false;
|
||||||
|
|
||||||
runRebuild();
|
runRebuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Widget currentWidget(java.awt.Point point)
|
void increaseSize()
|
||||||
{
|
{
|
||||||
ImmutableSet<String> tmp = ImmutableSet.copyOf(notFilteredSpells);
|
final Widget scrolledWidget = currentWidget();
|
||||||
|
|
||||||
for (Map.Entry<Integer, Spell> spell : spells.entrySet())
|
|
||||||
{
|
|
||||||
Widget w = client.getWidget(WidgetInfo.TO_GROUP(spell.getKey()), WidgetInfo.TO_CHILD(spell.getKey())); // y tho let me just plop in id
|
|
||||||
|
|
||||||
if (w == null || !w.getBounds().contains(point) || !isUnfiltered(spell.getValue().getName(), tmp))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
return w;
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
void increaseSize(java.awt.Point point)
|
|
||||||
{
|
|
||||||
Widget scrolledWidget = currentWidget(point);
|
|
||||||
|
|
||||||
if (scrolledWidget == null || dragging)
|
if (scrolledWidget == null || dragging)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int scrolledWidgetId = scrolledWidget.getId();
|
final int scrolledWidgetId = scrolledWidget.getId();
|
||||||
|
final Spell scrolledSpell = spells.get(scrolledWidgetId);
|
||||||
|
|
||||||
if (!spells.containsKey(scrolledWidgetId))
|
if (scrolledSpell.getX() == -1 || scrolledSpell.getY() == -1)
|
||||||
{
|
{
|
||||||
return;
|
scrolledSpell.setX(scrolledWidget.getRelativeX());
|
||||||
|
scrolledSpell.setY(scrolledWidget.getRelativeY());
|
||||||
}
|
}
|
||||||
|
|
||||||
Spell scrolledSpell = spells.get(scrolledWidgetId);
|
|
||||||
|
|
||||||
if (trueSize(scrolledSpell) > FULL_WIDTH - 2)
|
if (trueSize(scrolledSpell) > FULL_WIDTH - 2)
|
||||||
{
|
{
|
||||||
scrolledSpell.setX(0);
|
scrolledSpell.setX(0);
|
||||||
@@ -635,63 +627,20 @@ public class SpellbookPlugin extends Plugin
|
|||||||
scrolledSpell.setX(clamp(scrolledSpell.getX() - 1, 0, FULL_WIDTH - trueSize(scrolledSpell)));
|
scrolledSpell.setX(clamp(scrolledSpell.getX() - 1, 0, FULL_WIDTH - trueSize(scrolledSpell)));
|
||||||
scrolledSpell.setY(clamp(scrolledSpell.getY() - 1, 0, FULL_HEIGHT - trueSize(scrolledSpell)));
|
scrolledSpell.setY(clamp(scrolledSpell.getY() - 1, 0, FULL_HEIGHT - trueSize(scrolledSpell)));
|
||||||
|
|
||||||
tmp.put(scrolledWidgetId, scrolledSpell);
|
|
||||||
|
|
||||||
runRebuild();
|
runRebuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
void resetZoom(java.awt.Point point)
|
void decreaseSize()
|
||||||
{
|
{
|
||||||
Widget clickedWidget = currentWidget(point);
|
final Widget scrolledWidget = currentWidget();
|
||||||
|
|
||||||
if (clickedWidget == null || dragging || !this.scroll)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int clickedWidgetId = clickedWidget.getId();
|
|
||||||
|
|
||||||
if (!spells.containsKey(clickedWidgetId))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Spell clickedSpell = spells.get(clickedWidgetId);
|
|
||||||
|
|
||||||
int oldSize = clickedSpell.getSize();
|
|
||||||
int tmpSize = tmp.get(clickedWidgetId).getSize();
|
|
||||||
|
|
||||||
if (tmpSize == 0 && oldSize == 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
clickedSpell.setX(clickedSpell.getX() + oldSize);
|
|
||||||
clickedSpell.setY(clickedSpell.getY() + oldSize);
|
|
||||||
clickedSpell.setSize(0);
|
|
||||||
|
|
||||||
tmp.put(clickedWidgetId, clickedSpell);
|
|
||||||
|
|
||||||
runRebuild();
|
|
||||||
}
|
|
||||||
|
|
||||||
void decreaseSize(java.awt.Point point)
|
|
||||||
{
|
|
||||||
Widget scrolledWidget = currentWidget(point);
|
|
||||||
|
|
||||||
if (scrolledWidget == null || dragging)
|
if (scrolledWidget == null || dragging)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int scrolledWidgetId = scrolledWidget.getId();
|
final int scrolledWidgetId = scrolledWidget.getId();
|
||||||
|
final Spell scrolledSpell = spells.get(scrolledWidgetId);
|
||||||
if (!spells.containsKey(scrolledWidgetId))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Spell scrolledSpell = spells.get(scrolledWidgetId);
|
|
||||||
|
|
||||||
// People probably don't want to scroll on a single pixel
|
// People probably don't want to scroll on a single pixel
|
||||||
if (trueSize(scrolledSpell) <= 5)
|
if (trueSize(scrolledSpell) <= 5)
|
||||||
@@ -700,33 +649,110 @@ public class SpellbookPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
scrolledSpell.setSize(scrolledSpell.getSize() - 1);
|
scrolledSpell.setSize(scrolledSpell.getSize() - 1);
|
||||||
|
|
||||||
|
if (scrolledSpell.getX() == -1 || scrolledSpell.getY() == -1)
|
||||||
|
{
|
||||||
|
scrolledSpell.setX(scrolledWidget.getRelativeX());
|
||||||
|
scrolledSpell.setY(scrolledWidget.getRelativeY());
|
||||||
|
}
|
||||||
|
|
||||||
scrolledSpell.setX(scrolledSpell.getX() + 1);
|
scrolledSpell.setX(scrolledSpell.getX() + 1);
|
||||||
scrolledSpell.setY(scrolledSpell.getY() + 1);
|
scrolledSpell.setY(scrolledSpell.getY() + 1);
|
||||||
|
|
||||||
tmp.put(scrolledWidgetId, scrolledSpell);
|
|
||||||
|
|
||||||
runRebuild();
|
runRebuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
private int trueSize(Spell s)
|
void resetSize()
|
||||||
|
{
|
||||||
|
final Widget clickedWidget = currentWidget();
|
||||||
|
|
||||||
|
if (clickedWidget == null || dragging || !this.scroll)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final int clickedWidgetId = clickedWidget.getId();
|
||||||
|
final Spell clickedSpell = spells.get(clickedWidgetId);
|
||||||
|
|
||||||
|
final int oldSize = clickedSpell.getSize();
|
||||||
|
|
||||||
|
if (oldSize == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (clickedSpell.getX() == -1 || clickedSpell.getY() == -1)
|
||||||
|
{
|
||||||
|
clickedSpell.setX(clickedWidget.getRelativeX());
|
||||||
|
clickedSpell.setY(clickedWidget.getRelativeY());
|
||||||
|
}
|
||||||
|
|
||||||
|
clickedSpell.setX(clickedSpell.getX() + oldSize);
|
||||||
|
clickedSpell.setY(clickedSpell.getY() + oldSize);
|
||||||
|
|
||||||
|
clickedSpell.setSize(0);
|
||||||
|
|
||||||
|
runRebuild();
|
||||||
|
}
|
||||||
|
|
||||||
|
// I know this still opens menu but else you
|
||||||
|
// wouldn't be able to get out of the spellbook
|
||||||
|
// mode thing lol
|
||||||
|
void resetLocation()
|
||||||
|
{
|
||||||
|
final Widget clickedWidget = currentWidget();
|
||||||
|
|
||||||
|
if (clickedWidget == null || dragging)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final int clickedWidgetId = clickedWidget.getId();
|
||||||
|
final Spell clickedSpell = spells.get(clickedWidgetId);
|
||||||
|
|
||||||
|
clickedSpell.setX(-1);
|
||||||
|
clickedSpell.setY(-1);
|
||||||
|
|
||||||
|
runRebuild();
|
||||||
|
}
|
||||||
|
|
||||||
|
private int trueSize(final Spell s)
|
||||||
{
|
{
|
||||||
return s.getSize() * 2 + this.size;
|
return s.getSize() * 2 + this.size;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateConfig()
|
private static boolean isUnfiltered(final String spell, final Set<String> unfiltereds)
|
||||||
{
|
{
|
||||||
this.enableMobile = config.enableMobile();
|
for (final String str : unfiltereds)
|
||||||
this.dragSpells = config.dragSpells();
|
{
|
||||||
this.scroll = config.scroll();
|
boolean b;
|
||||||
this.size = config.size();
|
|
||||||
this.filter = config.filter();
|
|
||||||
}
|
|
||||||
|
|
||||||
private enum WordFilterMode
|
if (str.charAt(0) == '\"')
|
||||||
{
|
{
|
||||||
CONTAINS,
|
if (str.charAt(str.length() - 1) == '\"')
|
||||||
EQUALS,
|
{
|
||||||
STARTSWITH,
|
b = spell.equalsIgnoreCase(str.substring(1, str.length() - 1));
|
||||||
ENDSWITH
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
b = StringUtils.startsWithIgnoreCase(spell, str.substring(1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (str.charAt(str.length() - 1) == '\"')
|
||||||
|
{
|
||||||
|
b = StringUtils.endsWithIgnoreCase(spell, StringUtils.chop(str));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
b = StringUtils.containsIgnoreCase(spell, str);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (b)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ import net.runelite.api.VarClientInt;
|
|||||||
import net.runelite.api.coords.LocalPoint;
|
import net.runelite.api.coords.LocalPoint;
|
||||||
import net.runelite.api.coords.WorldArea;
|
import net.runelite.api.coords.WorldArea;
|
||||||
import net.runelite.api.coords.WorldPoint;
|
import net.runelite.api.coords.WorldPoint;
|
||||||
|
import net.runelite.api.vars.InterfaceTab;
|
||||||
import net.runelite.api.widgets.Widget;
|
import net.runelite.api.widgets.Widget;
|
||||||
|
|
||||||
|
|
||||||
@@ -349,7 +350,7 @@ public class OverlayUtil
|
|||||||
{
|
{
|
||||||
Widget widget = client.getWidget(prayer.getWidgetInfo());
|
Widget widget = client.getWidget(prayer.getWidgetInfo());
|
||||||
|
|
||||||
if (widget == null || client.getVar(VarClientInt.PLAYER_INTERFACE_CONTAINER_OPENED) != 5)
|
if (widget == null || client.getVar(VarClientInt.INTERFACE_TAB) != InterfaceTab.PRAYER.getId())
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package net.runelite.mixins;
|
|||||||
import net.runelite.api.Sprite;
|
import net.runelite.api.Sprite;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import net.runelite.api.mixins.Copy;
|
import net.runelite.api.mixins.Copy;
|
||||||
|
import net.runelite.api.mixins.Inject;
|
||||||
import net.runelite.api.mixins.Mixin;
|
import net.runelite.api.mixins.Mixin;
|
||||||
import net.runelite.api.mixins.Replace;
|
import net.runelite.api.mixins.Replace;
|
||||||
import net.runelite.api.mixins.Shadow;
|
import net.runelite.api.mixins.Shadow;
|
||||||
@@ -36,4 +37,11 @@ public abstract class WidgetSpriteMixin implements RSWidget
|
|||||||
|
|
||||||
return rs$getWidgetSprite(var1);
|
return rs$getWidgetSprite(var1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@Override
|
||||||
|
public Sprite getSprite()
|
||||||
|
{
|
||||||
|
return getSprite(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -485,4 +485,11 @@ public interface RSWidget extends Widget
|
|||||||
@Import("onInvTransmit")
|
@Import("onInvTransmit")
|
||||||
@Override
|
@Override
|
||||||
Object[] getOnInvTransmit();
|
Object[] getOnInvTransmit();
|
||||||
|
|
||||||
|
@Import("containsMouse")
|
||||||
|
@Override
|
||||||
|
boolean containsMouse();
|
||||||
|
|
||||||
|
@Import("getSprite")
|
||||||
|
RSSprite getSprite(boolean b);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ public class ScriptEvent extends Node {
|
|||||||
@Export("args")
|
@Export("args")
|
||||||
Object[] args;
|
Object[] args;
|
||||||
@ObfuscatedName("w")
|
@ObfuscatedName("w")
|
||||||
@Export("boolean1")
|
@Export("isMouseInputEvent")
|
||||||
boolean boolean1;
|
boolean isMouseInputEvent;
|
||||||
@ObfuscatedName("e")
|
@ObfuscatedName("e")
|
||||||
@ObfuscatedSignature(
|
@ObfuscatedSignature(
|
||||||
signature = "Lhj;"
|
signature = "Lhj;"
|
||||||
|
|||||||
@@ -863,12 +863,12 @@ public class Widget extends Node {
|
|||||||
this.itemQuantities = new int[this.rawHeight * this.rawWidth];
|
this.itemQuantities = new int[this.rawHeight * this.rawWidth];
|
||||||
var4 = var1.readUnsignedByte();
|
var4 = var1.readUnsignedByte();
|
||||||
if (var4 == 1) {
|
if (var4 == 1) {
|
||||||
this.clickMask |= 268435456;
|
this.clickMask |= 0x10000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
var5 = var1.readUnsignedByte();
|
var5 = var1.readUnsignedByte();
|
||||||
if (var5 == 1) {
|
if (var5 == 1) {
|
||||||
this.clickMask |= 1073741824;
|
this.clickMask |= 0x40000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
var6 = var1.readUnsignedByte();
|
var6 = var1.readUnsignedByte();
|
||||||
@@ -878,7 +878,7 @@ public class Widget extends Node {
|
|||||||
|
|
||||||
int var7 = var1.readUnsignedByte();
|
int var7 = var1.readUnsignedByte();
|
||||||
if (var7 == 1) {
|
if (var7 == 1) {
|
||||||
this.clickMask |= 536870912;
|
this.clickMask |= 0x20000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.paddingX = var1.readUnsignedByte();
|
this.paddingX = var1.readUnsignedByte();
|
||||||
@@ -1036,7 +1036,7 @@ public class Widget extends Node {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.buttonType == 1 || this.buttonType == 4 || this.buttonType == 5) {
|
if (this.buttonType == 1 || this.buttonType == 4 || this.buttonType == 5) {
|
||||||
this.clickMask |= 4194304;
|
this.clickMask |= 0x400000;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.buttonType == 6) {
|
if (this.buttonType == 6) {
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ final class class2 implements class0 {
|
|||||||
if (var9.noClickThrough) {
|
if (var9.noClickThrough) {
|
||||||
if (MouseHandler.MouseHandler_x >= var12 && MouseHandler.MouseHandler_y >= var13 && MouseHandler.MouseHandler_x < var14 && MouseHandler.MouseHandler_y < var15) {
|
if (MouseHandler.MouseHandler_x >= var12 && MouseHandler.MouseHandler_y >= var13 && MouseHandler.MouseHandler_x < var14 && MouseHandler.MouseHandler_y < var15) {
|
||||||
for (ScriptEvent var26 = (ScriptEvent)Client.scriptEvents.last(); var26 != null; var26 = (ScriptEvent)Client.scriptEvents.previous()) {
|
for (ScriptEvent var26 = (ScriptEvent)Client.scriptEvents.last(); var26 != null; var26 = (ScriptEvent)Client.scriptEvents.previous()) {
|
||||||
if (var26.boolean1) {
|
if (var26.isMouseInputEvent) {
|
||||||
var26.remove();
|
var26.remove();
|
||||||
var26.widget.containsMouse = false;
|
var26.widget.containsMouse = false;
|
||||||
}
|
}
|
||||||
@@ -183,7 +183,7 @@ final class class2 implements class0 {
|
|||||||
}
|
}
|
||||||
} else if (var9.noScrollThrough && MouseHandler.MouseHandler_x >= var12 && MouseHandler.MouseHandler_y >= var13 && MouseHandler.MouseHandler_x < var14 && MouseHandler.MouseHandler_y < var15) {
|
} else if (var9.noScrollThrough && MouseHandler.MouseHandler_x >= var12 && MouseHandler.MouseHandler_y >= var13 && MouseHandler.MouseHandler_x < var14 && MouseHandler.MouseHandler_y < var15) {
|
||||||
for (ScriptEvent var26 = (ScriptEvent)Client.scriptEvents.last(); var26 != null; var26 = (ScriptEvent)Client.scriptEvents.previous()) {
|
for (ScriptEvent var26 = (ScriptEvent)Client.scriptEvents.last(); var26 != null; var26 = (ScriptEvent)Client.scriptEvents.previous()) {
|
||||||
if (var26.boolean1 && var26.widget.onScroll == var26.args) {
|
if (var26.isMouseInputEvent && var26.widget.onScroll == var26.args) {
|
||||||
var26.remove();
|
var26.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -324,7 +324,7 @@ final class class2 implements class0 {
|
|||||||
if (var9.hasListener) {
|
if (var9.hasListener) {
|
||||||
if (var33 && Client.mouseWheelRotation != 0 && var9.onScroll != null) {
|
if (var33 && Client.mouseWheelRotation != 0 && var9.onScroll != null) {
|
||||||
ScriptEvent var29 = new ScriptEvent();
|
ScriptEvent var29 = new ScriptEvent();
|
||||||
var29.boolean1 = true;
|
var29.isMouseInputEvent = true;
|
||||||
var29.widget = var9;
|
var29.widget = var9;
|
||||||
var29.mouseY = Client.mouseWheelRotation;
|
var29.mouseY = Client.mouseWheelRotation;
|
||||||
var29.args = var9.onScroll;
|
var29.args = var9.onScroll;
|
||||||
@@ -341,7 +341,7 @@ final class class2 implements class0 {
|
|||||||
var9.isClicked = true;
|
var9.isClicked = true;
|
||||||
if (var9.onClick != null) {
|
if (var9.onClick != null) {
|
||||||
ScriptEvent var29 = new ScriptEvent();
|
ScriptEvent var29 = new ScriptEvent();
|
||||||
var29.boolean1 = true;
|
var29.isMouseInputEvent = true;
|
||||||
var29.widget = var9;
|
var29.widget = var9;
|
||||||
var29.mouseX = MouseHandler.MouseHandler_lastPressedX - var10;
|
var29.mouseX = MouseHandler.MouseHandler_lastPressedX - var10;
|
||||||
var29.mouseY = MouseHandler.MouseHandler_lastPressedY - var11;
|
var29.mouseY = MouseHandler.MouseHandler_lastPressedY - var11;
|
||||||
@@ -352,7 +352,7 @@ final class class2 implements class0 {
|
|||||||
|
|
||||||
if (var9.isClicked && var34 && var9.onClickRepeat != null) {
|
if (var9.isClicked && var34 && var9.onClickRepeat != null) {
|
||||||
ScriptEvent var29 = new ScriptEvent();
|
ScriptEvent var29 = new ScriptEvent();
|
||||||
var29.boolean1 = true;
|
var29.isMouseInputEvent = true;
|
||||||
var29.widget = var9;
|
var29.widget = var9;
|
||||||
var29.mouseX = MouseHandler.MouseHandler_x - var10;
|
var29.mouseX = MouseHandler.MouseHandler_x - var10;
|
||||||
var29.mouseY = MouseHandler.MouseHandler_y - var11;
|
var29.mouseY = MouseHandler.MouseHandler_y - var11;
|
||||||
@@ -364,7 +364,7 @@ final class class2 implements class0 {
|
|||||||
var9.isClicked = false;
|
var9.isClicked = false;
|
||||||
if (var9.onRelease != null) {
|
if (var9.onRelease != null) {
|
||||||
ScriptEvent var29 = new ScriptEvent();
|
ScriptEvent var29 = new ScriptEvent();
|
||||||
var29.boolean1 = true;
|
var29.isMouseInputEvent = true;
|
||||||
var29.widget = var9;
|
var29.widget = var9;
|
||||||
var29.mouseX = MouseHandler.MouseHandler_x - var10;
|
var29.mouseX = MouseHandler.MouseHandler_x - var10;
|
||||||
var29.mouseY = MouseHandler.MouseHandler_y - var11;
|
var29.mouseY = MouseHandler.MouseHandler_y - var11;
|
||||||
@@ -375,7 +375,7 @@ final class class2 implements class0 {
|
|||||||
|
|
||||||
if (var34 && var9.onHold != null) {
|
if (var34 && var9.onHold != null) {
|
||||||
ScriptEvent var29 = new ScriptEvent();
|
ScriptEvent var29 = new ScriptEvent();
|
||||||
var29.boolean1 = true;
|
var29.isMouseInputEvent = true;
|
||||||
var29.widget = var9;
|
var29.widget = var9;
|
||||||
var29.mouseX = MouseHandler.MouseHandler_x - var10;
|
var29.mouseX = MouseHandler.MouseHandler_x - var10;
|
||||||
var29.mouseY = MouseHandler.MouseHandler_y - var11;
|
var29.mouseY = MouseHandler.MouseHandler_y - var11;
|
||||||
@@ -387,7 +387,7 @@ final class class2 implements class0 {
|
|||||||
var9.containsMouse = true;
|
var9.containsMouse = true;
|
||||||
if (var9.onMouseOver != null) {
|
if (var9.onMouseOver != null) {
|
||||||
ScriptEvent var29 = new ScriptEvent();
|
ScriptEvent var29 = new ScriptEvent();
|
||||||
var29.boolean1 = true;
|
var29.isMouseInputEvent = true;
|
||||||
var29.widget = var9;
|
var29.widget = var9;
|
||||||
var29.mouseX = MouseHandler.MouseHandler_x - var10;
|
var29.mouseX = MouseHandler.MouseHandler_x - var10;
|
||||||
var29.mouseY = MouseHandler.MouseHandler_y - var11;
|
var29.mouseY = MouseHandler.MouseHandler_y - var11;
|
||||||
@@ -398,7 +398,7 @@ final class class2 implements class0 {
|
|||||||
|
|
||||||
if (var9.containsMouse && var33 && var9.onMouseRepeat != null) {
|
if (var9.containsMouse && var33 && var9.onMouseRepeat != null) {
|
||||||
ScriptEvent var29 = new ScriptEvent();
|
ScriptEvent var29 = new ScriptEvent();
|
||||||
var29.boolean1 = true;
|
var29.isMouseInputEvent = true;
|
||||||
var29.widget = var9;
|
var29.widget = var9;
|
||||||
var29.mouseX = MouseHandler.MouseHandler_x - var10;
|
var29.mouseX = MouseHandler.MouseHandler_x - var10;
|
||||||
var29.mouseY = MouseHandler.MouseHandler_y - var11;
|
var29.mouseY = MouseHandler.MouseHandler_y - var11;
|
||||||
@@ -410,7 +410,7 @@ final class class2 implements class0 {
|
|||||||
var9.containsMouse = false;
|
var9.containsMouse = false;
|
||||||
if (var9.onMouseLeave != null) {
|
if (var9.onMouseLeave != null) {
|
||||||
ScriptEvent var29 = new ScriptEvent();
|
ScriptEvent var29 = new ScriptEvent();
|
||||||
var29.boolean1 = true;
|
var29.isMouseInputEvent = true;
|
||||||
var29.widget = var9;
|
var29.widget = var9;
|
||||||
var29.mouseX = MouseHandler.MouseHandler_x - var10;
|
var29.mouseX = MouseHandler.MouseHandler_x - var10;
|
||||||
var29.mouseY = MouseHandler.MouseHandler_y - var11;
|
var29.mouseY = MouseHandler.MouseHandler_y - var11;
|
||||||
@@ -596,7 +596,7 @@ final class class2 implements class0 {
|
|||||||
}
|
}
|
||||||
if (var27.type == 0 && MouseHandler.MouseHandler_x >= var12 && MouseHandler.MouseHandler_y >= var13 && MouseHandler.MouseHandler_x < var14 && MouseHandler.MouseHandler_y < var15 && !Client.isMenuOpen) {
|
if (var27.type == 0 && MouseHandler.MouseHandler_x >= var12 && MouseHandler.MouseHandler_y >= var13 && MouseHandler.MouseHandler_x < var14 && MouseHandler.MouseHandler_y < var15 && !Client.isMenuOpen) {
|
||||||
for (ScriptEvent var28 = (ScriptEvent)Client.scriptEvents.last(); var28 != null; var28 = (ScriptEvent)Client.scriptEvents.previous()) {
|
for (ScriptEvent var28 = (ScriptEvent)Client.scriptEvents.last(); var28 != null; var28 = (ScriptEvent)Client.scriptEvents.previous()) {
|
||||||
if (var28.boolean1) {
|
if (var28.isMouseInputEvent) {
|
||||||
var28.remove();
|
var28.remove();
|
||||||
var28.widget.containsMouse = false;
|
var28.widget.containsMouse = false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user