Merge pull request #3966 from Adam-/hook-inject-public
Add interface representing all callbacks the client does, and convert mixins to use it
This commit is contained in:
1
cache/pom.xml
vendored
1
cache/pom.xml
vendored
@@ -55,7 +55,6 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
<version>1.7.12</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
|
|||||||
@@ -47,7 +47,6 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
<version>1.7.12</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
|
|||||||
@@ -95,7 +95,6 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
<version>1.7.12</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.scribejava</groupId>
|
<groupId>com.github.scribejava</groupId>
|
||||||
|
|||||||
@@ -51,7 +51,6 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
<version>1.7.12</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
|
|||||||
7
pom.xml
7
pom.xml
@@ -147,6 +147,13 @@
|
|||||||
<artifactId>gson</artifactId>
|
<artifactId>gson</artifactId>
|
||||||
<version>2.8.5</version>
|
<version>2.8.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-parent</artifactId>
|
||||||
|
<version>1.2.3</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,6 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
<version>1.7.12</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
|
|||||||
@@ -39,7 +39,6 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
<version>1.7.21</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
|
|||||||
@@ -33,15 +33,30 @@ import javax.annotation.Nullable;
|
|||||||
import net.runelite.api.annotations.VisibleForDevtools;
|
import net.runelite.api.annotations.VisibleForDevtools;
|
||||||
import net.runelite.api.coords.LocalPoint;
|
import net.runelite.api.coords.LocalPoint;
|
||||||
import net.runelite.api.coords.WorldPoint;
|
import net.runelite.api.coords.WorldPoint;
|
||||||
|
import net.runelite.api.hooks.Callbacks;
|
||||||
import net.runelite.api.vars.AccountType;
|
import net.runelite.api.vars.AccountType;
|
||||||
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 org.slf4j.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the RuneScape client.
|
* Represents the RuneScape client.
|
||||||
*/
|
*/
|
||||||
public interface Client extends GameEngine
|
public interface Client extends GameEngine
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* The client invokes these callbacks to communicate to
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Callbacks getCallbacks();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve a global logger for the client.
|
||||||
|
* This is most useful for mixins which can't have their own.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Logger getLogger();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a list of all valid players from the player cache.
|
* Gets a list of all valid players from the player cache.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,84 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Adam <Adam@sigterm.info>
|
||||||
|
* 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.hooks;
|
||||||
|
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.awt.event.MouseWheelEvent;
|
||||||
|
import net.runelite.api.MainBufferProvider;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface of callbacks the injected client uses to send events
|
||||||
|
*/
|
||||||
|
public interface Callbacks
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Post an event. See the events in net.runelite.api.events
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
void post(Object event);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Post a deferred event, which gets delayed until the next cycle
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
void postDeferred(Object event);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called each client cycle
|
||||||
|
*/
|
||||||
|
void clientMainLoop();
|
||||||
|
|
||||||
|
void updateNpcs();
|
||||||
|
|
||||||
|
void drawRegion();
|
||||||
|
|
||||||
|
void drawAboveOverheads();
|
||||||
|
|
||||||
|
void draw(MainBufferProvider mainBufferProvider, Graphics graphics, int x, int y);
|
||||||
|
|
||||||
|
MouseEvent mousePressed(MouseEvent mouseEvent);
|
||||||
|
|
||||||
|
MouseEvent mouseReleased(MouseEvent mouseEvent);
|
||||||
|
|
||||||
|
MouseEvent mouseClicked(MouseEvent mouseEvent);
|
||||||
|
|
||||||
|
MouseEvent mouseEntered(MouseEvent mouseEvent);
|
||||||
|
|
||||||
|
MouseEvent mouseExited(MouseEvent mouseEvent);
|
||||||
|
|
||||||
|
MouseEvent mouseDragged(MouseEvent mouseEvent);
|
||||||
|
|
||||||
|
MouseEvent mouseMoved(MouseEvent mouseEvent);
|
||||||
|
|
||||||
|
MouseWheelEvent mouseWheelMoved(MouseWheelEvent event);
|
||||||
|
|
||||||
|
void keyPressed(KeyEvent keyEvent);
|
||||||
|
|
||||||
|
void keyReleased(KeyEvent keyEvent);
|
||||||
|
|
||||||
|
void keyTyped(KeyEvent keyEvent);
|
||||||
|
}
|
||||||
@@ -36,8 +36,6 @@
|
|||||||
<name>RuneLite Client</name>
|
<name>RuneLite Client</name>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<slf4j.version>1.7.12</slf4j.version>
|
|
||||||
<logback.version>1.2.3</logback.version>
|
|
||||||
<guice.version>4.1.0</guice.version>
|
<guice.version>4.1.0</guice.version>
|
||||||
|
|
||||||
<jarsigner.skip>true</jarsigner.skip>
|
<jarsigner.skip>true</jarsigner.skip>
|
||||||
@@ -47,12 +45,10 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
<version>${slf4j.version}</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ch.qos.logback</groupId>
|
<groupId>ch.qos.logback</groupId>
|
||||||
<artifactId>logback-classic</artifactId>
|
<artifactId>logback-classic</artifactId>
|
||||||
<version>${logback.version}</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.sf.jopt-simple</groupId>
|
<groupId>net.sf.jopt-simple</groupId>
|
||||||
|
|||||||
@@ -217,6 +217,9 @@ public class RuneLite
|
|||||||
if (!isOutdated)
|
if (!isOutdated)
|
||||||
{
|
{
|
||||||
this.client = (Client) client;
|
this.client = (Client) client;
|
||||||
|
|
||||||
|
// Inject members into client
|
||||||
|
injector.injectMembers(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize UI
|
// Initialize UI
|
||||||
|
|||||||
@@ -28,12 +28,15 @@ import com.google.common.eventbus.EventBus;
|
|||||||
import com.google.common.eventbus.SubscriberExceptionContext;
|
import com.google.common.eventbus.SubscriberExceptionContext;
|
||||||
import com.google.inject.AbstractModule;
|
import com.google.inject.AbstractModule;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
|
import com.google.inject.name.Names;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.hooks.Callbacks;
|
||||||
import net.runelite.client.account.SessionManager;
|
import net.runelite.client.account.SessionManager;
|
||||||
|
import net.runelite.client.callback.Hooks;
|
||||||
import net.runelite.client.chat.ChatMessageManager;
|
import net.runelite.client.chat.ChatMessageManager;
|
||||||
import net.runelite.client.config.ChatColorConfig;
|
import net.runelite.client.config.ChatColorConfig;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
@@ -42,7 +45,10 @@ import net.runelite.client.game.ItemManager;
|
|||||||
import net.runelite.client.menus.MenuManager;
|
import net.runelite.client.menus.MenuManager;
|
||||||
import net.runelite.client.plugins.PluginManager;
|
import net.runelite.client.plugins.PluginManager;
|
||||||
import net.runelite.client.task.Scheduler;
|
import net.runelite.client.task.Scheduler;
|
||||||
|
import net.runelite.client.util.DeferredEventBus;
|
||||||
import net.runelite.client.util.QueryRunner;
|
import net.runelite.client.util.QueryRunner;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class RuneLiteModule extends AbstractModule
|
public class RuneLiteModule extends AbstractModule
|
||||||
@@ -59,6 +65,16 @@ public class RuneLiteModule extends AbstractModule
|
|||||||
bind(PluginManager.class);
|
bind(PluginManager.class);
|
||||||
bind(RuneLiteProperties.class);
|
bind(RuneLiteProperties.class);
|
||||||
bind(SessionManager.class);
|
bind(SessionManager.class);
|
||||||
|
|
||||||
|
bind(Callbacks.class).to(Hooks.class);
|
||||||
|
|
||||||
|
bind(EventBus.class)
|
||||||
|
.annotatedWith(Names.named("Deferred EventBus"))
|
||||||
|
.to(DeferredEventBus.class);
|
||||||
|
|
||||||
|
bind(Logger.class)
|
||||||
|
.annotatedWith(Names.named("Core Logger"))
|
||||||
|
.toInstance(LoggerFactory.getLogger(RuneLite.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
|||||||
@@ -38,11 +38,15 @@ import java.awt.event.MouseEvent;
|
|||||||
import java.awt.event.MouseWheelEvent;
|
import java.awt.event.MouseWheelEvent;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.awt.image.VolatileImage;
|
import java.awt.image.VolatileImage;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.MainBufferProvider;
|
import net.runelite.api.MainBufferProvider;
|
||||||
import net.runelite.api.RenderOverview;
|
import net.runelite.api.RenderOverview;
|
||||||
import net.runelite.api.WorldMapManager;
|
import net.runelite.api.WorldMapManager;
|
||||||
import net.runelite.api.events.GameTick;
|
import net.runelite.api.events.GameTick;
|
||||||
|
import net.runelite.api.hooks.Callbacks;
|
||||||
import net.runelite.api.widgets.Widget;
|
import net.runelite.api.widgets.Widget;
|
||||||
import static net.runelite.api.widgets.WidgetInfo.WORLD_MAP_VIEW;
|
import static net.runelite.api.widgets.WidgetInfo.WORLD_MAP_VIEW;
|
||||||
import net.runelite.client.Notifier;
|
import net.runelite.client.Notifier;
|
||||||
@@ -57,54 +61,86 @@ import net.runelite.client.ui.overlay.OverlayLayer;
|
|||||||
import net.runelite.client.ui.overlay.OverlayRenderer;
|
import net.runelite.client.ui.overlay.OverlayRenderer;
|
||||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||||
import net.runelite.client.util.DeferredEventBus;
|
import net.runelite.client.util.DeferredEventBus;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class contains field required for mixins and runelite hooks to work.
|
* This class contains field required for mixins and runelite hooks to work.
|
||||||
* All remaining method hooks in this class are performance-critical or contain client-specific logic and so they
|
* All remaining method hooks in this class are performance-critical or contain client-specific logic and so they
|
||||||
* can't just be placed in mixins or sent through event bus.
|
* can't just be placed in mixins or sent through event bus.
|
||||||
*/
|
*/
|
||||||
public class Hooks
|
@Singleton
|
||||||
|
@Slf4j
|
||||||
|
public class Hooks implements Callbacks
|
||||||
{
|
{
|
||||||
// must be public as the mixins use it
|
|
||||||
public static final Logger log = LoggerFactory.getLogger(Hooks.class);
|
|
||||||
|
|
||||||
private static final long CHECK = 600; // ms - how often to run checks
|
private static final long CHECK = 600; // ms - how often to run checks
|
||||||
|
|
||||||
private static final Injector injector = RuneLite.getInjector();
|
private static final Injector injector = RuneLite.getInjector();
|
||||||
private static final Client client = injector.getInstance(Client.class);
|
private static final Client client = injector.getInstance(Client.class);
|
||||||
public static final EventBus eventBus = injector.getInstance(EventBus.class); // symbol must match mixin Hook
|
|
||||||
private static final DeferredEventBus _deferredEventBus = injector.getInstance(DeferredEventBus.class);
|
|
||||||
public static final EventBus deferredEventBus = _deferredEventBus; // symbol must match mixin Hook
|
|
||||||
private static final Scheduler scheduler = injector.getInstance(Scheduler.class);
|
|
||||||
private static final InfoBoxManager infoBoxManager = injector.getInstance(InfoBoxManager.class);
|
|
||||||
private static final ChatMessageManager chatMessageManager = injector.getInstance(ChatMessageManager.class);
|
|
||||||
private static final OverlayRenderer renderer = injector.getInstance(OverlayRenderer.class);
|
private static final OverlayRenderer renderer = injector.getInstance(OverlayRenderer.class);
|
||||||
private static final MouseManager mouseManager = injector.getInstance(MouseManager.class);
|
|
||||||
private static final KeyManager keyManager = injector.getInstance(KeyManager.class);
|
|
||||||
private static final ClientThread clientThread = injector.getInstance(ClientThread.class);
|
|
||||||
private static final GameTick tick = new GameTick();
|
|
||||||
private static final DrawManager renderHooks = injector.getInstance(DrawManager.class);
|
|
||||||
private static final Notifier notifier = injector.getInstance(Notifier.class);
|
|
||||||
private static final ClientUI clientUi = injector.getInstance(ClientUI.class);
|
|
||||||
|
|
||||||
private static Dimension lastStretchedDimensions;
|
private static final GameTick GAME_TICK = new GameTick();
|
||||||
private static VolatileImage stretchedImage;
|
|
||||||
private static Graphics2D stretchedGraphics;
|
|
||||||
|
|
||||||
private static long lastCheck;
|
@Inject
|
||||||
private static boolean shouldProcessGameTick;
|
private EventBus eventBus;
|
||||||
|
|
||||||
public static void clientMainLoop()
|
@Inject
|
||||||
|
private DeferredEventBus deferredEventBus;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Scheduler scheduler;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private InfoBoxManager infoBoxManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ChatMessageManager chatMessageManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private MouseManager mouseManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private KeyManager keyManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ClientThread clientThread;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private DrawManager drawManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Notifier notifier;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ClientUI clientUi;
|
||||||
|
|
||||||
|
private Dimension lastStretchedDimensions;
|
||||||
|
private VolatileImage stretchedImage;
|
||||||
|
private Graphics2D stretchedGraphics;
|
||||||
|
|
||||||
|
private long lastCheck;
|
||||||
|
private boolean shouldProcessGameTick;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void post(Object event)
|
||||||
|
{
|
||||||
|
eventBus.post(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postDeferred(Object event)
|
||||||
|
{
|
||||||
|
deferredEventBus.post(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clientMainLoop()
|
||||||
{
|
{
|
||||||
if (shouldProcessGameTick)
|
if (shouldProcessGameTick)
|
||||||
{
|
{
|
||||||
shouldProcessGameTick = false;
|
shouldProcessGameTick = false;
|
||||||
|
|
||||||
_deferredEventBus.replay();
|
deferredEventBus.replay();
|
||||||
|
|
||||||
eventBus.post(tick);
|
eventBus.post(GAME_TICK);
|
||||||
|
|
||||||
int tick = client.getTickCount();
|
int tick = client.getTickCount();
|
||||||
client.setTickCount(tick + 1);
|
client.setTickCount(tick + 1);
|
||||||
@@ -147,7 +183,7 @@ public class Hooks
|
|||||||
* data to be garbage collecged, and causes the map data from disk each time
|
* data to be garbage collecged, and causes the map data from disk each time
|
||||||
* is it opened.
|
* is it opened.
|
||||||
*/
|
*/
|
||||||
private static void checkWorldMap()
|
private void checkWorldMap()
|
||||||
{
|
{
|
||||||
Widget widget = client.getWidget(WORLD_MAP_VIEW);
|
Widget widget = client.getWidget(WORLD_MAP_VIEW);
|
||||||
|
|
||||||
@@ -172,62 +208,74 @@ public class Hooks
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MouseEvent mousePressed(MouseEvent mouseEvent)
|
@Override
|
||||||
|
public MouseEvent mousePressed(MouseEvent mouseEvent)
|
||||||
{
|
{
|
||||||
return mouseManager.processMousePressed(mouseEvent);
|
return mouseManager.processMousePressed(mouseEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MouseEvent mouseReleased(MouseEvent mouseEvent)
|
@Override
|
||||||
|
public MouseEvent mouseReleased(MouseEvent mouseEvent)
|
||||||
{
|
{
|
||||||
return mouseManager.processMouseReleased(mouseEvent);
|
return mouseManager.processMouseReleased(mouseEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MouseEvent mouseClicked(MouseEvent mouseEvent)
|
@Override
|
||||||
|
public MouseEvent mouseClicked(MouseEvent mouseEvent)
|
||||||
{
|
{
|
||||||
return mouseManager.processMouseClicked(mouseEvent);
|
return mouseManager.processMouseClicked(mouseEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MouseEvent mouseEntered(MouseEvent mouseEvent)
|
@Override
|
||||||
|
public MouseEvent mouseEntered(MouseEvent mouseEvent)
|
||||||
{
|
{
|
||||||
return mouseManager.processMouseEntered(mouseEvent);
|
return mouseManager.processMouseEntered(mouseEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MouseEvent mouseExited(MouseEvent mouseEvent)
|
@Override
|
||||||
|
public MouseEvent mouseExited(MouseEvent mouseEvent)
|
||||||
{
|
{
|
||||||
return mouseManager.processMouseExited(mouseEvent);
|
return mouseManager.processMouseExited(mouseEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MouseEvent mouseDragged(MouseEvent mouseEvent)
|
@Override
|
||||||
|
public MouseEvent mouseDragged(MouseEvent mouseEvent)
|
||||||
{
|
{
|
||||||
return mouseManager.processMouseDragged(mouseEvent);
|
return mouseManager.processMouseDragged(mouseEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MouseEvent mouseMoved(MouseEvent mouseEvent)
|
@Override
|
||||||
|
public MouseEvent mouseMoved(MouseEvent mouseEvent)
|
||||||
{
|
{
|
||||||
return mouseManager.processMouseMoved(mouseEvent);
|
return mouseManager.processMouseMoved(mouseEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MouseWheelEvent mouseWheelMoved(MouseWheelEvent event)
|
@Override
|
||||||
|
public MouseWheelEvent mouseWheelMoved(MouseWheelEvent event)
|
||||||
{
|
{
|
||||||
return mouseManager.processMouseWheelMoved(event);
|
return mouseManager.processMouseWheelMoved(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void keyPressed(KeyEvent keyEvent)
|
@Override
|
||||||
|
public void keyPressed(KeyEvent keyEvent)
|
||||||
{
|
{
|
||||||
keyManager.processKeyPressed(keyEvent);
|
keyManager.processKeyPressed(keyEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void keyReleased(KeyEvent keyEvent)
|
@Override
|
||||||
|
public void keyReleased(KeyEvent keyEvent)
|
||||||
{
|
{
|
||||||
keyManager.processKeyReleased(keyEvent);
|
keyManager.processKeyReleased(keyEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void keyTyped(KeyEvent keyEvent)
|
@Override
|
||||||
|
public void keyTyped(KeyEvent keyEvent)
|
||||||
{
|
{
|
||||||
keyManager.processKeyTyped(keyEvent);
|
keyManager.processKeyTyped(keyEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void draw(MainBufferProvider mainBufferProvider, Graphics graphics, int x, int y)
|
@Override
|
||||||
|
public void draw(MainBufferProvider mainBufferProvider, Graphics graphics, int x, int y)
|
||||||
{
|
{
|
||||||
if (graphics == null)
|
if (graphics == null)
|
||||||
{
|
{
|
||||||
@@ -278,9 +326,9 @@ public class Hooks
|
|||||||
}
|
}
|
||||||
|
|
||||||
stretchedGraphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
|
stretchedGraphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
|
||||||
client.isStretchedFast()
|
client.isStretchedFast()
|
||||||
? RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR
|
? RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR
|
||||||
: RenderingHints.VALUE_INTERPOLATION_BILINEAR);
|
: RenderingHints.VALUE_INTERPOLATION_BILINEAR);
|
||||||
stretchedGraphics.drawImage(image, 0, 0, stretchedDimensions.width, stretchedDimensions.height, null);
|
stretchedGraphics.drawImage(image, 0, 0, stretchedDimensions.width, stretchedDimensions.height, null);
|
||||||
|
|
||||||
image = stretchedImage;
|
image = stretchedImage;
|
||||||
@@ -289,14 +337,15 @@ public class Hooks
|
|||||||
// Draw the image onto the game canvas
|
// Draw the image onto the game canvas
|
||||||
graphics.drawImage(image, 0, 0, client.getCanvas());
|
graphics.drawImage(image, 0, 0, client.getCanvas());
|
||||||
|
|
||||||
renderHooks.processDrawComplete(image);
|
drawManager.processDrawComplete(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawRegion()
|
@Override
|
||||||
|
public void drawRegion()
|
||||||
{
|
{
|
||||||
MainBufferProvider bufferProvider = (MainBufferProvider) client.getBufferProvider();
|
MainBufferProvider bufferProvider = (MainBufferProvider) client.getBufferProvider();
|
||||||
BufferedImage image = (BufferedImage) bufferProvider.getImage();
|
BufferedImage image = (BufferedImage) bufferProvider.getImage();
|
||||||
Graphics2D graphics2d = (Graphics2D) image.getGraphics();
|
Graphics2D graphics2d = image.createGraphics();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -306,13 +355,18 @@ public class Hooks
|
|||||||
{
|
{
|
||||||
log.warn("Error during overlay rendering", ex);
|
log.warn("Error during overlay rendering", ex);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
graphics2d.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawAboveOverheads()
|
@Override
|
||||||
|
public void drawAboveOverheads()
|
||||||
{
|
{
|
||||||
MainBufferProvider bufferProvider = (MainBufferProvider) client.getBufferProvider();
|
MainBufferProvider bufferProvider = (MainBufferProvider) client.getBufferProvider();
|
||||||
BufferedImage image = (BufferedImage) bufferProvider.getImage();
|
BufferedImage image = (BufferedImage) bufferProvider.getImage();
|
||||||
Graphics2D graphics2d = (Graphics2D) image.getGraphics();
|
Graphics2D graphics2d = image.createGraphics();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -322,13 +376,17 @@ public class Hooks
|
|||||||
{
|
{
|
||||||
log.warn("Error during overlay rendering", ex);
|
log.warn("Error during overlay rendering", ex);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
graphics2d.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void drawAfterWidgets()
|
public static void drawAfterWidgets()
|
||||||
{
|
{
|
||||||
MainBufferProvider bufferProvider = (MainBufferProvider) client.getBufferProvider();
|
MainBufferProvider bufferProvider = (MainBufferProvider) client.getBufferProvider();
|
||||||
BufferedImage image = (BufferedImage) bufferProvider.getImage();
|
BufferedImage image = (BufferedImage) bufferProvider.getImage();
|
||||||
Graphics2D graphics2d = (Graphics2D) image.getGraphics();
|
Graphics2D graphics2d = image.createGraphics();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -338,9 +396,14 @@ public class Hooks
|
|||||||
{
|
{
|
||||||
log.warn("Error during overlay rendering", ex);
|
log.warn("Error during overlay rendering", ex);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
graphics2d.dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void updateNpcs()
|
@Override
|
||||||
|
public void updateNpcs()
|
||||||
{
|
{
|
||||||
// The NPC update event seem to run every server tick,
|
// The NPC update event seem to run every server tick,
|
||||||
// but having the game tick event after all packets
|
// but having the game tick event after all packets
|
||||||
|
|||||||
@@ -39,7 +39,6 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
<version>1.7.21</version>
|
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -53,6 +52,12 @@
|
|||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.inject</groupId>
|
||||||
|
<artifactId>javax.inject</artifactId>
|
||||||
|
<version>1</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -1,126 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2018, Adam <Adam@sigterm.info>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
||||||
* list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
||||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
package net.runelite.client.callback;
|
|
||||||
|
|
||||||
import com.google.common.eventbus.EventBus;
|
|
||||||
import java.awt.Graphics;
|
|
||||||
import net.runelite.api.MainBufferProvider;
|
|
||||||
import java.awt.event.KeyEvent;
|
|
||||||
import java.awt.event.MouseEvent;
|
|
||||||
import java.awt.event.MouseWheelEvent;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dummy class to make the mixins to compile.
|
|
||||||
*
|
|
||||||
* @author Adam
|
|
||||||
*/
|
|
||||||
public class Hooks
|
|
||||||
{
|
|
||||||
public static Logger log;
|
|
||||||
|
|
||||||
public static EventBus eventBus;
|
|
||||||
public static EventBus deferredEventBus;
|
|
||||||
|
|
||||||
public static void clientMainLoop()
|
|
||||||
{
|
|
||||||
throw new IllegalStateException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void draw(MainBufferProvider mainBufferProvider, Graphics graphics, int x, int y)
|
|
||||||
{
|
|
||||||
throw new IllegalStateException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void drawAboveOverheads()
|
|
||||||
{
|
|
||||||
throw new IllegalStateException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void drawRegion()
|
|
||||||
{
|
|
||||||
throw new IllegalStateException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MouseEvent mousePressed(MouseEvent mouseEvent)
|
|
||||||
{
|
|
||||||
throw new RuntimeException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MouseEvent mouseReleased(MouseEvent mouseEvent)
|
|
||||||
{
|
|
||||||
throw new RuntimeException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MouseEvent mouseClicked(MouseEvent mouseEvent)
|
|
||||||
{
|
|
||||||
throw new RuntimeException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MouseEvent mouseEntered(MouseEvent mouseEvent)
|
|
||||||
{
|
|
||||||
throw new RuntimeException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MouseEvent mouseExited(MouseEvent mouseEvent)
|
|
||||||
{
|
|
||||||
throw new RuntimeException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MouseEvent mouseDragged(MouseEvent mouseEvent)
|
|
||||||
{
|
|
||||||
throw new RuntimeException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MouseEvent mouseMoved(MouseEvent mouseEvent)
|
|
||||||
{
|
|
||||||
throw new RuntimeException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static MouseWheelEvent mouseWheelMoved(MouseWheelEvent event)
|
|
||||||
{
|
|
||||||
throw new RuntimeException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void keyPressed(KeyEvent keyEvent)
|
|
||||||
{
|
|
||||||
throw new RuntimeException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void keyReleased(KeyEvent keyEvent)
|
|
||||||
{
|
|
||||||
throw new RuntimeException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void keyTyped(KeyEvent keyEvent)
|
|
||||||
{
|
|
||||||
throw new RuntimeException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void updateNpcs()
|
|
||||||
{
|
|
||||||
throw new RuntimeException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -28,17 +28,21 @@ import net.runelite.api.coords.LocalPoint;
|
|||||||
import net.runelite.api.events.GraphicsObjectCreated;
|
import net.runelite.api.events.GraphicsObjectCreated;
|
||||||
import net.runelite.api.mixins.Inject;
|
import net.runelite.api.mixins.Inject;
|
||||||
import net.runelite.api.mixins.Mixin;
|
import net.runelite.api.mixins.Mixin;
|
||||||
import static net.runelite.client.callback.Hooks.eventBus;
|
import net.runelite.api.mixins.Shadow;
|
||||||
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSGraphicsObject;
|
import net.runelite.rs.api.RSGraphicsObject;
|
||||||
|
|
||||||
@Mixin(RSGraphicsObject.class)
|
@Mixin(RSGraphicsObject.class)
|
||||||
public abstract class GraphicsObjectMixin implements RSGraphicsObject
|
public abstract class GraphicsObjectMixin implements RSGraphicsObject
|
||||||
{
|
{
|
||||||
|
@Shadow("clientInstance")
|
||||||
|
private static RSClient client;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
GraphicsObjectMixin()
|
GraphicsObjectMixin()
|
||||||
{
|
{
|
||||||
final GraphicsObjectCreated event = new GraphicsObjectCreated(this);
|
final GraphicsObjectCreated event = new GraphicsObjectCreated(this);
|
||||||
eventBus.post(event);
|
client.getCallbacks().post(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -27,13 +27,16 @@ package net.runelite.mixins;
|
|||||||
import net.runelite.api.mixins.Copy;
|
import net.runelite.api.mixins.Copy;
|
||||||
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.client.callback.Hooks;
|
import net.runelite.api.mixins.Shadow;
|
||||||
import net.runelite.rs.api.RSClient;
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSRunException;
|
import net.runelite.rs.api.RSRunException;
|
||||||
|
|
||||||
@Mixin(RSClient.class)
|
@Mixin(RSClient.class)
|
||||||
public abstract class ProcessClientErrorMixin implements RSClient
|
public abstract class ProcessClientErrorMixin implements RSClient
|
||||||
{
|
{
|
||||||
|
@Shadow("clientInstance")
|
||||||
|
private static RSClient client;
|
||||||
|
|
||||||
@Copy("processClientError")
|
@Copy("processClientError")
|
||||||
static void rs$processClientError(String string, Throwable throwable)
|
static void rs$processClientError(String string, Throwable throwable)
|
||||||
{
|
{
|
||||||
@@ -52,7 +55,7 @@ public abstract class ProcessClientErrorMixin implements RSClient
|
|||||||
throwableToScan = ((RSRunException) throwable).getParent();
|
throwableToScan = ((RSRunException) throwable).getParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
Hooks.log.error("Game crash", throwableToScan);
|
client.getLogger().error("Game crash", throwableToScan);
|
||||||
|
|
||||||
StackTraceElement[] stackTrace = throwableToScan.getStackTrace();
|
StackTraceElement[] stackTrace = throwableToScan.getStackTrace();
|
||||||
|
|
||||||
|
|||||||
@@ -47,8 +47,6 @@ import net.runelite.api.mixins.Inject;
|
|||||||
import net.runelite.api.mixins.MethodHook;
|
import net.runelite.api.mixins.MethodHook;
|
||||||
import net.runelite.api.mixins.Mixin;
|
import net.runelite.api.mixins.Mixin;
|
||||||
import net.runelite.api.mixins.Shadow;
|
import net.runelite.api.mixins.Shadow;
|
||||||
import static net.runelite.client.callback.Hooks.eventBus;
|
|
||||||
import static net.runelite.client.callback.Hooks.log;
|
|
||||||
import net.runelite.rs.api.RSActor;
|
import net.runelite.rs.api.RSActor;
|
||||||
import net.runelite.rs.api.RSClient;
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSCombatInfo1;
|
import net.runelite.rs.api.RSCombatInfo1;
|
||||||
@@ -189,7 +187,7 @@ public abstract class RSActorMixin implements RSActor
|
|||||||
{
|
{
|
||||||
AnimationChanged animationChange = new AnimationChanged();
|
AnimationChanged animationChange = new AnimationChanged();
|
||||||
animationChange.setActor(this);
|
animationChange.setActor(this);
|
||||||
eventBus.post(animationChange);
|
client.getCallbacks().post(animationChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
@FieldHook("graphic")
|
@FieldHook("graphic")
|
||||||
@@ -198,7 +196,7 @@ public abstract class RSActorMixin implements RSActor
|
|||||||
{
|
{
|
||||||
GraphicChanged graphicChanged = new GraphicChanged();
|
GraphicChanged graphicChanged = new GraphicChanged();
|
||||||
graphicChanged.setActor(this);
|
graphicChanged.setActor(this);
|
||||||
eventBus.post(graphicChanged);
|
client.getCallbacks().post(graphicChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@@ -242,10 +240,10 @@ public abstract class RSActorMixin implements RSActor
|
|||||||
{
|
{
|
||||||
if (this == client.getLocalPlayer())
|
if (this == client.getLocalPlayer())
|
||||||
{
|
{
|
||||||
log.debug("You died!");
|
client.getLogger().debug("You died!");
|
||||||
|
|
||||||
LocalPlayerDeath event = new LocalPlayerDeath();
|
LocalPlayerDeath event = new LocalPlayerDeath();
|
||||||
eventBus.post(event);
|
client.getCallbacks().post(event);
|
||||||
}
|
}
|
||||||
else if (this instanceof RSNPC)
|
else if (this instanceof RSNPC)
|
||||||
{
|
{
|
||||||
@@ -274,6 +272,6 @@ public abstract class RSActorMixin implements RSActor
|
|||||||
final HitsplatApplied event = new HitsplatApplied();
|
final HitsplatApplied event = new HitsplatApplied();
|
||||||
event.setActor(this);
|
event.setActor(this);
|
||||||
event.setHitsplat(hitsplat);
|
event.setHitsplat(hitsplat);
|
||||||
eventBus.post(event);
|
client.getCallbacks().post(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.inject.Named;
|
||||||
import net.runelite.api.ChatMessageType;
|
import net.runelite.api.ChatMessageType;
|
||||||
import net.runelite.api.ClanMember;
|
import net.runelite.api.ClanMember;
|
||||||
import net.runelite.api.Friend;
|
import net.runelite.api.Friend;
|
||||||
@@ -81,6 +82,7 @@ import net.runelite.api.events.ResizeableChanged;
|
|||||||
import net.runelite.api.events.UsernameChanged;
|
import net.runelite.api.events.UsernameChanged;
|
||||||
import net.runelite.api.events.VarbitChanged;
|
import net.runelite.api.events.VarbitChanged;
|
||||||
import net.runelite.api.events.WidgetLoaded;
|
import net.runelite.api.events.WidgetLoaded;
|
||||||
|
import net.runelite.api.hooks.Callbacks;
|
||||||
import net.runelite.api.mixins.Copy;
|
import net.runelite.api.mixins.Copy;
|
||||||
import net.runelite.api.mixins.FieldHook;
|
import net.runelite.api.mixins.FieldHook;
|
||||||
import net.runelite.api.mixins.Inject;
|
import net.runelite.api.mixins.Inject;
|
||||||
@@ -91,10 +93,6 @@ import net.runelite.api.mixins.Shadow;
|
|||||||
import net.runelite.api.vars.AccountType;
|
import net.runelite.api.vars.AccountType;
|
||||||
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 net.runelite.client.callback.Hooks;
|
|
||||||
import static net.runelite.client.callback.Hooks.deferredEventBus;
|
|
||||||
import static net.runelite.client.callback.Hooks.eventBus;
|
|
||||||
import static net.runelite.client.callback.Hooks.log;
|
|
||||||
import net.runelite.rs.api.RSClanMemberManager;
|
import net.runelite.rs.api.RSClanMemberManager;
|
||||||
import net.runelite.rs.api.RSClient;
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSDeque;
|
import net.runelite.rs.api.RSDeque;
|
||||||
@@ -108,6 +106,7 @@ import net.runelite.rs.api.RSName;
|
|||||||
import net.runelite.rs.api.RSNameable;
|
import net.runelite.rs.api.RSNameable;
|
||||||
import net.runelite.rs.api.RSPlayer;
|
import net.runelite.rs.api.RSPlayer;
|
||||||
import net.runelite.rs.api.RSWidget;
|
import net.runelite.rs.api.RSWidget;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
@Mixin(RSClient.class)
|
@Mixin(RSClient.class)
|
||||||
public abstract class RSClientMixin implements RSClient
|
public abstract class RSClientMixin implements RSClient
|
||||||
@@ -115,6 +114,15 @@ public abstract class RSClientMixin implements RSClient
|
|||||||
@Shadow("clientInstance")
|
@Shadow("clientInstance")
|
||||||
private static RSClient client;
|
private static RSClient client;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@javax.inject.Inject
|
||||||
|
private Callbacks callbacks;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@javax.inject.Inject
|
||||||
|
@Named("Core Logger")
|
||||||
|
private Logger logger;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private static int tickCount;
|
private static int tickCount;
|
||||||
|
|
||||||
@@ -139,6 +147,20 @@ public abstract class RSClientMixin implements RSClient
|
|||||||
@Inject
|
@Inject
|
||||||
private static int oldMenuEntryCount;
|
private static int oldMenuEntryCount;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@Override
|
||||||
|
public Callbacks getCallbacks()
|
||||||
|
{
|
||||||
|
return callbacks;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@Override
|
||||||
|
public Logger getLogger()
|
||||||
|
{
|
||||||
|
return logger;
|
||||||
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Override
|
@Override
|
||||||
public boolean isInterpolatePlayerAnimations()
|
public boolean isInterpolatePlayerAnimations()
|
||||||
@@ -512,7 +534,7 @@ public abstract class RSClientMixin implements RSClient
|
|||||||
client.getMenuActionParams1()[newCount - 1]
|
client.getMenuActionParams1()[newCount - 1]
|
||||||
);
|
);
|
||||||
|
|
||||||
eventBus.post(event);
|
client.getCallbacks().post(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -645,7 +667,7 @@ public abstract class RSClientMixin implements RSClient
|
|||||||
{
|
{
|
||||||
DraggingWidgetChanged draggingWidgetChanged = new DraggingWidgetChanged();
|
DraggingWidgetChanged draggingWidgetChanged = new DraggingWidgetChanged();
|
||||||
draggingWidgetChanged.setDraggingWidget(client.isDraggingWidget());
|
draggingWidgetChanged.setDraggingWidget(client.isDraggingWidget());
|
||||||
eventBus.post(draggingWidgetChanged);
|
client.getCallbacks().post(draggingWidgetChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@@ -683,7 +705,7 @@ public abstract class RSClientMixin implements RSClient
|
|||||||
{
|
{
|
||||||
WidgetLoaded event = new WidgetLoaded();
|
WidgetLoaded event = new WidgetLoaded();
|
||||||
event.setGroupId(groupId);
|
event.setGroupId(groupId);
|
||||||
eventBus.post(event);
|
client.getCallbacks().post(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -721,7 +743,7 @@ public abstract class RSClientMixin implements RSClient
|
|||||||
{
|
{
|
||||||
Skill updatedSkill = possibleSkills[idx];
|
Skill updatedSkill = possibleSkills[idx];
|
||||||
experienceChanged.setSkill(updatedSkill);
|
experienceChanged.setSkill(updatedSkill);
|
||||||
eventBus.post(experienceChanged);
|
client.getCallbacks().post(experienceChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -736,7 +758,7 @@ public abstract class RSClientMixin implements RSClient
|
|||||||
Skill updatedSkill = skills[idx];
|
Skill updatedSkill = skills[idx];
|
||||||
BoostedLevelChanged boostedLevelChanged = new BoostedLevelChanged();
|
BoostedLevelChanged boostedLevelChanged = new BoostedLevelChanged();
|
||||||
boostedLevelChanged.setSkill(updatedSkill);
|
boostedLevelChanged.setSkill(updatedSkill);
|
||||||
eventBus.post(boostedLevelChanged);
|
client.getCallbacks().post(boostedLevelChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -755,7 +777,7 @@ public abstract class RSClientMixin implements RSClient
|
|||||||
|
|
||||||
PlayerMenuOptionsChanged optionsChanged = new PlayerMenuOptionsChanged();
|
PlayerMenuOptionsChanged optionsChanged = new PlayerMenuOptionsChanged();
|
||||||
optionsChanged.setIndex(idx);
|
optionsChanged.setIndex(idx);
|
||||||
eventBus.post(optionsChanged);
|
client.getCallbacks().post(optionsChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
@FieldHook("gameState")
|
@FieldHook("gameState")
|
||||||
@@ -764,7 +786,7 @@ public abstract class RSClientMixin implements RSClient
|
|||||||
{
|
{
|
||||||
GameStateChanged gameStateChange = new GameStateChanged();
|
GameStateChanged gameStateChange = new GameStateChanged();
|
||||||
gameStateChange.setGameState(client.getGameState());
|
gameStateChange.setGameState(client.getGameState());
|
||||||
eventBus.post(gameStateChange);
|
client.getCallbacks().post(gameStateChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -783,7 +805,7 @@ public abstract class RSClientMixin implements RSClient
|
|||||||
{
|
{
|
||||||
npc.setIndex(idx);
|
npc.setIndex(idx);
|
||||||
|
|
||||||
deferredEventBus.post(new NpcSpawned(npc));
|
client.getCallbacks().postDeferred(new NpcSpawned(npc));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -803,11 +825,11 @@ public abstract class RSClientMixin implements RSClient
|
|||||||
|
|
||||||
if (oldPlayer != null)
|
if (oldPlayer != null)
|
||||||
{
|
{
|
||||||
eventBus.post(new PlayerDespawned(oldPlayer));
|
client.getCallbacks().post(new PlayerDespawned(oldPlayer));
|
||||||
}
|
}
|
||||||
if (player != null)
|
if (player != null)
|
||||||
{
|
{
|
||||||
deferredEventBus.post(new PlayerSpawned(player));
|
client.getCallbacks().postDeferred(new PlayerSpawned(player));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -830,7 +852,7 @@ public abstract class RSClientMixin implements RSClient
|
|||||||
GrandExchangeOfferChanged offerChangedEvent = new GrandExchangeOfferChanged();
|
GrandExchangeOfferChanged offerChangedEvent = new GrandExchangeOfferChanged();
|
||||||
offerChangedEvent.setOffer(internalOffer);
|
offerChangedEvent.setOffer(internalOffer);
|
||||||
offerChangedEvent.setSlot(idx);
|
offerChangedEvent.setSlot(idx);
|
||||||
eventBus.post(offerChangedEvent);
|
client.getCallbacks().post(offerChangedEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
@FieldHook("clientVarps")
|
@FieldHook("clientVarps")
|
||||||
@@ -838,7 +860,7 @@ public abstract class RSClientMixin implements RSClient
|
|||||||
public static void settingsChanged(int idx)
|
public static void settingsChanged(int idx)
|
||||||
{
|
{
|
||||||
VarbitChanged varbitChanged = new VarbitChanged();
|
VarbitChanged varbitChanged = new VarbitChanged();
|
||||||
eventBus.post(varbitChanged);
|
client.getCallbacks().post(varbitChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
@FieldHook("isResized")
|
@FieldHook("isResized")
|
||||||
@@ -848,14 +870,14 @@ public abstract class RSClientMixin implements RSClient
|
|||||||
//maybe couple with varbitChanged. resizeable may not be a varbit but it would fit with the other client settings.
|
//maybe couple with varbitChanged. resizeable may not be a varbit but it would fit with the other client settings.
|
||||||
ResizeableChanged resizeableChanged = new ResizeableChanged();
|
ResizeableChanged resizeableChanged = new ResizeableChanged();
|
||||||
resizeableChanged.setResized(client.isResized());
|
resizeableChanged.setResized(client.isResized());
|
||||||
eventBus.post(resizeableChanged);
|
client.getCallbacks().post(resizeableChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
@FieldHook("clanMemberManager")
|
@FieldHook("clanMemberManager")
|
||||||
@Inject
|
@Inject
|
||||||
public static void clanMemberManagerChanged(int idx)
|
public static void clanMemberManagerChanged(int idx)
|
||||||
{
|
{
|
||||||
eventBus.post(new ClanChanged(client.getClanMemberManager() != null));
|
client.getCallbacks().post(new ClanChanged(client.getClanMemberManager() != null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@@ -1001,7 +1023,7 @@ public abstract class RSClientMixin implements RSClient
|
|||||||
menuOptionClicked.setMenuAction(MenuAction.of(menuAction));
|
menuOptionClicked.setMenuAction(MenuAction.of(menuAction));
|
||||||
menuOptionClicked.setId(id);
|
menuOptionClicked.setId(id);
|
||||||
menuOptionClicked.setWidgetId(widgetId);
|
menuOptionClicked.setWidgetId(widgetId);
|
||||||
eventBus.post(menuOptionClicked);
|
client.getCallbacks().post(menuOptionClicked);
|
||||||
|
|
||||||
if (menuOptionClicked.isConsumed())
|
if (menuOptionClicked.isConsumed())
|
||||||
{
|
{
|
||||||
@@ -1015,7 +1037,7 @@ public abstract class RSClientMixin implements RSClient
|
|||||||
@Inject
|
@Inject
|
||||||
public static void onUsernameChanged(int idx)
|
public static void onUsernameChanged(int idx)
|
||||||
{
|
{
|
||||||
eventBus.post(new UsernameChanged());
|
client.getCallbacks().post(new UsernameChanged());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -1046,34 +1068,35 @@ public abstract class RSClientMixin implements RSClient
|
|||||||
{
|
{
|
||||||
final MenuOpened event = new MenuOpened();
|
final MenuOpened event = new MenuOpened();
|
||||||
event.setMenuEntries(getMenuEntries());
|
event.setMenuEntries(getMenuEntries());
|
||||||
eventBus.post(event);
|
callbacks.post(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@MethodHook("updateNpcs")
|
@MethodHook("updateNpcs")
|
||||||
public static void updateNpcs(boolean var0, PacketBuffer var1)
|
public static void updateNpcs(boolean var0, PacketBuffer var1)
|
||||||
{
|
{
|
||||||
Hooks.updateNpcs();
|
client.getCallbacks().updateNpcs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@MethodHook("addChatMessage")
|
@MethodHook("addChatMessage")
|
||||||
public static void onAddChatMessage(int type, String name, String message, String sender)
|
public static void onAddChatMessage(int type, String name, String message, String sender)
|
||||||
{
|
{
|
||||||
if (log.isDebugEnabled())
|
Logger logger = client.getLogger();
|
||||||
|
if (logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
log.debug("Chat message type {}: {}", ChatMessageType.of(type), message);
|
logger.debug("Chat message type {}: {}", ChatMessageType.of(type), message);
|
||||||
}
|
}
|
||||||
|
|
||||||
final ChatMessageType chatMessageType = ChatMessageType.of(type);
|
final ChatMessageType chatMessageType = ChatMessageType.of(type);
|
||||||
final ChatMessage chatMessage = new ChatMessage(chatMessageType, name, message, sender);
|
final ChatMessage chatMessage = new ChatMessage(chatMessageType, name, message, sender);
|
||||||
eventBus.post(chatMessage);
|
client.getCallbacks().post(chatMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@MethodHook("methodDraw")
|
@MethodHook("methodDraw")
|
||||||
public void methodDraw(boolean var1)
|
public void methodDraw(boolean var1)
|
||||||
{
|
{
|
||||||
Hooks.clientMainLoop();
|
callbacks.clientMainLoop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -28,18 +28,22 @@ import net.runelite.api.events.RemovedFriend;
|
|||||||
import net.runelite.api.mixins.Inject;
|
import net.runelite.api.mixins.Inject;
|
||||||
import net.runelite.api.mixins.MethodHook;
|
import net.runelite.api.mixins.MethodHook;
|
||||||
import net.runelite.api.mixins.Mixin;
|
import net.runelite.api.mixins.Mixin;
|
||||||
import static net.runelite.client.callback.Hooks.eventBus;
|
import net.runelite.api.mixins.Shadow;
|
||||||
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSFriend;
|
import net.runelite.rs.api.RSFriend;
|
||||||
import net.runelite.rs.api.RSFriendManager;
|
import net.runelite.rs.api.RSFriendManager;
|
||||||
|
|
||||||
@Mixin(RSFriendManager.class)
|
@Mixin(RSFriendManager.class)
|
||||||
public abstract class RSFriendManagerMixin implements RSFriend
|
public abstract class RSFriendManagerMixin implements RSFriend
|
||||||
{
|
{
|
||||||
|
@Shadow("clientInstance")
|
||||||
|
private static RSClient client;
|
||||||
|
|
||||||
@MethodHook("removeFriend")
|
@MethodHook("removeFriend")
|
||||||
@Inject
|
@Inject
|
||||||
public void rl$removeFriend(String friendName)
|
public void rl$removeFriend(String friendName)
|
||||||
{
|
{
|
||||||
RemovedFriend removedFriend = new RemovedFriend(friendName);
|
RemovedFriend removedFriend = new RemovedFriend(friendName);
|
||||||
eventBus.post(removedFriend);
|
client.getCallbacks().post(removedFriend);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,12 +31,16 @@ import net.runelite.api.mixins.Inject;
|
|||||||
import net.runelite.api.mixins.MethodHook;
|
import net.runelite.api.mixins.MethodHook;
|
||||||
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 static net.runelite.client.callback.Hooks.eventBus;
|
import net.runelite.api.mixins.Shadow;
|
||||||
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSGameEngine;
|
import net.runelite.rs.api.RSGameEngine;
|
||||||
|
|
||||||
@Mixin(RSGameEngine.class)
|
@Mixin(RSGameEngine.class)
|
||||||
public abstract class RSGameEngineMixin implements RSGameEngine
|
public abstract class RSGameEngineMixin implements RSGameEngine
|
||||||
{
|
{
|
||||||
|
@Shadow("clientInstance")
|
||||||
|
private static RSClient client;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private Thread thread;
|
private Thread thread;
|
||||||
|
|
||||||
@@ -70,6 +74,6 @@ public abstract class RSGameEngineMixin implements RSGameEngine
|
|||||||
{
|
{
|
||||||
final FocusChanged focusChanged = new FocusChanged();
|
final FocusChanged focusChanged = new FocusChanged();
|
||||||
focusChanged.setFocused(true);
|
focusChanged.setFocused(true);
|
||||||
eventBus.post(focusChanged);
|
client.getCallbacks().post(focusChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,14 +35,19 @@ import java.io.InputStreamReader;
|
|||||||
import net.runelite.api.mixins.Copy;
|
import net.runelite.api.mixins.Copy;
|
||||||
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.overlay.OverlayIndex;
|
import net.runelite.api.overlay.OverlayIndex;
|
||||||
import static net.runelite.client.callback.Hooks.log;
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSIndexData;
|
import net.runelite.rs.api.RSIndexData;
|
||||||
import net.runelite.rs.api.RSIndexDataBase;
|
import net.runelite.rs.api.RSIndexDataBase;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
@Mixin(RSIndexDataBase.class)
|
@Mixin(RSIndexDataBase.class)
|
||||||
public abstract class RSIndexDataBaseMixin implements RSIndexDataBase
|
public abstract class RSIndexDataBaseMixin implements RSIndexDataBase
|
||||||
{
|
{
|
||||||
|
@Shadow("clientInstance")
|
||||||
|
private static RSClient client;
|
||||||
|
|
||||||
@Copy("getConfigData")
|
@Copy("getConfigData")
|
||||||
abstract byte[] rs$getConfigData(int archiveId, int fileId);
|
abstract byte[] rs$getConfigData(int archiveId, int fileId);
|
||||||
|
|
||||||
@@ -57,6 +62,8 @@ public abstract class RSIndexDataBaseMixin implements RSIndexDataBase
|
|||||||
return rsData;
|
return rsData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Logger log = client.getLogger();
|
||||||
|
|
||||||
InputStream in = getClass().getResourceAsStream("/runelite/" + indexData.getIndex() + "/" + archiveId);
|
InputStream in = getClass().getResourceAsStream("/runelite/" + indexData.getIndex() + "/" + archiveId);
|
||||||
if (in == null)
|
if (in == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,7 +31,8 @@ import net.runelite.api.mixins.Inject;
|
|||||||
import net.runelite.api.mixins.MethodHook;
|
import net.runelite.api.mixins.MethodHook;
|
||||||
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 static net.runelite.client.callback.Hooks.eventBus;
|
import net.runelite.api.mixins.Shadow;
|
||||||
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSItemComposition;
|
import net.runelite.rs.api.RSItemComposition;
|
||||||
|
|
||||||
@Mixin(RSItemComposition.class)
|
@Mixin(RSItemComposition.class)
|
||||||
@@ -39,6 +40,9 @@ public abstract class RSItemCompositionMixin implements RSItemComposition
|
|||||||
{
|
{
|
||||||
private static final int DEFAULT_CUSTOM_SHIFT_CLICK_INDEX = -2;
|
private static final int DEFAULT_CUSTOM_SHIFT_CLICK_INDEX = -2;
|
||||||
|
|
||||||
|
@Shadow("clientInstance")
|
||||||
|
private static RSClient client;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private int shiftClickActionIndex = DEFAULT_CUSTOM_SHIFT_CLICK_INDEX;
|
private int shiftClickActionIndex = DEFAULT_CUSTOM_SHIFT_CLICK_INDEX;
|
||||||
|
|
||||||
@@ -83,6 +87,6 @@ public abstract class RSItemCompositionMixin implements RSItemComposition
|
|||||||
{
|
{
|
||||||
final PostItemComposition event = new PostItemComposition();
|
final PostItemComposition event = new PostItemComposition();
|
||||||
event.setItemComposition(this);
|
event.setItemComposition(this);
|
||||||
eventBus.post(event);
|
client.getCallbacks().post(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import net.runelite.api.mixins.FieldHook;
|
|||||||
import net.runelite.api.mixins.Inject;
|
import net.runelite.api.mixins.Inject;
|
||||||
import net.runelite.api.mixins.Mixin;
|
import net.runelite.api.mixins.Mixin;
|
||||||
import net.runelite.api.mixins.Shadow;
|
import net.runelite.api.mixins.Shadow;
|
||||||
import static net.runelite.client.callback.Hooks.deferredEventBus;
|
|
||||||
import net.runelite.rs.api.RSClient;
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSItem;
|
import net.runelite.rs.api.RSItem;
|
||||||
import net.runelite.rs.api.RSItemContainer;
|
import net.runelite.rs.api.RSItemContainer;
|
||||||
@@ -77,7 +76,7 @@ public abstract class RSItemContainerMixin implements RSItemContainer
|
|||||||
rl$lastCycle = cycle;
|
rl$lastCycle = cycle;
|
||||||
|
|
||||||
ItemContainerChanged event = new ItemContainerChanged(this);
|
ItemContainerChanged event = new ItemContainerChanged(this);
|
||||||
deferredEventBus.post(event);
|
client.getCallbacks().postDeferred(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,13 +32,16 @@ import net.runelite.api.mixins.Inject;
|
|||||||
import net.runelite.api.mixins.MethodHook;
|
import net.runelite.api.mixins.MethodHook;
|
||||||
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.client.callback.Hooks;
|
import net.runelite.api.mixins.Shadow;
|
||||||
import static net.runelite.client.callback.Hooks.eventBus;
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSKeyFocusListener;
|
import net.runelite.rs.api.RSKeyFocusListener;
|
||||||
|
|
||||||
@Mixin(RSKeyFocusListener.class)
|
@Mixin(RSKeyFocusListener.class)
|
||||||
public abstract class RSKeyFocusListenerMixin implements RSKeyFocusListener
|
public abstract class RSKeyFocusListenerMixin implements RSKeyFocusListener
|
||||||
{
|
{
|
||||||
|
@Shadow("clientInstance")
|
||||||
|
private static RSClient client;
|
||||||
|
|
||||||
@Copy("keyPressed")
|
@Copy("keyPressed")
|
||||||
abstract void rs$keyPressed(KeyEvent keyEvent);
|
abstract void rs$keyPressed(KeyEvent keyEvent);
|
||||||
|
|
||||||
@@ -52,7 +55,7 @@ public abstract class RSKeyFocusListenerMixin implements RSKeyFocusListener
|
|||||||
@Replace("keyPressed")
|
@Replace("keyPressed")
|
||||||
public final synchronized void keyPressed(KeyEvent keyEvent)
|
public final synchronized void keyPressed(KeyEvent keyEvent)
|
||||||
{
|
{
|
||||||
Hooks.keyPressed(keyEvent);
|
client.getCallbacks().keyPressed(keyEvent);
|
||||||
if (!keyEvent.isConsumed())
|
if (!keyEvent.isConsumed())
|
||||||
{
|
{
|
||||||
rs$keyPressed(keyEvent);
|
rs$keyPressed(keyEvent);
|
||||||
@@ -63,7 +66,7 @@ public abstract class RSKeyFocusListenerMixin implements RSKeyFocusListener
|
|||||||
@Replace("keyReleased")
|
@Replace("keyReleased")
|
||||||
public final synchronized void keyReleased(KeyEvent keyEvent)
|
public final synchronized void keyReleased(KeyEvent keyEvent)
|
||||||
{
|
{
|
||||||
Hooks.keyReleased(keyEvent);
|
client.getCallbacks().keyReleased(keyEvent);
|
||||||
if (!keyEvent.isConsumed())
|
if (!keyEvent.isConsumed())
|
||||||
{
|
{
|
||||||
rs$keyReleased(keyEvent);
|
rs$keyReleased(keyEvent);
|
||||||
@@ -74,7 +77,7 @@ public abstract class RSKeyFocusListenerMixin implements RSKeyFocusListener
|
|||||||
@Replace("keyTyped")
|
@Replace("keyTyped")
|
||||||
public final void keyTyped(KeyEvent keyEvent)
|
public final void keyTyped(KeyEvent keyEvent)
|
||||||
{
|
{
|
||||||
Hooks.keyTyped(keyEvent);
|
client.getCallbacks().keyTyped(keyEvent);
|
||||||
if (!keyEvent.isConsumed())
|
if (!keyEvent.isConsumed())
|
||||||
{
|
{
|
||||||
rs$keyTyped(keyEvent);
|
rs$keyTyped(keyEvent);
|
||||||
@@ -87,6 +90,6 @@ public abstract class RSKeyFocusListenerMixin implements RSKeyFocusListener
|
|||||||
{
|
{
|
||||||
final FocusChanged focusChanged = new FocusChanged();
|
final FocusChanged focusChanged = new FocusChanged();
|
||||||
focusChanged.setFocused(false);
|
focusChanged.setFocused(false);
|
||||||
eventBus.post(focusChanged);
|
client.getCallbacks().post(focusChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -27,12 +27,16 @@ package net.runelite.mixins;
|
|||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
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.client.callback.Hooks;
|
import net.runelite.api.mixins.Shadow;
|
||||||
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSMainBufferProvider;
|
import net.runelite.rs.api.RSMainBufferProvider;
|
||||||
|
|
||||||
@Mixin(RSMainBufferProvider.class)
|
@Mixin(RSMainBufferProvider.class)
|
||||||
public abstract class RSMainBufferProviderMixin implements RSMainBufferProvider
|
public abstract class RSMainBufferProviderMixin implements RSMainBufferProvider
|
||||||
{
|
{
|
||||||
|
@Shadow("clientInstance")
|
||||||
|
private static RSClient client;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replacing this method makes it so we can completely
|
* Replacing this method makes it so we can completely
|
||||||
* control when/what is drawn on the game's canvas,
|
* control when/what is drawn on the game's canvas,
|
||||||
@@ -42,6 +46,6 @@ public abstract class RSMainBufferProviderMixin implements RSMainBufferProvider
|
|||||||
@Replace("draw")
|
@Replace("draw")
|
||||||
final void draw(Graphics graphics, int x, int y)
|
final void draw(Graphics graphics, int x, int y)
|
||||||
{
|
{
|
||||||
Hooks.draw(this, graphics, x, y);
|
client.getCallbacks().draw(this, graphics, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,12 +29,16 @@ import net.runelite.api.events.SetMessage;
|
|||||||
import net.runelite.api.mixins.Inject;
|
import net.runelite.api.mixins.Inject;
|
||||||
import net.runelite.api.mixins.MethodHook;
|
import net.runelite.api.mixins.MethodHook;
|
||||||
import net.runelite.api.mixins.Mixin;
|
import net.runelite.api.mixins.Mixin;
|
||||||
import static net.runelite.client.callback.Hooks.eventBus;
|
import net.runelite.api.mixins.Shadow;
|
||||||
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSMessageNode;
|
import net.runelite.rs.api.RSMessageNode;
|
||||||
|
|
||||||
@Mixin(RSMessageNode.class)
|
@Mixin(RSMessageNode.class)
|
||||||
public abstract class RSMessageNodeMixin implements RSMessageNode
|
public abstract class RSMessageNodeMixin implements RSMessageNode
|
||||||
{
|
{
|
||||||
|
@Shadow("clientInstance")
|
||||||
|
private static RSClient client;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private String runeLiteFormatMessage;
|
private String runeLiteFormatMessage;
|
||||||
|
|
||||||
@@ -47,7 +51,7 @@ public abstract class RSMessageNodeMixin implements RSMessageNode
|
|||||||
setMessage.setName(getName());
|
setMessage.setName(getName());
|
||||||
setMessage.setSender(getSender());
|
setMessage.setSender(getSender());
|
||||||
setMessage.setValue(getValue());
|
setMessage.setValue(getValue());
|
||||||
eventBus.post(setMessage);
|
client.getCallbacks().post(setMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@@ -81,6 +85,6 @@ public abstract class RSMessageNodeMixin implements RSMessageNode
|
|||||||
setMessage.setName(name);
|
setMessage.setName(name);
|
||||||
setMessage.setSender(sender);
|
setMessage.setSender(sender);
|
||||||
setMessage.setValue(value);
|
setMessage.setValue(value);
|
||||||
eventBus.post(setMessage);
|
client.getCallbacks().post(setMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,12 +28,16 @@ import java.awt.event.MouseEvent;
|
|||||||
import net.runelite.api.mixins.Copy;
|
import net.runelite.api.mixins.Copy;
|
||||||
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.client.callback.Hooks;
|
import net.runelite.api.mixins.Shadow;
|
||||||
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSMouseInput;
|
import net.runelite.rs.api.RSMouseInput;
|
||||||
|
|
||||||
@Mixin(RSMouseInput.class)
|
@Mixin(RSMouseInput.class)
|
||||||
public abstract class RSMouseInputMixin implements RSMouseInput
|
public abstract class RSMouseInputMixin implements RSMouseInput
|
||||||
{
|
{
|
||||||
|
@Shadow("clientInstance")
|
||||||
|
private static RSClient client;
|
||||||
|
|
||||||
@Copy("mousePressed")
|
@Copy("mousePressed")
|
||||||
abstract void rs$mousePressed(MouseEvent mouseEvent);
|
abstract void rs$mousePressed(MouseEvent mouseEvent);
|
||||||
|
|
||||||
@@ -59,7 +63,7 @@ public abstract class RSMouseInputMixin implements RSMouseInput
|
|||||||
@Replace("mousePressed")
|
@Replace("mousePressed")
|
||||||
public synchronized void mousePressed(MouseEvent mouseEvent)
|
public synchronized void mousePressed(MouseEvent mouseEvent)
|
||||||
{
|
{
|
||||||
mouseEvent = Hooks.mousePressed(mouseEvent);
|
mouseEvent = client.getCallbacks().mousePressed(mouseEvent);
|
||||||
if (!mouseEvent.isConsumed())
|
if (!mouseEvent.isConsumed())
|
||||||
{
|
{
|
||||||
rs$mousePressed(mouseEvent);
|
rs$mousePressed(mouseEvent);
|
||||||
@@ -70,7 +74,7 @@ public abstract class RSMouseInputMixin implements RSMouseInput
|
|||||||
@Replace("mouseReleased")
|
@Replace("mouseReleased")
|
||||||
public synchronized void mouseReleased(MouseEvent mouseEvent)
|
public synchronized void mouseReleased(MouseEvent mouseEvent)
|
||||||
{
|
{
|
||||||
mouseEvent = Hooks.mouseReleased(mouseEvent);
|
mouseEvent = client.getCallbacks().mouseReleased(mouseEvent);
|
||||||
if (!mouseEvent.isConsumed())
|
if (!mouseEvent.isConsumed())
|
||||||
{
|
{
|
||||||
rs$mouseReleased(mouseEvent);
|
rs$mouseReleased(mouseEvent);
|
||||||
@@ -81,7 +85,7 @@ public abstract class RSMouseInputMixin implements RSMouseInput
|
|||||||
@Replace("mouseClicked")
|
@Replace("mouseClicked")
|
||||||
public void mouseClicked(MouseEvent event)
|
public void mouseClicked(MouseEvent event)
|
||||||
{
|
{
|
||||||
event = Hooks.mouseClicked(event);
|
event = client.getCallbacks().mouseClicked(event);
|
||||||
if (!event.isConsumed())
|
if (!event.isConsumed())
|
||||||
{
|
{
|
||||||
rs$mouseClicked(event);
|
rs$mouseClicked(event);
|
||||||
@@ -92,7 +96,7 @@ public abstract class RSMouseInputMixin implements RSMouseInput
|
|||||||
@Replace("mouseEntered")
|
@Replace("mouseEntered")
|
||||||
public synchronized void mouseEntered(MouseEvent mouseEvent)
|
public synchronized void mouseEntered(MouseEvent mouseEvent)
|
||||||
{
|
{
|
||||||
mouseEvent = Hooks.mouseEntered(mouseEvent);
|
mouseEvent = client.getCallbacks().mouseEntered(mouseEvent);
|
||||||
if (!mouseEvent.isConsumed())
|
if (!mouseEvent.isConsumed())
|
||||||
{
|
{
|
||||||
rs$mouseEntered(mouseEvent);
|
rs$mouseEntered(mouseEvent);
|
||||||
@@ -104,7 +108,7 @@ public abstract class RSMouseInputMixin implements RSMouseInput
|
|||||||
@Replace("mouseExited")
|
@Replace("mouseExited")
|
||||||
public synchronized void mouseExited(MouseEvent mouseEvent)
|
public synchronized void mouseExited(MouseEvent mouseEvent)
|
||||||
{
|
{
|
||||||
mouseEvent = Hooks.mouseExited(mouseEvent);
|
mouseEvent = client.getCallbacks().mouseExited(mouseEvent);
|
||||||
if (!mouseEvent.isConsumed())
|
if (!mouseEvent.isConsumed())
|
||||||
{
|
{
|
||||||
rs$mouseExited(mouseEvent);
|
rs$mouseExited(mouseEvent);
|
||||||
@@ -115,7 +119,7 @@ public abstract class RSMouseInputMixin implements RSMouseInput
|
|||||||
@Replace("mouseDragged")
|
@Replace("mouseDragged")
|
||||||
public synchronized void mouseDragged(MouseEvent mouseEvent)
|
public synchronized void mouseDragged(MouseEvent mouseEvent)
|
||||||
{
|
{
|
||||||
mouseEvent = Hooks.mouseDragged(mouseEvent);
|
mouseEvent = client.getCallbacks().mouseDragged(mouseEvent);
|
||||||
if (!mouseEvent.isConsumed())
|
if (!mouseEvent.isConsumed())
|
||||||
{
|
{
|
||||||
rs$mouseDragged(mouseEvent);
|
rs$mouseDragged(mouseEvent);
|
||||||
@@ -126,7 +130,7 @@ public abstract class RSMouseInputMixin implements RSMouseInput
|
|||||||
@Replace("mouseMoved")
|
@Replace("mouseMoved")
|
||||||
public synchronized void mouseMoved(MouseEvent mouseEvent)
|
public synchronized void mouseMoved(MouseEvent mouseEvent)
|
||||||
{
|
{
|
||||||
mouseEvent = Hooks.mouseMoved(mouseEvent);
|
mouseEvent = client.getCallbacks().mouseMoved(mouseEvent);
|
||||||
if (!mouseEvent.isConsumed())
|
if (!mouseEvent.isConsumed())
|
||||||
{
|
{
|
||||||
rs$mouseMoved(mouseEvent);
|
rs$mouseMoved(mouseEvent);
|
||||||
|
|||||||
@@ -28,12 +28,16 @@ import java.awt.event.MouseWheelEvent;
|
|||||||
import net.runelite.api.mixins.Copy;
|
import net.runelite.api.mixins.Copy;
|
||||||
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.client.callback.Hooks;
|
import net.runelite.api.mixins.Shadow;
|
||||||
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSMouseWheelHandler;
|
import net.runelite.rs.api.RSMouseWheelHandler;
|
||||||
|
|
||||||
@Mixin(RSMouseWheelHandler.class)
|
@Mixin(RSMouseWheelHandler.class)
|
||||||
public abstract class RSMouseWheelHandlerMixin implements RSMouseWheelHandler
|
public abstract class RSMouseWheelHandlerMixin implements RSMouseWheelHandler
|
||||||
{
|
{
|
||||||
|
@Shadow("clientInstance")
|
||||||
|
private static RSClient client;
|
||||||
|
|
||||||
@Copy("mouseWheelMoved")
|
@Copy("mouseWheelMoved")
|
||||||
abstract void rs$mouseWheelMoved(MouseWheelEvent event);
|
abstract void rs$mouseWheelMoved(MouseWheelEvent event);
|
||||||
|
|
||||||
@@ -41,7 +45,7 @@ public abstract class RSMouseWheelHandlerMixin implements RSMouseWheelHandler
|
|||||||
@Replace("mouseWheelMoved")
|
@Replace("mouseWheelMoved")
|
||||||
public void mouseWheelMoved(MouseWheelEvent event)
|
public void mouseWheelMoved(MouseWheelEvent event)
|
||||||
{
|
{
|
||||||
event = Hooks.mouseWheelMoved(event);
|
event = client.getCallbacks().mouseWheelMoved(event);
|
||||||
if (!event.isConsumed())
|
if (!event.isConsumed())
|
||||||
{
|
{
|
||||||
rs$mouseWheelMoved(event);
|
rs$mouseWheelMoved(event);
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ 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;
|
||||||
import static net.runelite.client.callback.Hooks.eventBus;
|
|
||||||
import net.runelite.rs.api.RSClient;
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSModel;
|
import net.runelite.rs.api.RSModel;
|
||||||
import net.runelite.rs.api.RSNPC;
|
import net.runelite.rs.api.RSNPC;
|
||||||
@@ -106,7 +105,7 @@ public abstract class RSNPCMixin implements RSNPC
|
|||||||
{
|
{
|
||||||
if (composition == null)
|
if (composition == null)
|
||||||
{
|
{
|
||||||
eventBus.post(new NpcDespawned(this));
|
client.getCallbacks().post(new NpcDespawned(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,17 +28,21 @@ import net.runelite.api.events.NameableNameChanged;
|
|||||||
import net.runelite.api.mixins.FieldHook;
|
import net.runelite.api.mixins.FieldHook;
|
||||||
import net.runelite.api.mixins.Inject;
|
import net.runelite.api.mixins.Inject;
|
||||||
import net.runelite.api.mixins.Mixin;
|
import net.runelite.api.mixins.Mixin;
|
||||||
import static net.runelite.client.callback.Hooks.eventBus;
|
import net.runelite.api.mixins.Shadow;
|
||||||
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSNameable;
|
import net.runelite.rs.api.RSNameable;
|
||||||
|
|
||||||
@Mixin(RSNameable.class)
|
@Mixin(RSNameable.class)
|
||||||
public abstract class RSNameableMixin implements RSNameable
|
public abstract class RSNameableMixin implements RSNameable
|
||||||
{
|
{
|
||||||
|
@Shadow("clientInstance")
|
||||||
|
private static RSClient client;
|
||||||
|
|
||||||
@FieldHook("prevName")
|
@FieldHook("prevName")
|
||||||
@Inject
|
@Inject
|
||||||
public void onPrevNameChanged(int idx)
|
public void onPrevNameChanged(int idx)
|
||||||
{
|
{
|
||||||
NameableNameChanged nameableNameChanged = new NameableNameChanged(this);
|
NameableNameChanged nameableNameChanged = new NameableNameChanged(this);
|
||||||
eventBus.post(nameableNameChanged);
|
client.getCallbacks().post(nameableNameChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,12 +33,16 @@ import net.runelite.api.events.NpcActionChanged;
|
|||||||
import net.runelite.api.mixins.FieldHook;
|
import net.runelite.api.mixins.FieldHook;
|
||||||
import net.runelite.api.mixins.Inject;
|
import net.runelite.api.mixins.Inject;
|
||||||
import net.runelite.api.mixins.Mixin;
|
import net.runelite.api.mixins.Mixin;
|
||||||
import static net.runelite.client.callback.Hooks.eventBus;
|
import net.runelite.api.mixins.Shadow;
|
||||||
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSNPCComposition;
|
import net.runelite.rs.api.RSNPCComposition;
|
||||||
|
|
||||||
@Mixin(RSNPCComposition.class)
|
@Mixin(RSNPCComposition.class)
|
||||||
public abstract class RSNpcCompositionMixin implements RSNPCComposition
|
public abstract class RSNpcCompositionMixin implements RSNPCComposition
|
||||||
{
|
{
|
||||||
|
@Shadow("clientInstance")
|
||||||
|
private static RSClient client;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Override
|
@Override
|
||||||
public HeadIcon getOverheadIcon()
|
public HeadIcon getOverheadIcon()
|
||||||
@@ -65,6 +69,6 @@ public abstract class RSNpcCompositionMixin implements RSNPCComposition
|
|||||||
NpcActionChanged npcActionChanged = new NpcActionChanged();
|
NpcActionChanged npcActionChanged = new NpcActionChanged();
|
||||||
npcActionChanged.setNpcComposition(this);
|
npcActionChanged.setNpcComposition(this);
|
||||||
npcActionChanged.setIdx(idx);
|
npcActionChanged.setIdx(idx);
|
||||||
eventBus.post(npcActionChanged);
|
client.getCallbacks().post(npcActionChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import net.runelite.api.mixins.Inject;
|
|||||||
import net.runelite.api.mixins.MethodHook;
|
import net.runelite.api.mixins.MethodHook;
|
||||||
import net.runelite.api.mixins.Mixin;
|
import net.runelite.api.mixins.Mixin;
|
||||||
import net.runelite.api.mixins.Shadow;
|
import net.runelite.api.mixins.Shadow;
|
||||||
import static net.runelite.client.callback.Hooks.eventBus;
|
|
||||||
import net.runelite.rs.api.RSClient;
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSNPC;
|
import net.runelite.rs.api.RSNPC;
|
||||||
import net.runelite.rs.api.RSPlayer;
|
import net.runelite.rs.api.RSPlayer;
|
||||||
@@ -101,6 +100,6 @@ public abstract class RSProjectileMixin implements RSProjectile
|
|||||||
projectileMoved.setProjectile(this);
|
projectileMoved.setProjectile(this);
|
||||||
projectileMoved.setPosition(position);
|
projectileMoved.setPosition(position);
|
||||||
projectileMoved.setZ(targetZ);
|
projectileMoved.setZ(targetZ);
|
||||||
eventBus.post(projectileMoved);
|
client.getCallbacks().post(projectileMoved);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ import net.runelite.api.mixins.Copy;
|
|||||||
import net.runelite.api.mixins.Inject;
|
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.client.callback.Hooks;
|
import net.runelite.api.mixins.Shadow;
|
||||||
import static net.runelite.client.callback.Hooks.log;
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSDecorativeObject;
|
import net.runelite.rs.api.RSDecorativeObject;
|
||||||
import net.runelite.rs.api.RSGroundObject;
|
import net.runelite.rs.api.RSGroundObject;
|
||||||
import net.runelite.rs.api.RSItemLayer;
|
import net.runelite.rs.api.RSItemLayer;
|
||||||
@@ -42,6 +42,9 @@ import net.runelite.rs.api.RSWallObject;
|
|||||||
@Mixin(RSRegion.class)
|
@Mixin(RSRegion.class)
|
||||||
public abstract class RSRegionMixin implements RSRegion
|
public abstract class RSRegionMixin implements RSRegion
|
||||||
{
|
{
|
||||||
|
@Shadow("clientInstance")
|
||||||
|
private static RSClient client;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
static boolean isDrawingRegion;
|
static boolean isDrawingRegion;
|
||||||
|
|
||||||
@@ -55,7 +58,7 @@ public abstract class RSRegionMixin implements RSRegion
|
|||||||
{
|
{
|
||||||
isDrawingRegion = true;
|
isDrawingRegion = true;
|
||||||
rs$drawRegion(cameraX, cameraY, cameraZ, cameraPitch, cameraYaw, plane);
|
rs$drawRegion(cameraX, cameraY, cameraZ, cameraPitch, cameraYaw, plane);
|
||||||
Hooks.drawRegion();
|
client.getCallbacks().drawRegion();
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@@ -147,7 +150,7 @@ public abstract class RSRegionMixin implements RSRegion
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
log.warn("error during tile underlay rendering", ex);
|
client.getLogger().warn("error during tile underlay rendering", ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,16 +27,20 @@ package net.runelite.mixins;
|
|||||||
import net.runelite.api.mixins.Inject;
|
import net.runelite.api.mixins.Inject;
|
||||||
import net.runelite.api.mixins.MethodHook;
|
import net.runelite.api.mixins.MethodHook;
|
||||||
import net.runelite.api.mixins.Mixin;
|
import net.runelite.api.mixins.Mixin;
|
||||||
import net.runelite.client.callback.Hooks;
|
import net.runelite.api.mixins.Shadow;
|
||||||
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSTextureProvider;
|
import net.runelite.rs.api.RSTextureProvider;
|
||||||
|
|
||||||
@Mixin(RSTextureProvider.class)
|
@Mixin(RSTextureProvider.class)
|
||||||
public abstract class RSTextureProviderMixin implements RSTextureProvider
|
public abstract class RSTextureProviderMixin implements RSTextureProvider
|
||||||
{
|
{
|
||||||
|
@Shadow("clientInstance")
|
||||||
|
private static RSClient client;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@MethodHook(value = "checkTextures", end = true)
|
@MethodHook(value = "checkTextures", end = true)
|
||||||
public void checkTextures(int var1)
|
public void checkTextures(int var1)
|
||||||
{
|
{
|
||||||
Hooks.drawAboveOverheads();
|
client.getCallbacks().drawAboveOverheads();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.mixins;
|
package net.runelite.mixins;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import net.runelite.api.Actor;
|
import net.runelite.api.Actor;
|
||||||
import net.runelite.api.CollisionDataFlag;
|
import net.runelite.api.CollisionDataFlag;
|
||||||
import net.runelite.api.DecorativeObject;
|
import net.runelite.api.DecorativeObject;
|
||||||
@@ -55,13 +57,10 @@ import net.runelite.api.mixins.FieldHook;
|
|||||||
import net.runelite.api.mixins.Inject;
|
import net.runelite.api.mixins.Inject;
|
||||||
import net.runelite.api.mixins.Mixin;
|
import net.runelite.api.mixins.Mixin;
|
||||||
import net.runelite.api.mixins.Shadow;
|
import net.runelite.api.mixins.Shadow;
|
||||||
import static net.runelite.client.callback.Hooks.eventBus;
|
|
||||||
import net.runelite.rs.api.RSClient;
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSCollisionData;
|
import net.runelite.rs.api.RSCollisionData;
|
||||||
import net.runelite.rs.api.RSGameObject;
|
import net.runelite.rs.api.RSGameObject;
|
||||||
import net.runelite.rs.api.RSTile;
|
import net.runelite.rs.api.RSTile;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Mixin(RSTile.class)
|
@Mixin(RSTile.class)
|
||||||
public abstract class RSTileMixin implements RSTile
|
public abstract class RSTileMixin implements RSTile
|
||||||
@@ -119,14 +118,14 @@ public abstract class RSTileMixin implements RSTile
|
|||||||
WallObjectDespawned wallObjectDespawned = new WallObjectDespawned();
|
WallObjectDespawned wallObjectDespawned = new WallObjectDespawned();
|
||||||
wallObjectDespawned.setTile(this);
|
wallObjectDespawned.setTile(this);
|
||||||
wallObjectDespawned.setWallObject(previous);
|
wallObjectDespawned.setWallObject(previous);
|
||||||
eventBus.post(wallObjectDespawned);
|
client.getCallbacks().post(wallObjectDespawned);
|
||||||
}
|
}
|
||||||
else if (current != null && previous == null)
|
else if (current != null && previous == null)
|
||||||
{
|
{
|
||||||
WallObjectSpawned wallObjectSpawned = new WallObjectSpawned();
|
WallObjectSpawned wallObjectSpawned = new WallObjectSpawned();
|
||||||
wallObjectSpawned.setTile(this);
|
wallObjectSpawned.setTile(this);
|
||||||
wallObjectSpawned.setWallObject(current);
|
wallObjectSpawned.setWallObject(current);
|
||||||
eventBus.post(wallObjectSpawned);
|
client.getCallbacks().post(wallObjectSpawned);
|
||||||
}
|
}
|
||||||
else if (current != null && previous != null)
|
else if (current != null && previous != null)
|
||||||
{
|
{
|
||||||
@@ -134,7 +133,7 @@ public abstract class RSTileMixin implements RSTile
|
|||||||
wallObjectChanged.setTile(this);
|
wallObjectChanged.setTile(this);
|
||||||
wallObjectChanged.setPrevious(previous);
|
wallObjectChanged.setPrevious(previous);
|
||||||
wallObjectChanged.setWallObject(current);
|
wallObjectChanged.setWallObject(current);
|
||||||
eventBus.post(wallObjectChanged);
|
client.getCallbacks().post(wallObjectChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,14 +151,14 @@ public abstract class RSTileMixin implements RSTile
|
|||||||
DecorativeObjectDespawned decorativeObjectDespawned = new DecorativeObjectDespawned();
|
DecorativeObjectDespawned decorativeObjectDespawned = new DecorativeObjectDespawned();
|
||||||
decorativeObjectDespawned.setTile(this);
|
decorativeObjectDespawned.setTile(this);
|
||||||
decorativeObjectDespawned.setDecorativeObject(previous);
|
decorativeObjectDespawned.setDecorativeObject(previous);
|
||||||
eventBus.post(decorativeObjectDespawned);
|
client.getCallbacks().post(decorativeObjectDespawned);
|
||||||
}
|
}
|
||||||
else if (current != null && previous == null)
|
else if (current != null && previous == null)
|
||||||
{
|
{
|
||||||
DecorativeObjectSpawned decorativeObjectSpawned = new DecorativeObjectSpawned();
|
DecorativeObjectSpawned decorativeObjectSpawned = new DecorativeObjectSpawned();
|
||||||
decorativeObjectSpawned.setTile(this);
|
decorativeObjectSpawned.setTile(this);
|
||||||
decorativeObjectSpawned.setDecorativeObject(current);
|
decorativeObjectSpawned.setDecorativeObject(current);
|
||||||
eventBus.post(decorativeObjectSpawned);
|
client.getCallbacks().post(decorativeObjectSpawned);
|
||||||
}
|
}
|
||||||
else if (current != null && previous != null)
|
else if (current != null && previous != null)
|
||||||
{
|
{
|
||||||
@@ -167,7 +166,7 @@ public abstract class RSTileMixin implements RSTile
|
|||||||
decorativeObjectChanged.setTile(this);
|
decorativeObjectChanged.setTile(this);
|
||||||
decorativeObjectChanged.setPrevious(previous);
|
decorativeObjectChanged.setPrevious(previous);
|
||||||
decorativeObjectChanged.setDecorativeObject(current);
|
decorativeObjectChanged.setDecorativeObject(current);
|
||||||
eventBus.post(decorativeObjectChanged);
|
client.getCallbacks().post(decorativeObjectChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,14 +184,14 @@ public abstract class RSTileMixin implements RSTile
|
|||||||
GroundObjectDespawned groundObjectDespawned = new GroundObjectDespawned();
|
GroundObjectDespawned groundObjectDespawned = new GroundObjectDespawned();
|
||||||
groundObjectDespawned.setTile(this);
|
groundObjectDespawned.setTile(this);
|
||||||
groundObjectDespawned.setGroundObject(previous);
|
groundObjectDespawned.setGroundObject(previous);
|
||||||
eventBus.post(groundObjectDespawned);
|
client.getCallbacks().post(groundObjectDespawned);
|
||||||
}
|
}
|
||||||
else if (current != null && previous == null)
|
else if (current != null && previous == null)
|
||||||
{
|
{
|
||||||
GroundObjectSpawned groundObjectSpawned = new GroundObjectSpawned();
|
GroundObjectSpawned groundObjectSpawned = new GroundObjectSpawned();
|
||||||
groundObjectSpawned.setTile(this);
|
groundObjectSpawned.setTile(this);
|
||||||
groundObjectSpawned.setGroundObject(current);
|
groundObjectSpawned.setGroundObject(current);
|
||||||
eventBus.post(groundObjectSpawned);
|
client.getCallbacks().post(groundObjectSpawned);
|
||||||
}
|
}
|
||||||
else if (current != null && previous != null)
|
else if (current != null && previous != null)
|
||||||
{
|
{
|
||||||
@@ -200,7 +199,7 @@ public abstract class RSTileMixin implements RSTile
|
|||||||
groundObjectChanged.setTile(this);
|
groundObjectChanged.setTile(this);
|
||||||
groundObjectChanged.setPrevious(previous);
|
groundObjectChanged.setPrevious(previous);
|
||||||
groundObjectChanged.setGroundObject(current);
|
groundObjectChanged.setGroundObject(current);
|
||||||
eventBus.post(groundObjectChanged);
|
client.getCallbacks().post(groundObjectChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -247,14 +246,14 @@ public abstract class RSTileMixin implements RSTile
|
|||||||
GameObjectDespawned gameObjectDespawned = new GameObjectDespawned();
|
GameObjectDespawned gameObjectDespawned = new GameObjectDespawned();
|
||||||
gameObjectDespawned.setTile(this);
|
gameObjectDespawned.setTile(this);
|
||||||
gameObjectDespawned.setGameObject(previous);
|
gameObjectDespawned.setGameObject(previous);
|
||||||
eventBus.post(gameObjectDespawned);
|
client.getCallbacks().post(gameObjectDespawned);
|
||||||
}
|
}
|
||||||
else if (current != null && previous == null)
|
else if (current != null && previous == null)
|
||||||
{
|
{
|
||||||
GameObjectSpawned gameObjectSpawned = new GameObjectSpawned();
|
GameObjectSpawned gameObjectSpawned = new GameObjectSpawned();
|
||||||
gameObjectSpawned.setTile(this);
|
gameObjectSpawned.setTile(this);
|
||||||
gameObjectSpawned.setGameObject(current);
|
gameObjectSpawned.setGameObject(current);
|
||||||
eventBus.post(gameObjectSpawned);
|
client.getCallbacks().post(gameObjectSpawned);
|
||||||
}
|
}
|
||||||
else if (current != null && previous != null)
|
else if (current != null && previous != null)
|
||||||
{
|
{
|
||||||
@@ -262,7 +261,7 @@ public abstract class RSTileMixin implements RSTile
|
|||||||
gameObjectsChanged.setTile(this);
|
gameObjectsChanged.setTile(this);
|
||||||
gameObjectsChanged.setPrevious(previous);
|
gameObjectsChanged.setPrevious(previous);
|
||||||
gameObjectsChanged.setGameObject(current);
|
gameObjectsChanged.setGameObject(current);
|
||||||
eventBus.post(gameObjectsChanged);
|
client.getCallbacks().post(gameObjectsChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -278,7 +277,7 @@ public abstract class RSTileMixin implements RSTile
|
|||||||
}
|
}
|
||||||
|
|
||||||
ItemLayerChanged itemLayerChanged = new ItemLayerChanged(this);
|
ItemLayerChanged itemLayerChanged = new ItemLayerChanged(this);
|
||||||
eventBus.post(itemLayerChanged);
|
client.getCallbacks().post(itemLayerChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|||||||
@@ -5,23 +5,27 @@ import net.runelite.api.events.VarClientStrChanged;
|
|||||||
import net.runelite.api.mixins.FieldHook;
|
import net.runelite.api.mixins.FieldHook;
|
||||||
import net.runelite.api.mixins.Inject;
|
import net.runelite.api.mixins.Inject;
|
||||||
import net.runelite.api.mixins.Mixin;
|
import net.runelite.api.mixins.Mixin;
|
||||||
import net.runelite.client.callback.Hooks;
|
import net.runelite.api.mixins.Shadow;
|
||||||
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSVarcs;
|
import net.runelite.rs.api.RSVarcs;
|
||||||
|
|
||||||
@Mixin(RSVarcs.class)
|
@Mixin(RSVarcs.class)
|
||||||
public abstract class RSVarcsMixin implements RSVarcs
|
public abstract class RSVarcsMixin implements RSVarcs
|
||||||
{
|
{
|
||||||
|
@Shadow("clientInstance")
|
||||||
|
private static RSClient client;
|
||||||
|
|
||||||
@FieldHook("varCInts")
|
@FieldHook("varCInts")
|
||||||
@Inject
|
@Inject
|
||||||
public void onVarCIntChanged(int idx)
|
public void onVarCIntChanged(int idx)
|
||||||
{
|
{
|
||||||
Hooks.eventBus.post(new VarClientIntChanged(idx));
|
client.getCallbacks().post(new VarClientIntChanged(idx));
|
||||||
}
|
}
|
||||||
|
|
||||||
@FieldHook("varCStrings")
|
@FieldHook("varCStrings")
|
||||||
@Inject
|
@Inject
|
||||||
public void onVarCStrChanged(int idx)
|
public void onVarCStrChanged(int idx)
|
||||||
{
|
{
|
||||||
Hooks.eventBus.post(new VarClientStrChanged(idx));
|
client.getCallbacks().post(new VarClientStrChanged(idx));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,9 +41,6 @@ import net.runelite.api.widgets.Widget;
|
|||||||
import static net.runelite.api.widgets.WidgetInfo.TO_CHILD;
|
import static net.runelite.api.widgets.WidgetInfo.TO_CHILD;
|
||||||
import static net.runelite.api.widgets.WidgetInfo.TO_GROUP;
|
import static net.runelite.api.widgets.WidgetInfo.TO_GROUP;
|
||||||
import net.runelite.api.widgets.WidgetItem;
|
import net.runelite.api.widgets.WidgetItem;
|
||||||
import static net.runelite.client.callback.Hooks.deferredEventBus;
|
|
||||||
import static net.runelite.client.callback.Hooks.eventBus;
|
|
||||||
import static net.runelite.client.callback.Hooks.log;
|
|
||||||
import net.runelite.rs.api.RSClient;
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSHashTable;
|
import net.runelite.rs.api.RSHashTable;
|
||||||
import net.runelite.rs.api.RSNode;
|
import net.runelite.rs.api.RSNode;
|
||||||
@@ -365,7 +362,7 @@ public abstract class RSWidgetMixin implements RSWidget
|
|||||||
event.setWidget(this);
|
event.setWidget(this);
|
||||||
event.setHidden(hidden);
|
event.setHidden(hidden);
|
||||||
|
|
||||||
eventBus.post(event);
|
client.getCallbacks().post(event);
|
||||||
|
|
||||||
RSWidget[] children = getChildren();
|
RSWidget[] children = getChildren();
|
||||||
|
|
||||||
@@ -443,9 +440,9 @@ public abstract class RSWidgetMixin implements RSWidget
|
|||||||
|
|
||||||
rl$widgetLastPosChanged = tick;
|
rl$widgetLastPosChanged = tick;
|
||||||
|
|
||||||
log.trace("Posting widget position changed");
|
client.getLogger().trace("Posting widget position changed");
|
||||||
|
|
||||||
WidgetPositioned widgetPositioned = new WidgetPositioned();
|
WidgetPositioned widgetPositioned = new WidgetPositioned();
|
||||||
deferredEventBus.post(widgetPositioned);
|
client.getCallbacks().postDeferred(widgetPositioned);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ 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;
|
||||||
import net.runelite.client.callback.Hooks;
|
|
||||||
import net.runelite.rs.api.RSClient;
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSScript;
|
import net.runelite.rs.api.RSScript;
|
||||||
import net.runelite.rs.api.RSScriptEvent;
|
import net.runelite.rs.api.RSScriptEvent;
|
||||||
@@ -91,7 +90,7 @@ public abstract class ScriptVMMixin implements RSClient
|
|||||||
}
|
}
|
||||||
m.appendTail(out);
|
m.appendTail(out);
|
||||||
|
|
||||||
Hooks.log.debug(out.toString());
|
client.getLogger().debug(out.toString());
|
||||||
|
|
||||||
client.setStringStackSize(stringStackSize);
|
client.setStringStackSize(stringStackSize);
|
||||||
client.setIntStackSize(intStackSize);
|
client.setIntStackSize(intStackSize);
|
||||||
@@ -101,7 +100,7 @@ public abstract class ScriptVMMixin implements RSClient
|
|||||||
ScriptCallbackEvent event = new ScriptCallbackEvent();
|
ScriptCallbackEvent event = new ScriptCallbackEvent();
|
||||||
event.setScript(currentScript);
|
event.setScript(currentScript);
|
||||||
event.setEventName(stringOp);
|
event.setEventName(stringOp);
|
||||||
Hooks.eventBus.post(event);
|
client.getCallbacks().post(event);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user