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
|
||||
{
|
||||
/**
|
||||
* 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
|
||||
* <ul>
|
||||
@@ -47,12 +59,6 @@ public final class ScriptID
|
||||
@ScriptArguments(integer = 1, string = 1)
|
||||
public static final int CHATBOX_INPUT = 96;
|
||||
|
||||
/**
|
||||
* Rebuilds the chatbox
|
||||
*/
|
||||
@ScriptArguments()
|
||||
public static final int BUILD_CHATBOX = 216;
|
||||
|
||||
/**
|
||||
* Opens the Private Message chat interface
|
||||
*
|
||||
@@ -64,6 +70,12 @@ public final class ScriptID
|
||||
@ScriptArguments(string = 1)
|
||||
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
|
||||
* <ul>
|
||||
@@ -73,6 +85,12 @@ public final class ScriptID
|
||||
@ScriptArguments(string = 1)
|
||||
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
|
||||
* <ul>
|
||||
@@ -94,21 +112,10 @@ public final class ScriptID
|
||||
public static final int MESSAGE_LAYER_OPEN = 677;
|
||||
|
||||
/**
|
||||
* Builds the chatbox input widget
|
||||
* Clicking bank pin buttons runs this
|
||||
*/
|
||||
@ScriptArguments()
|
||||
public static final int CHAT_PROMPT_INIT = 223;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
@ScriptArguments(integer = 20)
|
||||
public static final int BANK_PIN_OP = 685;
|
||||
|
||||
/**
|
||||
* Checks the state of the given stash unit.
|
||||
@@ -123,10 +130,31 @@ public final class ScriptID
|
||||
*/
|
||||
@ScriptArguments(integer = 4)
|
||||
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>
|
||||
* <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
|
||||
* </ul>
|
||||
* Returns
|
||||
@@ -148,16 +176,10 @@ public final class ScriptID
|
||||
public static final int DIARY_QUEST_UPDATE_LINECOUNT = 2523;
|
||||
|
||||
/**
|
||||
* 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>
|
||||
* Rebuilds the Spellbook
|
||||
*/
|
||||
@ScriptArguments(integer = 2)
|
||||
public static final int CAMERA_DO_ZOOM = 42;
|
||||
@ScriptArguments(integer = 10, string = 2)
|
||||
public static final int MAGIC_SPELLBOOK_REDRAW = 2611;
|
||||
|
||||
/**
|
||||
* Does nothing
|
||||
@@ -174,17 +196,6 @@ public final class ScriptID
|
||||
@ScriptArguments(string = 2)
|
||||
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
|
||||
*/
|
||||
@@ -196,10 +207,5 @@ public final class ScriptID
|
||||
*/
|
||||
@ScriptArguments(string = 1)
|
||||
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),
|
||||
|
||||
/**
|
||||
* 0 = Combat
|
||||
* 1 = Stats
|
||||
* 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
|
||||
* The currently open interface tab
|
||||
* @see net.runelite.api.vars.InterfaceTab
|
||||
*/
|
||||
PLAYER_INTERFACE_CONTAINER_OPENED(171),
|
||||
|
||||
INVENTORY_TAB(171),
|
||||
INTERFACE_TAB(171),
|
||||
|
||||
WORLD_MAP_SEARCH_FOCUSED(190);
|
||||
|
||||
|
||||
@@ -498,13 +498,7 @@ public enum Varbits
|
||||
* 2 = lunars
|
||||
* 3 = arrceus
|
||||
**/
|
||||
SPELLBOOK_ID(4070),
|
||||
|
||||
/**
|
||||
* 0 = no
|
||||
* 1 = yes
|
||||
**/
|
||||
SPELLBOOK_HIDDEN(6718),
|
||||
SPELLBOOK(4070),
|
||||
|
||||
/**
|
||||
* Amount of items in each bank tab
|
||||
@@ -647,11 +641,6 @@ public enum Varbits
|
||||
//TODO
|
||||
QUEST_IN_SEARCH_OF_KNOWLEDGE(6067),
|
||||
|
||||
/**
|
||||
* Active spellbook (see enumID)
|
||||
*/
|
||||
SPELLBOOK(4070),
|
||||
|
||||
/**
|
||||
* Spellbook filtering (1 = unfiltered, 0 = filtered)
|
||||
*/
|
||||
|
||||
@@ -9,7 +9,7 @@ public interface WidgetNode extends Node
|
||||
* The ID of the widget.
|
||||
*
|
||||
* @return the ID of the widget
|
||||
* @see api.widgets.Widget
|
||||
* @see net.runelite.api.widgets.Widget
|
||||
*/
|
||||
int getId();
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ package net.runelite.api.events;
|
||||
import lombok.Value;
|
||||
|
||||
/**
|
||||
* An event where a varbit integer has changed.
|
||||
* An event where a client int var has changed.
|
||||
*/
|
||||
@Value
|
||||
public class VarClientIntChanged implements Event
|
||||
|
||||
@@ -28,7 +28,7 @@ package net.runelite.api.events;
|
||||
import lombok.Value;
|
||||
|
||||
/**
|
||||
* An event where a varbit string has changed.
|
||||
* An event where a client var string has changed.
|
||||
*/
|
||||
@Value
|
||||
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.Point;
|
||||
import net.runelite.api.Sprite;
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
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 final int FILTERED_SPELLS_PARENT = 1;
|
||||
static final int FILTERED_SPELLS_BOUNDS = 3;
|
||||
|
||||
// NORMAL SPELLS
|
||||
@@ -968,6 +969,12 @@ public class WidgetID
|
||||
|
||||
// ARCEUUS SPELLS
|
||||
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
|
||||
|
||||
@@ -517,6 +517,8 @@ public enum WidgetInfo
|
||||
PVP_BOUNTY_HUNTER_INFO(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.BOUNTY_HUNTER_INFO),
|
||||
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),
|
||||
|
||||
/* STANDARD SPELL BOOK WIDGETS*/
|
||||
@@ -671,7 +673,13 @@ public enum WidgetInfo
|
||||
SPELL_TOOLTIP(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.SpellBook.TOOLTIP),
|
||||
/* ARCEUUS SPELL BOOK WIDGETS*/
|
||||
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*/
|
||||
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),
|
||||
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)
|
||||
{
|
||||
this.menuOption = menuOption;
|
||||
setMenuTarget(menuTarget);
|
||||
this.menuTarget = menuTarget;
|
||||
this.widget = widget;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemDefinition;
|
||||
import net.runelite.api.ItemContainer;
|
||||
import net.runelite.api.VarClientInt;
|
||||
import net.runelite.api.vars.InterfaceTab;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import static net.runelite.client.plugins.lootingbagviewer.LootingBagViewerOverlay.PLACEHOLDER_WIDTH;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
@@ -98,7 +99,7 @@ class InventoryViewerOverlay extends Overlay
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (plugin.isHideWhenInvOpen()
|
||||
&& client.getVar(VarClientInt.PLAYER_INTERFACE_CONTAINER_OPENED) == 3)
|
||||
&& client.getVar(VarClientInt.INTERFACE_TAB) == InterfaceTab.INVENTORY.getId())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ import net.runelite.api.VarClientInt;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.VarClientIntChanged;
|
||||
import net.runelite.api.events.WidgetLoaded;
|
||||
import net.runelite.api.vars.InterfaceTab;
|
||||
import net.runelite.api.widgets.JavaScriptCallback;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetID;
|
||||
@@ -182,7 +183,7 @@ public class MusicListPlugin extends Plugin
|
||||
|
||||
private boolean isOnMusicTab()
|
||||
{
|
||||
return client.getVar(VarClientInt.INVENTORY_TAB) == 13;
|
||||
return client.getVar(VarClientInt.INTERFACE_TAB) == InterfaceTab.MUSIC.getId();
|
||||
}
|
||||
|
||||
private boolean isChatboxOpen()
|
||||
|
||||
@@ -47,6 +47,7 @@ import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.ScriptCallbackEvent;
|
||||
import net.runelite.api.events.VarClientIntChanged;
|
||||
import net.runelite.api.events.VarbitChanged;
|
||||
import net.runelite.api.vars.InterfaceTab;
|
||||
import net.runelite.api.widgets.JavaScriptCallback;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
@@ -192,7 +193,7 @@ public class QuestListPlugin extends Plugin
|
||||
|
||||
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();
|
||||
}
|
||||
@@ -218,7 +219,7 @@ public class QuestListPlugin extends Plugin
|
||||
|
||||
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()
|
||||
|
||||
@@ -67,7 +67,7 @@ public interface SpellbookConfig extends Config
|
||||
@ConfigItem(
|
||||
keyName = "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
|
||||
)
|
||||
default int size()
|
||||
@@ -78,7 +78,7 @@ public interface SpellbookConfig extends Config
|
||||
@ConfigItem(
|
||||
keyName = "filter",
|
||||
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
|
||||
default String filter()
|
||||
{
|
||||
@@ -103,4 +103,51 @@ public interface SpellbookConfig extends Config
|
||||
hidden = true
|
||||
)
|
||||
void canDrag(boolean canDrag);
|
||||
|
||||
// Next 4 methods have to be here, or the reset configuration
|
||||
// button won't reset em like it should.
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "standard",
|
||||
name = "",
|
||||
description = "",
|
||||
hidden = true
|
||||
)
|
||||
default String standard()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "ancient",
|
||||
name = "",
|
||||
description = "",
|
||||
hidden = true
|
||||
)
|
||||
default String ancient()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "lunar",
|
||||
name = "",
|
||||
description = "",
|
||||
hidden = true
|
||||
)
|
||||
default String lunar()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "arceuus",
|
||||
name = "",
|
||||
description = "",
|
||||
hidden = true
|
||||
)
|
||||
default String arceuus()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,12 +27,10 @@ package net.runelite.client.plugins.spellbook;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Point;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.image.BufferedImage;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.game.SpriteManager;
|
||||
import net.runelite.api.Sprite;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
@@ -43,21 +41,19 @@ public class SpellbookDragOverlay extends Overlay
|
||||
{
|
||||
private final SpellbookPlugin plugin;
|
||||
private final Client client;
|
||||
private final SpriteManager spriteManager;
|
||||
|
||||
@Inject
|
||||
private SpellbookDragOverlay(final SpellbookPlugin plugin, final Client client, final SpriteManager spriteManager)
|
||||
private SpellbookDragOverlay(final SpellbookPlugin plugin, final Client client)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
this.client = client;
|
||||
this.spriteManager = spriteManager;
|
||||
setPosition(OverlayPosition.TOOLTIP);
|
||||
setPriority(OverlayPriority.HIGHEST);
|
||||
setPriority(OverlayPriority.HIGH);
|
||||
setLayer(OverlayLayer.ALWAYS_ON_TOP);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D g)
|
||||
public Dimension render(final Graphics2D g)
|
||||
{
|
||||
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 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();
|
||||
final int sprite = plugin.getDraggingWidget().getSpriteId();
|
||||
final BufferedImage image = spriteManager.getSprite(sprite, 0);
|
||||
if (sprite != null)
|
||||
{
|
||||
sprite.drawAt(drawPos.x, drawPos.y);
|
||||
}
|
||||
|
||||
final Point mousePosition = new Point(mouseCanvasPosition.getX() - draggingLocation.getX(), mouseCanvasPosition.getY() - draggingLocation.getY());
|
||||
final Rectangle bounds = new Rectangle(mousePosition.x, mousePosition.y, size, size);
|
||||
|
||||
g.drawImage(image, mousePosition.x, mousePosition.y, size, size, null);
|
||||
|
||||
return bounds.getSize();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,16 +42,16 @@ class SpellbookMouseListener extends MouseAdapter implements MouseWheelListener
|
||||
}
|
||||
|
||||
@Override
|
||||
public MouseEvent mouseClicked(MouseEvent event)
|
||||
public MouseEvent mouseClicked(final MouseEvent event)
|
||||
{
|
||||
if (plugin.isNotOnSpellWidget(event.getPoint()))
|
||||
if (plugin.isNotOnSpellWidget())
|
||||
{
|
||||
return event;
|
||||
}
|
||||
|
||||
if (SwingUtilities.isMiddleMouseButton(event))
|
||||
{
|
||||
plugin.resetZoom(event.getPoint());
|
||||
plugin.resetSize();
|
||||
}
|
||||
|
||||
event.consume();
|
||||
@@ -59,21 +59,24 @@ class SpellbookMouseListener extends MouseAdapter implements MouseWheelListener
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
else if (SwingUtilities.isLeftMouseButton(event) && !plugin.isNotOnSpellWidget() && !plugin.isDragging())
|
||||
{
|
||||
plugin.startDragging(event.getPoint());
|
||||
event.consume();
|
||||
}
|
||||
|
||||
plugin.startDragging(event.getPoint());
|
||||
|
||||
event.consume();
|
||||
return event;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MouseEvent mouseReleased(MouseEvent event)
|
||||
public MouseEvent mouseReleased(final MouseEvent event)
|
||||
{
|
||||
if (!SwingUtilities.isLeftMouseButton(event) || !plugin.isDragging())
|
||||
{
|
||||
@@ -87,22 +90,22 @@ class SpellbookMouseListener extends MouseAdapter implements MouseWheelListener
|
||||
}
|
||||
|
||||
@Override
|
||||
public MouseWheelEvent mouseWheelMoved(MouseWheelEvent event)
|
||||
public MouseWheelEvent mouseWheelMoved(final MouseWheelEvent event)
|
||||
{
|
||||
if (plugin.isNotOnSpellWidget(event.getPoint()))
|
||||
if (plugin.isNotOnSpellWidget())
|
||||
{
|
||||
return event;
|
||||
}
|
||||
|
||||
int direction = event.getWheelRotation();
|
||||
final int direction = event.getWheelRotation();
|
||||
|
||||
if (direction > 0)
|
||||
{
|
||||
plugin.increaseSize(event.getPoint());
|
||||
plugin.increaseSize();
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.decreaseSize(event.getPoint());
|
||||
plugin.decreaseSize();
|
||||
}
|
||||
|
||||
event.consume();
|
||||
|
||||
@@ -33,7 +33,6 @@ import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@@ -42,15 +41,18 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.Point;
|
||||
import static net.runelite.api.ScriptID.MAGIC_SPELLBOOK_REDRAW;
|
||||
import net.runelite.api.VarClientInt;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
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.vars.InterfaceTab;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import static net.runelite.api.widgets.WidgetInfo.*;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
@@ -63,6 +65,7 @@ import net.runelite.client.plugins.PluginType;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import static net.runelite.client.util.MiscUtils.clamp;
|
||||
import net.runelite.client.util.Text;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@PluginDescriptor(
|
||||
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_UNLOCK = new WidgetMenuOption(UNLOCK, MENU_TARGET, WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_MAGIC_TAB);
|
||||
private final Map<Integer, Spell> spells = new HashMap<>();
|
||||
private final SpellbookMouseListener mouseListener = new SpellbookMouseListener(this);
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@@ -123,78 +128,14 @@ public class SpellbookPlugin extends Plugin
|
||||
|
||||
@Getter
|
||||
private Point draggingLocation;
|
||||
private Map<Integer, Spell> tmp = null;
|
||||
|
||||
private ImmutableSet<String> notFilteredSpells;
|
||||
private Spellbook spellbook;
|
||||
private SpellbookMouseListener mouseListener;
|
||||
private boolean mageTabOpen;
|
||||
private boolean enableMobile;
|
||||
private boolean dragSpells;
|
||||
private boolean scroll;
|
||||
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
|
||||
SpellbookConfig getConfig(ConfigManager configManager)
|
||||
@@ -205,12 +146,9 @@ public class SpellbookPlugin extends Plugin
|
||||
@Override
|
||||
protected void startUp()
|
||||
{
|
||||
updateConfig();
|
||||
addSubscriptions();
|
||||
|
||||
updateConfig();
|
||||
refreshMagicTabOption();
|
||||
loadFilter();
|
||||
mouseListener = new SpellbookMouseListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -222,60 +160,105 @@ public class SpellbookPlugin extends Plugin
|
||||
config.canDrag(false);
|
||||
mouseManager.unregisterMouseListener(mouseListener);
|
||||
mouseManager.unregisterMouseWheelListener(mouseListener);
|
||||
mouseListener = null;
|
||||
}
|
||||
|
||||
private void addSubscriptions()
|
||||
{
|
||||
eventBus.subscribe(VarClientIntChanged.class, this, this::onVarCIntChanged);
|
||||
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
|
||||
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
|
||||
eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged);
|
||||
eventBus.subscribe(WidgetMenuOptionClicked.class, this, this::onWidgetMenuOptionClicked);
|
||||
eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent);
|
||||
}
|
||||
|
||||
private void onGameStateChanged(GameStateChanged event)
|
||||
private void updateConfig()
|
||||
{
|
||||
if (event.getGameState() == GameState.LOGGED_IN)
|
||||
{
|
||||
refreshMagicTabOption();
|
||||
}
|
||||
loadFilter();
|
||||
this.enableMobile = config.enableMobile();
|
||||
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()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
updateConfig();
|
||||
|
||||
String key = event.getKey();
|
||||
|
||||
if ("filter".equals(key))
|
||||
switch (event.getKey())
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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
|
||||
&& event.getWidget() != WidgetInfo.RESIZABLE_VIEWPORT_MAGIC_TAB
|
||||
@@ -284,12 +267,16 @@ public class SpellbookPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
saveSpells();
|
||||
loadSpells();
|
||||
|
||||
if (event.getMenuOption().equals(UNLOCK))
|
||||
{
|
||||
config.canDrag(true);
|
||||
|
||||
overlayManager.add(overlay);
|
||||
|
||||
mouseManager.registerMouseListener(mouseListener);
|
||||
tmp = new HashMap<>();
|
||||
|
||||
if (this.scroll)
|
||||
{
|
||||
@@ -299,12 +286,14 @@ public class SpellbookPlugin extends Plugin
|
||||
else if (event.getMenuOption().equals(LOCK))
|
||||
{
|
||||
config.canDrag(false);
|
||||
|
||||
overlayManager.remove(overlay);
|
||||
|
||||
mouseManager.unregisterMouseListener(mouseListener);
|
||||
mouseManager.unregisterMouseWheelListener(mouseListener);
|
||||
saveSpells();
|
||||
tmp = null;
|
||||
}
|
||||
|
||||
refreshMagicTabOption();
|
||||
}
|
||||
|
||||
private void clearMagicTabMenus()
|
||||
@@ -320,7 +309,8 @@ public class SpellbookPlugin extends Plugin
|
||||
private void refreshMagicTabOption()
|
||||
{
|
||||
clearMagicTabMenus();
|
||||
if (client.getGameState() != GameState.LOGGED_IN || !this.dragSpells)
|
||||
|
||||
if (!this.dragSpells || !mageTabOpen)
|
||||
{
|
||||
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
|
||||
|| !this.enableMobile
|
||||
@@ -348,129 +338,135 @@ public class SpellbookPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
int[] iStack = client.getIntStack();
|
||||
int iStackSize = client.getIntStackSize();
|
||||
final int[] iStack = client.getIntStack();
|
||||
final int iStackSize = client.getIntStackSize();
|
||||
|
||||
String[] sStack = client.getStringStack();
|
||||
int sStackSize = client.getStringStackSize();
|
||||
final String[] sStack = client.getStringStack();
|
||||
final int sStackSize = client.getStringStackSize();
|
||||
|
||||
if ("startSpellRedraw".equals(event.getEventName()))
|
||||
switch (event.getEventName())
|
||||
{
|
||||
if (config.canDrag())
|
||||
{
|
||||
return;
|
||||
}
|
||||
case "startSpellRedraw":
|
||||
final Spellbook pook = Spellbook.getByID(client.getVar(Varbits.SPELLBOOK));
|
||||
|
||||
spellbook = Spellbook.getByID(client.getVar(Varbits.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))
|
||||
if (pook != spellbook)
|
||||
{
|
||||
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 - 3] = newSize;
|
||||
iStack[iStackSize - 2] = newSize;
|
||||
}
|
||||
else if ("setSpellPosition".equals(event.getEventName()))
|
||||
{
|
||||
if (!this.dragSpells)
|
||||
iStack[iStackSize - 2] = FULL_WIDTH;
|
||||
iStack[iStackSize - 1] = FULL_HEIGHT;
|
||||
break;
|
||||
case "resizeIndividualSpells":
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
int widget = iStack[iStackSize - 1];
|
||||
Spell s = spells.get(widget);
|
||||
int x = s.getX();
|
||||
int y = s.getY();
|
||||
|
||||
if (x == -1 || y == -1)
|
||||
case "setSpellPosition":
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!this.dragSpells)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
iStack[iStackSize - 5] = x;
|
||||
iStack[iStackSize - 4] = y;
|
||||
final int widget = iStack[iStackSize - 1];
|
||||
final Spell s = spells.get(widget);
|
||||
final int x = s.getX();
|
||||
final int y = s.getY();
|
||||
|
||||
if (x == -1 || y == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
iStack[iStackSize - 5] = x;
|
||||
iStack[iStackSize - 4] = y;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void loadSpells()
|
||||
{
|
||||
if (client.getGameState() != GameState.LOGGED_IN || spellbook == null)
|
||||
spells.clear();
|
||||
|
||||
if (client.getGameState() != GameState.LOGGED_IN)
|
||||
{
|
||||
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))
|
||||
{
|
||||
@@ -478,151 +474,147 @@ public class SpellbookPlugin extends Plugin
|
||||
}
|
||||
|
||||
// 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
|
||||
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.replace(entry.getKey(), entry.getValue());
|
||||
}
|
||||
spells.put(s.getWidget(), s);
|
||||
}
|
||||
}
|
||||
|
||||
private void saveSpells()
|
||||
{
|
||||
if (spells.isEmpty() || tmp == null || tmp.isEmpty())
|
||||
if (spells.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Map.Entry<Integer, Spell> entry : tmp.entrySet())
|
||||
{
|
||||
spells.replace(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
||||
String key = spellbook.getConfigKey();
|
||||
|
||||
configManager.setConfiguration("spellbook", key, GSON.toJson(spells.values()));
|
||||
configManager.setConfiguration("spellbook", spellbook.getConfigKey(), GSON.toJson(spells.values()));
|
||||
}
|
||||
|
||||
private void runRebuild()
|
||||
{
|
||||
if (client.getGameState() != GameState.LOGGED_IN)
|
||||
if (client.getGameState() != GameState.LOGGED_IN || !mageTabOpen)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Runs magic_spellbook_rebuild
|
||||
// The magic numbers probably are mobile specific widgetids
|
||||
// runeliteplus mobile when?
|
||||
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.getVar(VarClientInt.INVENTORY_TAB) != 6
|
||||
|| client.isMenuOpen()
|
||||
|| boundsWidget == null
|
||||
|| !boundsWidget.getBounds().contains(point))
|
||||
if (client.isMenuOpen() || !mageTabOpen)
|
||||
{
|
||||
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)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Point widgetPos = draggingWidget.getCanvasLocation();
|
||||
final Point widgetPos = draggingWidget.getCanvasLocation();
|
||||
|
||||
int x = point.x - widgetPos.getX();
|
||||
int y = point.y - widgetPos.getY();
|
||||
final int x = point.x - widgetPos.getX();
|
||||
final int y = point.y - widgetPos.getY();
|
||||
|
||||
draggingLocation = new Point(x, y);
|
||||
draggingWidget.setHidden(true);
|
||||
dragging = true;
|
||||
}
|
||||
|
||||
void completeDragging(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 y = point.y - draggingLocation.getY() - parentPos.getY();
|
||||
int size = draggingWidget.getWidth();
|
||||
final int size = draggingWidget.getWidth();
|
||||
|
||||
x = clamp(x, 0, FULL_WIDTH - size);
|
||||
y = clamp(y, 0, FULL_HEIGHT - size);
|
||||
|
||||
int draggedID = draggingWidget.getId();
|
||||
Spell n = spells.get(draggedID);
|
||||
final int draggedID = draggingWidget.getId();
|
||||
final Spell n = spells.get(draggedID);
|
||||
|
||||
n.setX(x);
|
||||
n.setY(y);
|
||||
|
||||
tmp.put(draggedID, n);
|
||||
|
||||
draggingWidget.setHidden(false);
|
||||
dragging = false;
|
||||
|
||||
runRebuild();
|
||||
}
|
||||
|
||||
private Widget currentWidget(java.awt.Point point)
|
||||
void increaseSize()
|
||||
{
|
||||
ImmutableSet<String> tmp = ImmutableSet.copyOf(notFilteredSpells);
|
||||
|
||||
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);
|
||||
final Widget scrolledWidget = currentWidget();
|
||||
|
||||
if (scrolledWidget == null || dragging)
|
||||
{
|
||||
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)
|
||||
{
|
||||
scrolledSpell.setX(0);
|
||||
@@ -635,63 +627,20 @@ public class SpellbookPlugin extends Plugin
|
||||
scrolledSpell.setX(clamp(scrolledSpell.getX() - 1, 0, FULL_WIDTH - trueSize(scrolledSpell)));
|
||||
scrolledSpell.setY(clamp(scrolledSpell.getY() - 1, 0, FULL_HEIGHT - trueSize(scrolledSpell)));
|
||||
|
||||
tmp.put(scrolledWidgetId, scrolledSpell);
|
||||
|
||||
runRebuild();
|
||||
}
|
||||
|
||||
void resetZoom(java.awt.Point point)
|
||||
void decreaseSize()
|
||||
{
|
||||
Widget clickedWidget = currentWidget(point);
|
||||
|
||||
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);
|
||||
final Widget scrolledWidget = currentWidget();
|
||||
|
||||
if (scrolledWidget == null || dragging)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int scrolledWidgetId = scrolledWidget.getId();
|
||||
|
||||
if (!spells.containsKey(scrolledWidgetId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Spell scrolledSpell = spells.get(scrolledWidgetId);
|
||||
final int scrolledWidgetId = scrolledWidget.getId();
|
||||
final Spell scrolledSpell = spells.get(scrolledWidgetId);
|
||||
|
||||
// People probably don't want to scroll on a single pixel
|
||||
if (trueSize(scrolledSpell) <= 5)
|
||||
@@ -700,33 +649,110 @@ public class SpellbookPlugin extends Plugin
|
||||
}
|
||||
|
||||
scrolledSpell.setSize(scrolledSpell.getSize() - 1);
|
||||
|
||||
if (scrolledSpell.getX() == -1 || scrolledSpell.getY() == -1)
|
||||
{
|
||||
scrolledSpell.setX(scrolledWidget.getRelativeX());
|
||||
scrolledSpell.setY(scrolledWidget.getRelativeY());
|
||||
}
|
||||
|
||||
scrolledSpell.setX(scrolledSpell.getX() + 1);
|
||||
scrolledSpell.setY(scrolledSpell.getY() + 1);
|
||||
|
||||
tmp.put(scrolledWidgetId, scrolledSpell);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
private void updateConfig()
|
||||
private static boolean isUnfiltered(final String spell, final Set<String> unfiltereds)
|
||||
{
|
||||
this.enableMobile = config.enableMobile();
|
||||
this.dragSpells = config.dragSpells();
|
||||
this.scroll = config.scroll();
|
||||
this.size = config.size();
|
||||
this.filter = config.filter();
|
||||
}
|
||||
for (final String str : unfiltereds)
|
||||
{
|
||||
boolean b;
|
||||
|
||||
private enum WordFilterMode
|
||||
{
|
||||
CONTAINS,
|
||||
EQUALS,
|
||||
STARTSWITH,
|
||||
ENDSWITH
|
||||
if (str.charAt(0) == '\"')
|
||||
{
|
||||
if (str.charAt(str.length() - 1) == '\"')
|
||||
{
|
||||
b = spell.equalsIgnoreCase(str.substring(1, str.length() - 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
b = StringUtils.startsWithIgnoreCase(spell, str.substring(1));
|
||||
}
|
||||
}
|
||||
else if (str.charAt(str.length() - 1) == '\"')
|
||||
{
|
||||
b = StringUtils.endsWithIgnoreCase(spell, StringUtils.chop(str));
|
||||
}
|
||||
else
|
||||
{
|
||||
b = StringUtils.containsIgnoreCase(spell, str);
|
||||
}
|
||||
|
||||
if (b)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ import net.runelite.api.VarClientInt;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.coords.WorldArea;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.vars.InterfaceTab;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
|
||||
|
||||
@@ -349,7 +350,7 @@ public class OverlayUtil
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.runelite.mixins;
|
||||
import net.runelite.api.Sprite;
|
||||
import java.util.Map;
|
||||
import net.runelite.api.mixins.Copy;
|
||||
import net.runelite.api.mixins.Inject;
|
||||
import net.runelite.api.mixins.Mixin;
|
||||
import net.runelite.api.mixins.Replace;
|
||||
import net.runelite.api.mixins.Shadow;
|
||||
@@ -36,4 +37,11 @@ public abstract class WidgetSpriteMixin implements RSWidget
|
||||
|
||||
return rs$getWidgetSprite(var1);
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public Sprite getSprite()
|
||||
{
|
||||
return getSprite(false);
|
||||
}
|
||||
}
|
||||
@@ -485,4 +485,11 @@ public interface RSWidget extends Widget
|
||||
@Import("onInvTransmit")
|
||||
@Override
|
||||
Object[] getOnInvTransmit();
|
||||
|
||||
@Import("containsMouse")
|
||||
@Override
|
||||
boolean containsMouse();
|
||||
|
||||
@Import("getSprite")
|
||||
RSSprite getSprite(boolean b);
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ public class ScriptEvent extends Node {
|
||||
@Export("args")
|
||||
Object[] args;
|
||||
@ObfuscatedName("w")
|
||||
@Export("boolean1")
|
||||
boolean boolean1;
|
||||
@Export("isMouseInputEvent")
|
||||
boolean isMouseInputEvent;
|
||||
@ObfuscatedName("e")
|
||||
@ObfuscatedSignature(
|
||||
signature = "Lhj;"
|
||||
|
||||
@@ -863,12 +863,12 @@ public class Widget extends Node {
|
||||
this.itemQuantities = new int[this.rawHeight * this.rawWidth];
|
||||
var4 = var1.readUnsignedByte();
|
||||
if (var4 == 1) {
|
||||
this.clickMask |= 268435456;
|
||||
this.clickMask |= 0x10000000;
|
||||
}
|
||||
|
||||
var5 = var1.readUnsignedByte();
|
||||
if (var5 == 1) {
|
||||
this.clickMask |= 1073741824;
|
||||
this.clickMask |= 0x40000000;
|
||||
}
|
||||
|
||||
var6 = var1.readUnsignedByte();
|
||||
@@ -878,7 +878,7 @@ public class Widget extends Node {
|
||||
|
||||
int var7 = var1.readUnsignedByte();
|
||||
if (var7 == 1) {
|
||||
this.clickMask |= 536870912;
|
||||
this.clickMask |= 0x20000000;
|
||||
}
|
||||
|
||||
this.paddingX = var1.readUnsignedByte();
|
||||
@@ -1036,7 +1036,7 @@ public class Widget extends Node {
|
||||
}
|
||||
|
||||
if (this.buttonType == 1 || this.buttonType == 4 || this.buttonType == 5) {
|
||||
this.clickMask |= 4194304;
|
||||
this.clickMask |= 0x400000;
|
||||
}
|
||||
|
||||
if (this.buttonType == 6) {
|
||||
|
||||
@@ -166,7 +166,7 @@ final class class2 implements class0 {
|
||||
if (var9.noClickThrough) {
|
||||
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()) {
|
||||
if (var26.boolean1) {
|
||||
if (var26.isMouseInputEvent) {
|
||||
var26.remove();
|
||||
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) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -324,7 +324,7 @@ final class class2 implements class0 {
|
||||
if (var9.hasListener) {
|
||||
if (var33 && Client.mouseWheelRotation != 0 && var9.onScroll != null) {
|
||||
ScriptEvent var29 = new ScriptEvent();
|
||||
var29.boolean1 = true;
|
||||
var29.isMouseInputEvent = true;
|
||||
var29.widget = var9;
|
||||
var29.mouseY = Client.mouseWheelRotation;
|
||||
var29.args = var9.onScroll;
|
||||
@@ -341,7 +341,7 @@ final class class2 implements class0 {
|
||||
var9.isClicked = true;
|
||||
if (var9.onClick != null) {
|
||||
ScriptEvent var29 = new ScriptEvent();
|
||||
var29.boolean1 = true;
|
||||
var29.isMouseInputEvent = true;
|
||||
var29.widget = var9;
|
||||
var29.mouseX = MouseHandler.MouseHandler_lastPressedX - var10;
|
||||
var29.mouseY = MouseHandler.MouseHandler_lastPressedY - var11;
|
||||
@@ -352,7 +352,7 @@ final class class2 implements class0 {
|
||||
|
||||
if (var9.isClicked && var34 && var9.onClickRepeat != null) {
|
||||
ScriptEvent var29 = new ScriptEvent();
|
||||
var29.boolean1 = true;
|
||||
var29.isMouseInputEvent = true;
|
||||
var29.widget = var9;
|
||||
var29.mouseX = MouseHandler.MouseHandler_x - var10;
|
||||
var29.mouseY = MouseHandler.MouseHandler_y - var11;
|
||||
@@ -364,7 +364,7 @@ final class class2 implements class0 {
|
||||
var9.isClicked = false;
|
||||
if (var9.onRelease != null) {
|
||||
ScriptEvent var29 = new ScriptEvent();
|
||||
var29.boolean1 = true;
|
||||
var29.isMouseInputEvent = true;
|
||||
var29.widget = var9;
|
||||
var29.mouseX = MouseHandler.MouseHandler_x - var10;
|
||||
var29.mouseY = MouseHandler.MouseHandler_y - var11;
|
||||
@@ -375,7 +375,7 @@ final class class2 implements class0 {
|
||||
|
||||
if (var34 && var9.onHold != null) {
|
||||
ScriptEvent var29 = new ScriptEvent();
|
||||
var29.boolean1 = true;
|
||||
var29.isMouseInputEvent = true;
|
||||
var29.widget = var9;
|
||||
var29.mouseX = MouseHandler.MouseHandler_x - var10;
|
||||
var29.mouseY = MouseHandler.MouseHandler_y - var11;
|
||||
@@ -387,7 +387,7 @@ final class class2 implements class0 {
|
||||
var9.containsMouse = true;
|
||||
if (var9.onMouseOver != null) {
|
||||
ScriptEvent var29 = new ScriptEvent();
|
||||
var29.boolean1 = true;
|
||||
var29.isMouseInputEvent = true;
|
||||
var29.widget = var9;
|
||||
var29.mouseX = MouseHandler.MouseHandler_x - var10;
|
||||
var29.mouseY = MouseHandler.MouseHandler_y - var11;
|
||||
@@ -398,7 +398,7 @@ final class class2 implements class0 {
|
||||
|
||||
if (var9.containsMouse && var33 && var9.onMouseRepeat != null) {
|
||||
ScriptEvent var29 = new ScriptEvent();
|
||||
var29.boolean1 = true;
|
||||
var29.isMouseInputEvent = true;
|
||||
var29.widget = var9;
|
||||
var29.mouseX = MouseHandler.MouseHandler_x - var10;
|
||||
var29.mouseY = MouseHandler.MouseHandler_y - var11;
|
||||
@@ -410,7 +410,7 @@ final class class2 implements class0 {
|
||||
var9.containsMouse = false;
|
||||
if (var9.onMouseLeave != null) {
|
||||
ScriptEvent var29 = new ScriptEvent();
|
||||
var29.boolean1 = true;
|
||||
var29.isMouseInputEvent = true;
|
||||
var29.widget = var9;
|
||||
var29.mouseX = MouseHandler.MouseHandler_x - var10;
|
||||
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) {
|
||||
for (ScriptEvent var28 = (ScriptEvent)Client.scriptEvents.last(); var28 != null; var28 = (ScriptEvent)Client.scriptEvents.previous()) {
|
||||
if (var28.boolean1) {
|
||||
if (var28.isMouseInputEvent) {
|
||||
var28.remove();
|
||||
var28.widget.containsMouse = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user