Port Injector to main layout

Adds deobfuscator
Adds injected-client
Adds injector-plugin
Adds runescape-client

Replaces RL's apis

Small bug with sprites atm, will be resolved soon. tired af.

Builds, probably
This commit is contained in:
zeruth
2019-06-08 05:43:03 -04:00
parent eafb024f16
commit e4d6e9fe13
1111 changed files with 135441 additions and 44733 deletions

View File

@@ -36,7 +36,7 @@ public abstract class CameraMixin implements RSClient
private static final int STANDARD_PITCH_MAX = 383;
private static final int NEW_PITCH_MAX = 512;
@Shadow("clientInstance")
@Shadow("client")
static RSClient client;
@Inject

View File

@@ -14,13 +14,13 @@ import net.runelite.rs.api.RSModel;
@Mixin(RSClient.class)
public abstract class ClickboxMixin implements RSClient
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
private static final int MAX_ENTITES_AT_MOUSE = 1000;
private static final int CLICKBOX_CLOSE = 50;
private static final int CLICKBOX_FAR = 3500;
private static final int OBJECT_INTERACTION_FAR = 35; // Max distance, in tiles, from camera
private static final int CLICKBOX_FAR = 10000;
private static final int OBJECT_INTERACTION_FAR = 100; // Max distance, in tiles, from camera
@Inject
private static final int[] rl$modelViewportXs = new int[4700];
@@ -52,7 +52,7 @@ public abstract class ClickboxMixin implements RSClient
}
// only need a boundingbox check?
if (model.isClickable())
if (model.isSingleTile())
{
addHashAtMouse(hash);
return;
@@ -147,7 +147,7 @@ public abstract class ClickboxMixin implements RSClient
continue;
}
final int radius = model.isClickable() ? 20 : 5;
final int radius = model.isSingleTile() ? 20 : 5;
int var18 = radius + viewportMouseY;
boolean var34;

View File

@@ -31,16 +31,16 @@ import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSActor;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSEntity;
import net.runelite.rs.api.RSNPC;
import net.runelite.rs.api.RSPlayer;
import net.runelite.rs.api.RSProjectile;
import net.runelite.rs.api.RSScene;
import net.runelite.rs.api.RSRenderable;
@Mixin(RSScene.class)
public abstract class EntityHiderMixin implements RSScene
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@Shadow("isHidingEntities")
@@ -76,11 +76,11 @@ public abstract class EntityHiderMixin implements RSScene
@Shadow("hideProjectiles")
private static boolean hideProjectiles;
@Copy("addEntityMarker")
abstract boolean addEntityMarker(int var1, int var2, int var3, int var4, int var5, int x, int y, int var8, RSRenderable renderable, int var10, boolean var11, long var12, int var13);
@Copy("newGameObject")
abstract boolean addEntityMarker(int var1, int var2, int var3, int var4, int var5, int x, int y, int var8, RSEntity renderable, int var10, boolean var11, long var12, int var13);
@Replace("addEntityMarker")
boolean rl$addEntityMarker(int var1, int var2, int var3, int var4, int var5, int x, int y, int var8, RSRenderable renderable, int var10, boolean var11, long var12, int var13)
@Replace("newGameObject")
boolean rl$addEntityMarker(int var1, int var2, int var3, int var4, int var5, int x, int y, int var8, RSEntity renderable, int var10, boolean var11, long var12, int var13)
{
final boolean shouldDraw = shouldDraw(renderable, false);
@@ -98,13 +98,13 @@ public abstract class EntityHiderMixin implements RSScene
return shouldDraw && addEntityMarker(var1, var2, var3, var4, var5, x, y, var8, renderable, var10, var11, var12, var13);
}
@Copy("draw2DExtras")
@Copy("drawActor2d")
private static void draw2DExtras(RSActor actor, int var1, int var2, int var3, int var4, int var5)
{
throw new RuntimeException();
}
@Replace("draw2DExtras")
@Replace("drawActor2d")
private static void rl$draw2DExtras(RSActor actor, int var1, int var2, int var3, int var4, int var5)
{
if (shouldDraw(actor, true))

View File

@@ -1,54 +0,0 @@
/*
* Copyright (c) 2018, Woox <https://github.com/wooxsolo>
* 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.mixins;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.events.GraphicsObjectCreated;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSGraphicsObject;
@Mixin(RSGraphicsObject.class)
public abstract class GraphicsObjectMixin implements RSGraphicsObject
{
@Shadow("clientInstance")
private static RSClient client;
@Inject
GraphicsObjectMixin()
{
final GraphicsObjectCreated event = new GraphicsObjectCreated(this);
client.getCallbacks().post(event);
}
@Override
@Inject
public LocalPoint getLocation()
{
return new LocalPoint(this.getX(), this.getY());
}
}

View File

@@ -50,36 +50,36 @@ public abstract class MenuMixin implements RSClient
int h = getMenuHeight();
// Outside border
RasterizerDrawHorizontalLine(x + 2, y, w - 4, MENU_BORDER_OUTER_2010);
RasterizerDrawHorizontalLine(x + 2, y + h - 1, w - 4, MENU_BORDER_OUTER_2010);
RasterizerDrawVerticalLine(x, y + 2, h - 4, MENU_BORDER_OUTER_2010);
RasterizerDrawVerticalLine(x + w - 1, y + 2, h - 4, MENU_BORDER_OUTER_2010);
rasterizerDrawHorizontalLine(x + 2, y, w - 4, MENU_BORDER_OUTER_2010);
rasterizerDrawHorizontalLine(x + 2, y + h - 1, w - 4, MENU_BORDER_OUTER_2010);
rasterizerDrawVerticalLine(x, y + 2, h - 4, MENU_BORDER_OUTER_2010);
rasterizerDrawVerticalLine(x + w - 1, y + 2, h - 4, MENU_BORDER_OUTER_2010);
// Padding
RasterizerDrawRectangle(x + 1, y + 5, w - 2, h - 6, MENU_PADDING_2010);
RasterizerDrawHorizontalLine(x + 1, y + 17, w - 2, MENU_PADDING_2010);
RasterizerDrawCircle(x + 2, y + h - 3, 0, MENU_PADDING_2010);
RasterizerDrawCircle(x + w - 3, y + h - 3, 0, MENU_PADDING_2010);
rasterizerDrawRectangle(x + 1, y + 5, w - 2, h - 6, MENU_PADDING_2010);
rasterizerDrawHorizontalLine(x + 1, y + 17, w - 2, MENU_PADDING_2010);
rasterizerDrawCircle(x + 2, y + h - 3, 0, MENU_PADDING_2010);
rasterizerDrawCircle(x + w - 3, y + h - 3, 0, MENU_PADDING_2010);
// Header
RasterizerDrawGradient(x + 2, y + 1, w - 4, 16, MENU_HEADER_GRADIENT_TOP_2010, MENU_HEADER_GRADIENT_BOTTOM_2010);
RasterizerFillRectangle(x + 1, y + 1, 2, 4, MENU_PADDING_2010);
RasterizerFillRectangle(x + w - 3, y + 1, 2, 4, MENU_PADDING_2010);
rasterizerDrawGradient(x + 2, y + 1, w - 4, 16, MENU_HEADER_GRADIENT_TOP_2010, MENU_HEADER_GRADIENT_BOTTOM_2010);
rasterizerFillRectangle(x + 1, y + 1, 2, 4, MENU_PADDING_2010);
rasterizerFillRectangle(x + w - 3, y + 1, 2, 4, MENU_PADDING_2010);
// Inside border
RasterizerDrawHorizontalLine(x + 2, y + 18, w - 4, MENU_BORDER_INNER_2010);
RasterizerDrawHorizontalLine(x + 3, y + h - 3, w - 6, MENU_BORDER_INNER_2010);
RasterizerDrawVerticalLine(x + 2, y + 18, h - 21, MENU_BORDER_INNER_2010);
RasterizerDrawVerticalLine(x + w - 3, y + 18, h - 21, MENU_BORDER_INNER_2010);
rasterizerDrawHorizontalLine(x + 2, y + 18, w - 4, MENU_BORDER_INNER_2010);
rasterizerDrawHorizontalLine(x + 3, y + h - 3, w - 6, MENU_BORDER_INNER_2010);
rasterizerDrawVerticalLine(x + 2, y + 18, h - 21, MENU_BORDER_INNER_2010);
rasterizerDrawVerticalLine(x + w - 3, y + 18, h - 21, MENU_BORDER_INNER_2010);
// Options background
RasterizerFillRectangle(x + 3, y + 19, w - 6, h - 22, MENU_BACKGROUND_2010);
rasterizerFillRectangle(x + 3, y + 19, w - 6, h - 22, MENU_BACKGROUND_2010);
// Corner insets
RasterizerDrawCircle(x + 1, y + 1, 0, MENU_BORDER_OUTER_2010);
RasterizerDrawCircle(x + w - 2, y + 1, 0, MENU_BORDER_OUTER_2010);
RasterizerDrawCircle(x + 1, y + h - 2, 0, MENU_BORDER_OUTER_2010);
RasterizerDrawCircle(x + w - 2, y + h - 2, 0, MENU_BORDER_OUTER_2010);
rasterizerDrawCircle(x + 1, y + 1, 0, MENU_BORDER_OUTER_2010);
rasterizerDrawCircle(x + w - 2, y + 1, 0, MENU_BORDER_OUTER_2010);
rasterizerDrawCircle(x + 1, y + h - 2, 0, MENU_BORDER_OUTER_2010);
rasterizerDrawCircle(x + w - 2, y + h - 2, 0, MENU_BORDER_OUTER_2010);
RSFont font = getFontBold12();
font.drawTextLeftAligned("Choose Option", x + 3, y + 14, MENU_TEXT_2010, -1);
@@ -105,7 +105,7 @@ public abstract class MenuMixin implements RSClient
// Highlight current option
if (mouseX > x && mouseX < w + x && mouseY > rowY - 13 && mouseY < rowY + 3)
{
RasterizerFillRectangleAlpha(x + 3, rowY - 12, w - 6, 15, 0xffffff, 80);
rasterizerFillRectangleAlpha(x + 3, rowY - 12, w - 6, 15, 0xffffff, 80);
}
}
}

View File

@@ -29,17 +29,17 @@ import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSScene;
import net.runelite.rs.api.RSSpritePixels;
import net.runelite.rs.api.RSSprite;
@Mixin(RSClient.class)
public abstract class MinimapMixin implements RSClient
{
@Inject
@Override
public RSSpritePixels drawInstanceMap(int z)
public RSSprite drawInstanceMap(int z)
{
RSSpritePixels ourSprite = createSpritePixels(new int[512 * 512], 512, 512);
RSSpritePixels theirSprite = getMinimapSprite();
RSSprite ourSprite = createSprite(new int[512 * 512], 512, 512);
RSSprite theirSprite = getMinimapSprite();
RSScene scene = getScene();
int[] pixels = ourSprite.getPixels();

View File

@@ -24,7 +24,6 @@
*/
package net.runelite.mixins;
import net.runelite.api.mixins.Copy;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow;
@@ -34,16 +33,10 @@ import net.runelite.rs.api.RSRunException;
@Mixin(RSClient.class)
public abstract class ProcessClientErrorMixin implements RSClient
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@Copy("processClientError")
static void rs$processClientError(String string, Throwable throwable)
{
throw new RuntimeException();
}
@Replace("processClientError")
@Replace("sendStackTrace")
static void rl$processClientError(String string, Throwable throwable)
{
if (throwable != null)
@@ -56,19 +49,6 @@ public abstract class ProcessClientErrorMixin implements RSClient
}
client.getLogger().error("Game crash: {}", string, throwableToScan);
StackTraceElement[] stackTrace = throwableToScan.getStackTrace();
for (StackTraceElement stackTraceElement : stackTrace)
{
// If stack trace contains "runelite", don't send it
if (stackTraceElement.getClassName().contains("runelite"))
{
return;
}
}
}
rs$processClientError(string, throwable);
}
}

View File

@@ -1,29 +1,6 @@
/*
* 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.mixins;
import api.overlay.OverlayIndex;
import com.google.common.hash.HashCode;
import com.google.common.hash.Hashing;
import com.google.common.io.BaseEncoding;
@@ -37,16 +14,15 @@ import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow;
import net.runelite.api.overlay.OverlayIndex;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSIndexData;
import net.runelite.rs.api.RSIndexDataBase;
import org.slf4j.Logger;
import net.runelite.rs.api.RSAbstractIndexCache;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSIndexCache;
@Mixin(RSIndexDataBase.class)
public abstract class RSIndexDataBaseMixin implements RSIndexDataBase
@Mixin(RSAbstractIndexCache.class)
public abstract class RSAbstractIndexCacheMixin implements RSAbstractIndexCache
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@Inject
@@ -59,14 +35,14 @@ public abstract class RSIndexDataBaseMixin implements RSIndexDataBase
return overlayOutdated;
}
@Copy("getConfigData")
@Copy("takeRecord")
abstract byte[] rs$getConfigData(int archiveId, int fileId);
@Replace("getConfigData")
@Replace("takeRecord")
public byte[] rl$getConfigData(int archiveId, int fileId)
{
byte[] rsData = rs$getConfigData(archiveId, fileId);
RSIndexData indexData = (RSIndexData) this;
RSIndexCache indexData = (RSIndexCache) this;
if (!OverlayIndex.hasOverlay(indexData.getIndex(), archiveId))
{

View File

@@ -24,26 +24,26 @@
*/
package net.runelite.mixins;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.image.BufferedImage;
import net.runelite.api.Actor;
import net.runelite.api.Hitsplat;
import net.runelite.api.NPC;
import net.runelite.api.NPCComposition;
import net.runelite.api.NPCDefinition;
import net.runelite.api.Perspective;
import net.runelite.api.Player;
import net.runelite.api.Point;
import net.runelite.api.SpritePixels;
import net.runelite.api.Sprite;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldArea;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.AnimationChanged;
import net.runelite.api.events.GraphicChanged;
import net.runelite.api.events.HitsplatApplied;
import net.runelite.api.events.InteractingChanged;
import net.runelite.api.events.LocalPlayerDeath;
import net.runelite.api.events.SpotAnimationChanged;
import net.runelite.api.events.InteractingChanged;
import net.runelite.api.events.OverheadTextChanged;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.image.BufferedImage;
import net.runelite.api.mixins.FieldHook;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.MethodHook;
@@ -51,60 +51,60 @@ import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSActor;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSCombatInfo1;
import net.runelite.rs.api.RSHealthBar;
import net.runelite.rs.api.RSCombatInfoList;
import net.runelite.rs.api.RSCombatInfoListHolder;
import net.runelite.rs.api.RSHealthBarDefinition;
import net.runelite.rs.api.RSHealthBarUpdate;
import net.runelite.rs.api.RSIterableNodeDeque;
import net.runelite.rs.api.RSNPC;
import net.runelite.rs.api.RSNode;
@Mixin(RSActor.class)
public abstract class RSActorMixin implements RSActor
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@Inject
@Override
public Actor getInteracting()
{
int i = getRSInteracting();
if (i == -1 || i == 65535)
int index = getRSInteracting();
if (index == -1 || index == 65535)
{
return null;
}
if (i < 0x8000)
if (index < 32768)
{
NPC[] npcs = client.getCachedNPCs();
return npcs[i];
return npcs[index];
}
i -= 0x8000;
index -= 32768;
Player[] players = client.getCachedPlayers();
return players[i];
return players[index];
}
@Inject
@Override
public int getHealthRatio()
{
RSCombatInfoList combatInfoList = getCombatInfoList();
if (combatInfoList != null)
RSIterableNodeDeque healthBars = getHealthBars();
if (healthBars != null)
{
RSNode node = combatInfoList.getNode();
RSNode next = node.getNext();
if (next instanceof RSCombatInfoListHolder)
RSNode current = healthBars.getCurrent();
RSNode next = current.getNext();
if (next instanceof RSHealthBar)
{
RSCombatInfoListHolder combatInfoListWrapper = (RSCombatInfoListHolder) next;
RSCombatInfoList combatInfoList1 = combatInfoListWrapper.getCombatInfo1();
RSHealthBar wrapper = (RSHealthBar) next;
RSIterableNodeDeque updates = wrapper.getUpdates();
RSNode node2 = combatInfoList1.getNode();
RSNode next2 = node2.getNext();
if (next2 instanceof RSCombatInfo1)
RSNode currentUpdate = updates.getCurrent();
RSNode nextUpdate = currentUpdate.getNext();
if (nextUpdate instanceof RSHealthBarUpdate)
{
RSCombatInfo1 combatInfo = (RSCombatInfo1) next2;
return combatInfo.getHealthRatio();
RSHealthBarUpdate update = (RSHealthBarUpdate) nextUpdate;
return update.getHealthRatio();
}
}
}
@@ -115,29 +115,31 @@ public abstract class RSActorMixin implements RSActor
@Override
public int getHealth()
{
RSCombatInfoList combatInfoList = getCombatInfoList();
if (combatInfoList != null)
RSIterableNodeDeque healthBars = getHealthBars();
if (healthBars != null)
{
RSNode node = combatInfoList.getNode();
RSNode next = node.getNext();
if (next instanceof RSCombatInfoListHolder)
RSNode current = healthBars.getCurrent();
if (current == null)
return 0;
RSNode next = current.getNext();
if (next instanceof RSHealthBar)
{
RSCombatInfoListHolder combatInfoListWrapper = (RSCombatInfoListHolder) next;
RSHealthBar cf = combatInfoListWrapper.getHealthBar();
return cf.getHealthScale();
RSHealthBar wrapper = (RSHealthBar) next;
RSHealthBarDefinition definition = wrapper.getDefinition();
return definition.getHealthScale();
}
}
return -1;
}
@Override
@Inject
@Override
public WorldPoint getWorldLocation()
{
return WorldPoint.fromLocal(client,
this.getPathX()[0] * Perspective.LOCAL_TILE_SIZE + Perspective.LOCAL_TILE_SIZE / 2,
this.getPathY()[0] * Perspective.LOCAL_TILE_SIZE + Perspective.LOCAL_TILE_SIZE / 2,
client.getPlane());
this.getPathX()[0] * Perspective.LOCAL_TILE_SIZE + Perspective.LOCAL_TILE_SIZE / 2,
this.getPathY()[0] * Perspective.LOCAL_TILE_SIZE + Perspective.LOCAL_TILE_SIZE / 2,
client.getPlane());
}
@Inject
@@ -170,7 +172,7 @@ public abstract class RSActorMixin implements RSActor
@Inject
@Override
public Point getCanvasSpriteLocation(SpritePixels sprite, int zOffset)
public Point getCanvasSpriteLocation(Sprite sprite, int zOffset)
{
return Perspective.getCanvasSpriteLocation(client, getLocalLocation(), sprite, zOffset);
}
@@ -182,7 +184,7 @@ public abstract class RSActorMixin implements RSActor
return Perspective.localToMinimap(client, getLocalLocation());
}
@FieldHook("animation")
@FieldHook("sequence")
@Inject
public void animationChanged(int idx)
{
@@ -191,16 +193,16 @@ public abstract class RSActorMixin implements RSActor
client.getCallbacks().post(animationChange);
}
@FieldHook("graphic")
@FieldHook("spotAnimation")
@Inject
public void graphicChanged(int idx)
public void spotAnimationChanged(int idx)
{
GraphicChanged graphicChanged = new GraphicChanged();
graphicChanged.setActor(this);
client.getCallbacks().post(graphicChanged);
SpotAnimationChanged spotAnimationChanged = new SpotAnimationChanged();
spotAnimationChanged.setActor(this);
client.getCallbacks().post(spotAnimationChanged);
}
@FieldHook("interacting")
@FieldHook("targetIndex")
@Inject
public void interactingChanged(int idx)
{
@@ -208,7 +210,7 @@ public abstract class RSActorMixin implements RSActor
client.getCallbacks().post(interactingChanged);
}
@FieldHook("overhead")
@FieldHook("overheadText")
@Inject
public void overheadTextChanged(int idx)
{
@@ -227,7 +229,7 @@ public abstract class RSActorMixin implements RSActor
int size = 1;
if (this instanceof NPC)
{
NPCComposition composition = ((NPC)this).getComposition();
NPCDefinition composition = ((NPC)this).getDefinition();
if (composition != null && composition.getConfigs() != null)
{
composition = composition.transform();
@@ -242,7 +244,7 @@ public abstract class RSActorMixin implements RSActor
}
@Inject
@MethodHook("setCombatInfo")
@MethodHook("addHealthBar")
public void setCombatInfo(int combatInfoId, int gameCycle, int var3, int var4, int healthRatio, int health)
{
if (healthRatio == 0)
@@ -274,7 +276,7 @@ public abstract class RSActorMixin implements RSActor
* @param duration The amount of gamecycles the hitsplat will last for
*/
@Inject
@MethodHook(value = "applyActorHitsplat", end = true)
@MethodHook(value = "addHitSplat", end = true)
public void applyActorHitsplat(int type, int value, int var3, int var4, int gameCycle, int duration)
{
final Hitsplat hitsplat = new Hitsplat(Hitsplat.HitsplatType.fromInteger(type), value, gameCycle + duration);

View File

@@ -0,0 +1,100 @@
package net.runelite.mixins;
import net.runelite.api.Model;
import net.runelite.api.Perspective;
import net.runelite.api.Renderable;
import java.awt.geom.Area;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSBoundaryObject;
import net.runelite.rs.api.RSClient;
@Mixin(RSBoundaryObject.class)
public abstract class RSBoundaryObjectMixin implements RSBoundaryObject
{
@Shadow("client")
private static RSClient client;
@Inject
private int wallPlane;
@Inject
@Override
public int getPlane()
{
return wallPlane;
}
@Inject
@Override
public void setPlane(int plane)
{
this.wallPlane = plane;
}
@Inject
private Model getModelA()
{
Renderable renderable = getRenderable1();
if (renderable == null)
{
return null;
}
if (renderable instanceof Model)
{
return (Model) renderable;
}
else
{
return renderable.getModel();
}
}
@Inject
private Model getModelB()
{
Renderable renderable = getRenderable2();
if (renderable == null)
{
return null;
}
if (renderable instanceof Model)
{
return (Model) renderable;
}
else
{
return renderable.getModel();
}
}
@Inject
@Override
public Area getClickbox()
{
Area clickbox = new Area();
Area clickboxA = Perspective.getClickbox(client, getModelA(), 0, getLocalLocation());
Area clickboxB = Perspective.getClickbox(client, getModelB(), 0, getLocalLocation());
if (clickboxA == null && clickboxB == null)
{
return null;
}
if (clickboxA != null)
{
clickbox.add(clickboxA);
}
if (clickboxB != null)
{
clickbox.add(clickboxB);
}
return clickbox;
}
}

View File

@@ -0,0 +1,68 @@
package net.runelite.mixins;
import java.awt.Canvas;
import java.awt.event.FocusListener;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSCanvas;
import net.runelite.rs.api.RSClient;
@Mixin(RSCanvas.class)
public abstract class RSCanvasMixin extends Canvas implements RSCanvas
{
@Shadow("client")
private static RSClient client;
// This is inverted because it is false initialized.
@Inject
private static boolean shouldNotHaveFocus;
@Inject
@Override
public void removeFocusListener(FocusListener l)
{
super.removeFocusListener(l);
shouldNotHaveFocus = !this.hasFocus();
}
@Inject
@Override
public void requestFocus()
{
// Runescape requests focus whenever the window is resized. Because of this, PluginPanels cannot have focus
// if they cause the sidebar to expand. This change prevents Runescape from requesting focus whenever it wants
if (!shouldNotHaveFocus)
{
this.requestFocusInWindow();
}
}
@Inject
@Override
public void setSize(int width, int height)
{
if (client.isStretchedEnabled())
{
super.setSize(client.getStretchedDimensions().width, client.getStretchedDimensions().height);
}
else
{
super.setSize(width, height);
}
}
@Inject
@Override
public void setLocation(int x, int y)
{
if (client.isStretchedEnabled())
{
super.setLocation((getParent().getWidth() - client.getStretchedDimensions().width) / 2, 0);
}
else
{
super.setLocation(x, y);
}
}
}

View File

@@ -28,11 +28,11 @@ package net.runelite.mixins;
import net.runelite.api.MessageNode;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSCacheableNode;
import net.runelite.rs.api.RSChatLineBuffer;
import net.runelite.rs.api.RSChatChannel;
import net.runelite.rs.api.RSDualNode;
@Mixin(RSChatLineBuffer.class)
public abstract class RSChatLineBufferMixin implements RSChatLineBuffer
@Mixin(RSChatChannel.class)
public abstract class RSChatChannelMixin implements RSChatChannel
{
@Inject
@Override
@@ -65,7 +65,7 @@ public abstract class RSChatLineBufferMixin implements RSChatLineBuffer
lines[length - 1] = null;
setLength(length - 1);
RSCacheableNode rsCacheableNode = (RSCacheableNode) node;
RSDualNode rsCacheableNode = (RSDualNode) node;
rsCacheableNode.unlink();
rsCacheableNode.unlinkDual();
}

View File

@@ -0,0 +1,47 @@
package net.runelite.mixins;
import net.runelite.api.events.ClanMemberJoined;
import net.runelite.api.events.ClanMemberLeft;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClanChat;
import net.runelite.rs.api.RSClanMate;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSUser;
import net.runelite.rs.api.RSUsername;
@Mixin(RSClanChat.class)
public abstract class RSClanChatMixin implements RSClanChat
{
@Shadow("client")
private static RSClient client;
@Inject
@Override
public void rl$add(RSUsername name, RSUsername prevName)
{
RSClanMate member = findByName(name);
if (member == null)
{
return;
}
ClanMemberJoined event = new ClanMemberJoined(member);
client.getCallbacks().postDeferred(event);
}
@Inject
@Override
public void rl$remove(RSUser nameable)
{
RSClanMate member = findByName(nameable.getRsName());
if (member == null)
{
return;
}
ClanMemberLeft event = new ClanMemberLeft(member);
client.getCallbacks().postDeferred(event);
}
}

View File

@@ -0,0 +1,24 @@
package net.runelite.mixins;
import net.runelite.api.ClanMemberRank;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSClanMate;
@Mixin(RSClanMate.class)
public abstract class RSClanMateMixin implements RSClanMate
{
@Override
@Inject
public String getUsername()
{
return getRsName().getName();
}
@Override
@Inject
public ClanMemberRank getRank()
{
return ClanMemberRank.valueOf(getRSRank());
}
}

View File

@@ -1,77 +0,0 @@
/*
* Copyright (c) 2018, trimbe <github.com/trimbe>
* 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.mixins;
import net.runelite.api.ClanMember;
import net.runelite.api.events.ClanMemberJoined;
import net.runelite.api.events.ClanMemberLeft;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClanMemberManager;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSName;
import net.runelite.rs.api.RSNameable;
@Mixin(RSClanMemberManager.class)
public abstract class RSClanMemberManagerMixin implements RSClanMemberManager
{
@Shadow("clientInstance")
private static RSClient client;
private RSNameable nameable;
private RSName name;
private RSName prevName;
@Inject
@Override
public void rl$add(RSName name, RSName prevName)
{
this.name = name;
this.prevName = prevName;
ClanMember member = findByName(name);
if (member == null)
{
return;
}
ClanMemberJoined event = new ClanMemberJoined(member);
client.getCallbacks().postDeferred(event);
}
@Inject
@Override
public void rl$remove(RSNameable nameable)
{
this.nameable = nameable;
ClanMember member = findByName(nameable.getRsName());
if (member == null)
{
return;
}
ClanMemberLeft event = new ClanMemberLeft(member);
client.getCallbacks().postDeferred(event);
}
}

View File

@@ -1,48 +0,0 @@
/*
* Copyright (c) 2016-2017, 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.mixins;
import net.runelite.api.ClanMemberRank;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSClanMember;
@Mixin(RSClanMember.class)
public abstract class RSClanMemberMixin implements RSClanMember
{
@Override
@Inject
public String getUsername()
{
return getRsName().getName();
}
@Override
@Inject
public ClanMemberRank getRank()
{
return ClanMemberRank.valueOf(getRSRank());
}
}

View File

@@ -24,19 +24,10 @@
*/
package net.runelite.mixins;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
import javax.inject.Named;
import api.vars.AccountType;
import net.runelite.api.ChatMessageType;
import net.runelite.api.ClanMember;
import net.runelite.api.EnumComposition;
import net.runelite.api.EnumDefinition;
import net.runelite.api.Friend;
import net.runelite.api.GameState;
import net.runelite.api.GrandExchangeOffer;
@@ -68,7 +59,7 @@ import net.runelite.api.Point;
import net.runelite.api.Prayer;
import net.runelite.api.Projectile;
import net.runelite.api.Skill;
import net.runelite.api.SpritePixels;
import net.runelite.api.Sprite;
import net.runelite.api.Tile;
import net.runelite.api.VarPlayer;
import net.runelite.api.Varbits;
@@ -99,6 +90,20 @@ import net.runelite.api.events.VarbitChanged;
import net.runelite.api.events.WidgetLoaded;
import net.runelite.api.hooks.Callbacks;
import net.runelite.api.hooks.DrawCallbacks;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.api.widgets.WidgetItem;
import net.runelite.api.widgets.WidgetType;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
import javax.inject.Named;
import net.runelite.api.mixins.Copy;
import net.runelite.api.mixins.FieldHook;
import net.runelite.api.mixins.Inject;
@@ -106,35 +111,30 @@ import net.runelite.api.mixins.MethodHook;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow;
import net.runelite.api.vars.AccountType;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.api.widgets.WidgetItem;
import net.runelite.api.widgets.WidgetType;
import net.runelite.rs.api.RSChatLineBuffer;
import net.runelite.rs.api.RSClanMemberManager;
import org.slf4j.Logger;
import net.runelite.rs.api.RSAbstractIndexCache;
import net.runelite.rs.api.RSChatChannel;
import net.runelite.rs.api.RSClanChat;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSDeque;
import net.runelite.rs.api.RSEnum;
import net.runelite.rs.api.RSFriendContainer;
import net.runelite.rs.api.RSFriendManager;
import net.runelite.rs.api.RSHashTable;
import net.runelite.rs.api.RSIgnoreContainer;
import net.runelite.rs.api.RSIndexDataBase;
import net.runelite.rs.api.RSEnumDefinition;
import net.runelite.rs.api.RSFriendSystem;
import net.runelite.rs.api.RSFriendsList;
import net.runelite.rs.api.RSGroundItem;
import net.runelite.rs.api.RSIgnoreList;
import net.runelite.rs.api.RSIndexedSprite;
import net.runelite.rs.api.RSItem;
import net.runelite.rs.api.RSItemContainer;
import net.runelite.rs.api.RSNPC;
import net.runelite.rs.api.RSName;
import net.runelite.rs.api.RSNodeDeque;
import net.runelite.rs.api.RSNodeHashTable;
import net.runelite.rs.api.RSPlayer;
import net.runelite.rs.api.RSSpritePixels;
import net.runelite.rs.api.RSSprite;
import net.runelite.rs.api.RSUsername;
import net.runelite.rs.api.RSWidget;
import org.slf4j.Logger;
@Mixin(RSClient.class)
public abstract class RSClientMixin implements RSClient
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@Inject
@@ -174,7 +174,7 @@ public abstract class RSClientMixin implements RSClient
private static int oldMenuEntryCount;
@Inject
private static RSItem lastItemDespawn;
private static RSGroundItem lastItemDespawn;
@Inject
private boolean gpu;
@@ -186,13 +186,26 @@ public abstract class RSClientMixin implements RSClient
static int skyboxColor;
@Inject
private final Cache<Integer, RSEnum> enumCache = CacheBuilder.newBuilder()
.maximumSize(64)
.build();
private final Cache<Integer, RSEnumDefinition> enumCache = CacheBuilder.newBuilder()
.maximumSize(64)
.build();
@Inject
private static HealthBarOverride healthBarOverride;
@Inject
private static boolean printMenuActions;
@Inject
private byte[][] spritePixels;
@Inject
@Override
public void setPrintMenuActions(boolean yes)
{
printMenuActions = yes;
}
@Inject
public RSClientMixin()
{
@@ -627,7 +640,7 @@ public abstract class RSClientMixin implements RSClient
oldMenuEntryCount = count;
}
@FieldHook("menuOptionCount")
@FieldHook("menuOptionsCount")
@Inject
public static void onMenuOptionsChanged(int idx)
{
@@ -639,12 +652,12 @@ public abstract class RSClientMixin implements RSClient
if (newCount == oldCount + 1)
{
MenuEntryAdded event = new MenuEntryAdded(
client.getMenuOptions()[newCount - 1],
client.getMenuTargets()[newCount - 1],
client.getMenuTypes()[newCount - 1],
client.getMenuIdentifiers()[newCount - 1],
client.getMenuActionParams0()[newCount - 1],
client.getMenuActionParams1()[newCount - 1]
client.getMenuOptions()[newCount - 1],
client.getMenuTargets()[newCount - 1],
client.getMenuTypes()[newCount - 1],
client.getMenuIdentifiers()[newCount - 1],
client.getMenuActionParams0()[newCount - 1],
client.getMenuActionParams1()[newCount - 1]
);
client.getCallbacks().post(event);
@@ -656,7 +669,7 @@ public abstract class RSClientMixin implements RSClient
public List<Projectile> getProjectiles()
{
List<Projectile> projectiles = new ArrayList<Projectile>();
RSDeque projectileDeque = this.getProjectilesDeque();
RSNodeDeque projectileDeque = this.getProjectilesDeque();
Node head = projectileDeque.getHead();
for (Node node = head.getNext(); node != head; node = node.getNext())
@@ -672,7 +685,7 @@ public abstract class RSClientMixin implements RSClient
public List<GraphicsObject> getGraphicsObjects()
{
List<GraphicsObject> graphicsObjects = new ArrayList<GraphicsObject>();
RSDeque graphicsObjectDeque = this.getGraphicsObjectDeque();
RSNodeDeque graphicsObjectDeque = this.getGraphicsObjectDeque();
Node head = graphicsObjectDeque.getHead();
for (Node node = head.getNext(); node != head; node = node.getNext())
@@ -711,14 +724,14 @@ public abstract class RSClientMixin implements RSClient
setLowMemory(lowMemory);
setSceneLowMemory(lowMemory);
setAudioHighMemory(true);
setObjectCompositionLowDetail(lowMemory);
setObjectDefinitionLowDetail(lowMemory);
}
@Inject
@Override
public RSItemContainer getItemContainer(InventoryID inventory)
{
RSHashTable itemContainers = getItemContainers();
RSNodeHashTable itemContainers = getItemContainers();
return (RSItemContainer) itemContainers.get(inventory.getId());
}
@@ -726,7 +739,7 @@ public abstract class RSClientMixin implements RSClient
@Override
public boolean isFriended(String name, boolean mustBeLoggedIn)
{
RSName rsName = createName(name, getLoginType());
RSUsername rsName = createName(name, getLoginType());
return getFriendManager().isFriended(rsName, mustBeLoggedIn);
}
@@ -734,7 +747,7 @@ public abstract class RSClientMixin implements RSClient
@Override
public int getClanChatCount()
{
final RSClanMemberManager clanMemberManager = getClanMemberManager();
final RSClanChat clanMemberManager = getClanMemberManager();
return clanMemberManager != null ? clanMemberManager.getCount() : 0;
}
@@ -742,7 +755,7 @@ public abstract class RSClientMixin implements RSClient
@Override
public ClanMember[] getClanMembers()
{
final RSClanMemberManager clanMemberManager = getClanMemberManager();
final RSClanChat clanMemberManager = getClanMemberManager();
if (clanMemberManager == null)
{
return null;
@@ -770,13 +783,13 @@ public abstract class RSClientMixin implements RSClient
@Override
public Friend[] getFriends()
{
final RSFriendManager friendManager = getFriendManager();
final RSFriendSystem friendManager = getFriendManager();
if (friendManager == null)
{
return null;
}
final RSFriendContainer friendContainer = friendManager.getFriendContainer();
final RSFriendsList friendContainer = friendManager.getFriendContainer();
if (friendContainer == null)
{
return null;
@@ -790,13 +803,13 @@ public abstract class RSClientMixin implements RSClient
@Override
public int getFriendsCount()
{
final RSFriendManager friendManager = getFriendManager();
final RSFriendSystem friendManager = getFriendManager();
if (friendManager == null)
{
return -1;
}
final RSFriendContainer friendContainer = friendManager.getFriendContainer();
final RSFriendsList friendContainer = friendManager.getFriendContainer();
if (friendContainer == null)
{
return -1;
@@ -809,13 +822,13 @@ public abstract class RSClientMixin implements RSClient
@Override
public Ignore[] getIgnores()
{
final RSFriendManager friendManager = getFriendManager();
final RSFriendSystem friendManager = getFriendManager();
if (friendManager == null)
{
return null;
}
final RSIgnoreContainer ignoreContainer = friendManager.getIgnoreContainer();
final RSIgnoreList ignoreContainer = friendManager.getIgnoreContainer();
if (ignoreContainer == null)
{
return null;
@@ -829,13 +842,13 @@ public abstract class RSClientMixin implements RSClient
@Override
public int getIgnoreCount()
{
final RSFriendManager friendManager = getFriendManager();
final RSFriendSystem friendManager = getFriendManager();
if (friendManager == null)
{
return -1;
}
final RSIgnoreContainer ignoreContainer = friendManager.getIgnoreContainer();
final RSIgnoreList ignoreContainer = friendManager.getIgnoreContainer();
if (ignoreContainer == null)
{
return -1;
@@ -848,11 +861,11 @@ public abstract class RSClientMixin implements RSClient
@Override
public boolean isClanMember(String name)
{
final RSClanMemberManager clanMemberManager = getClanMemberManager();
final RSClanChat clanMemberManager = getClanMemberManager();
return clanMemberManager != null && clanMemberManager.isMember(createName(name, getLoginType()));
}
@FieldHook("draggingWidget")
@FieldHook("clickedWidget")
@Inject
public static void draggingWidgetChanged(int idx)
{
@@ -863,7 +876,7 @@ public abstract class RSClientMixin implements RSClient
@Inject
@Override
public SpritePixels createItemSprite(int itemId, int quantity, int border, int shadowColor, int stackable, boolean noted, int scale)
public Sprite createItemSprite(int itemId, int quantity, int border, int shadowColor, int stackable, boolean noted, int scale)
{
assert isClientThread();
int zoom = get3dZoom();
@@ -900,7 +913,7 @@ public abstract class RSClientMixin implements RSClient
}
}
@FieldHook("itemPressedDuration")
@FieldHook("itemDragDuration")
@Inject
public static void itemPressedDurationChanged(int idx)
{
@@ -922,7 +935,7 @@ public abstract class RSClientMixin implements RSClient
}
}
@FieldHook("skillExperiences")
@FieldHook("experience")
@Inject
public static void experiencedChanged(int idx)
{
@@ -938,7 +951,7 @@ public abstract class RSClientMixin implements RSClient
}
}
@FieldHook("boostedSkillLevels")
@FieldHook("currentLevels")
@Inject
public static void boostedSkillLevelsChanged(int idx)
{
@@ -953,13 +966,13 @@ public abstract class RSClientMixin implements RSClient
}
}
@FieldHook("playerOptions")
@FieldHook("playerMenuActions")
@Inject
public static void playerOptionsChanged(int idx)
{
// Reset the menu type
MenuAction[] playerActions = {PLAYER_FIRST_OPTION, PLAYER_SECOND_OPTION, PLAYER_THIRD_OPTION, PLAYER_FOURTH_OPTION,
PLAYER_FIFTH_OPTION, PLAYER_SIXTH_OPTION, PLAYER_SEVENTH_OPTION, PLAYER_EIGTH_OPTION};
PLAYER_FIFTH_OPTION, PLAYER_SIXTH_OPTION, PLAYER_SEVENTH_OPTION, PLAYER_EIGTH_OPTION};
if (idx >= 0 && idx < playerActions.length)
{
MenuAction playerAction = playerActions[idx];
@@ -981,7 +994,7 @@ public abstract class RSClientMixin implements RSClient
}
@FieldHook("cachedNPCs")
@FieldHook("npcs")
@Inject
public static void cachedNPCsChanged(int idx)
{
@@ -1000,7 +1013,7 @@ public abstract class RSClientMixin implements RSClient
}
}
@FieldHook("cachedPlayers")
@FieldHook("players")
@Inject
public static void cachedPlayersChanged(int idx)
{
@@ -1046,7 +1059,7 @@ public abstract class RSClientMixin implements RSClient
client.getCallbacks().post(offerChangedEvent);
}
@FieldHook("clientVarps")
@FieldHook("Varps_main")
@Inject
public static void settingsChanged(int idx)
{
@@ -1055,7 +1068,7 @@ public abstract class RSClientMixin implements RSClient
client.getCallbacks().post(varbitChanged);
}
@FieldHook("isResized")
@FieldHook("isResizable")
@Inject
public static void resizeChanged(int idx)
{
@@ -1072,7 +1085,7 @@ public abstract class RSClientMixin implements RSClient
}
}
@FieldHook("clanMemberManager")
@FieldHook("clanChat")
@Inject
public static void clanMemberManagerChanged(int idx)
{
@@ -1221,6 +1234,11 @@ public abstract class RSClientMixin implements RSClient
@Replace("menuAction")
static void rl$menuAction(int actionParam, int widgetId, int menuAction, int id, String menuOption, String menuTarget, int var6, int var7)
{
if (printMenuActions && client.getLogger().isDebugEnabled())
{
client.getLogger().debug("Menuaction: {} {} {} {} {} {} {} {}", actionParam, widgetId, menuAction, id, menuOption, menuTarget, var6, var7);
}
/* Along the way, the RuneScape client may change a menuAction by incrementing it with 2000.
* I have no idea why, but it does. Their code contains the same conditional statement.
*/
@@ -1246,7 +1264,7 @@ public abstract class RSClientMixin implements RSClient
rs$menuAction(actionParam, widgetId, menuAction, id, menuOption, menuTarget, var6, var7);
}
@FieldHook("username")
@FieldHook("Login_username")
@Inject
public static void onUsernameChanged(int idx)
{
@@ -1309,8 +1327,8 @@ public abstract class RSClientMixin implements RSClient
}
// Get the message node which was added
Map<Integer, RSChatLineBuffer> chatLineMap = client.getChatLineMap();
RSChatLineBuffer chatLineBuffer = chatLineMap.get(type);
Map<Integer, RSChatChannel> chatLineMap = client.getChatLineMap();
RSChatChannel chatLineBuffer = chatLineMap.get(type);
MessageNode messageNode = chatLineBuffer.getLines()[0];
final ChatMessageType chatMessageType = ChatMessageType.of(type);
@@ -1325,7 +1343,7 @@ public abstract class RSClientMixin implements RSClient
callbacks.clientMainLoop();
}
@MethodHook("renderWidgetLayer")
@MethodHook("drawWidgetGroup")
@Inject
public static void renderWidgetLayer(Widget[] widgets, int parentId, int minX, int minY, int maxX, int maxY, int x, int y, int var8)
{
@@ -1388,14 +1406,14 @@ public abstract class RSClientMixin implements RSClient
@Inject
@Override
public RSItem getLastItemDespawn()
public RSGroundItem getLastItemDespawn()
{
return lastItemDespawn;
}
@Inject
@Override
public void setLastItemDespawn(RSItem lastItemDespawn)
public void setLastItemDespawn(RSGroundItem lastItemDespawn)
{
RSClientMixin.lastItemDespawn = lastItemDespawn;
}
@@ -1426,9 +1444,9 @@ public abstract class RSClientMixin implements RSClient
@Inject
@Override
public RSSpritePixels[] getSprites(IndexDataBase source, int archiveId, int fileId)
public RSSprite[] getSprites(IndexDataBase source, int archiveId, int fileId)
{
RSIndexDataBase rsSource = (RSIndexDataBase) source;
RSAbstractIndexCache rsSource = (RSAbstractIndexCache) source;
byte[] configData = rsSource.getConfigData(archiveId, fileId);
if (configData == null)
{
@@ -1442,12 +1460,12 @@ public abstract class RSClientMixin implements RSClient
int maxHeight = getIndexedSpriteHeight();
int[] offsetX = getIndexedSpriteOffsetXs();
int[] offsetY = getIndexedSpriteOffsetYs();
int[] widths = getIndexSpriteWidths();
int[] widths = getIndexedSpriteWidths();
int[] heights = getIndexedSpriteHeights();
byte[][] spritePixelsArray = getSpritePixels();
int[] indexedSpritePalette = getIndexedSpritePalette();
RSSpritePixels[] array = new RSSpritePixels[indexedSpriteCount];
RSSprite[] array = new RSSprite[indexedSpriteCount];
for (int i = 0; i < indexedSpriteCount; ++i)
{
@@ -1457,7 +1475,7 @@ public abstract class RSClientMixin implements RSClient
byte[] pixelArray = spritePixelsArray[i];
int[] pixels = new int[width * height];
RSSpritePixels spritePixels = createSpritePixels(pixels, width, height);
RSSprite spritePixels = createSprite(pixels, width, height);
spritePixels.setMaxHeight(maxHeight);
spritePixels.setMaxWidth(maxWidth);
spritePixels.setOffsetX(offsetX[i]);
@@ -1473,14 +1491,26 @@ public abstract class RSClientMixin implements RSClient
setIndexedSpriteOffsetXs(null);
setIndexedSpriteOffsetYs(null);
setIndexSpriteWidths(null);
setIndexedSpriteWidths(null);
setIndexedSpriteHeights(null);
setIndexSpritePalette(null);
setIndexedSpritePalette(null);
setSpritePixels(null);
return array;
}
@Inject
@Override
public byte[][] getSpritePixels() {
return spritePixels;
}
@Inject
@Override
public void setSpritePixels(byte[][] sprites) {
spritePixels = sprites;
}
@Inject
@Override
public void setSkyboxColor(int newSkyboxColor)
@@ -1536,18 +1566,18 @@ public abstract class RSClientMixin implements RSClient
@Inject
@Override
public EnumComposition getEnum(int id)
public EnumDefinition getEnum(int id)
{
assert isClientThread() : "getEnum must be called on client thread";
RSEnum rsEnum = enumCache.getIfPresent(id);
if (rsEnum != null)
RSEnumDefinition rsEnumDefinition = enumCache.getIfPresent(id);
if (rsEnumDefinition != null)
{
return rsEnum;
return rsEnumDefinition;
}
rsEnum = getRsEnum(id);
enumCache.put(id, rsEnum);
return rsEnum;
rsEnumDefinition = getRsEnum(id);
enumCache.put(id, rsEnumDefinition);
return rsEnumDefinition;
}
}

View File

@@ -37,7 +37,7 @@ import net.runelite.rs.api.RSModel;
@Mixin(RSDynamicObject.class)
public abstract class RSDynamicObjectMixin implements RSDynamicObject
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@Copy("getModel")
@@ -67,7 +67,7 @@ public abstract class RSDynamicObjectMixin implements RSDynamicObject
}
}
@FieldHook("animCycleCount")
@FieldHook("cycleStart")
@Inject
public void onAnimCycleCountChanged(int idx)
{

View File

@@ -0,0 +1,51 @@
package net.runelite.mixins;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSEnumDefinition;
@Mixin(RSEnumDefinition.class)
public abstract class RSEnumDefinitionMixin implements RSEnumDefinition
{
@Inject
@Override
public int getIntValue(int key)
{
final int[] keys = getKeys();
if (keys == null)
{
return getDefaultInt();
}
for (int i = 0; i < keys.length; ++i)
{
if (keys[i] == key)
{
final int[] values = getIntVals();
return values[i];
}
}
return getDefaultInt();
}
@Inject
@Override
public String getStringValue(int key)
{
final int[] keys = getKeys();
if (keys == null)
{
return getDefaultString();
}
for (int i = 0; i < keys.length; ++i)
{
if (keys[i] == key)
{
final String[] values = getStringVals();
return values[i];
}
}
return getDefaultString();
}
}

View File

@@ -1,75 +0,0 @@
/*
* Copyright (c) 2019, 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.mixins;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSEnum;
@Mixin(RSEnum.class)
public abstract class RSEnumMixin implements RSEnum
{
@Inject
@Override
public int getIntValue(int key)
{
final int[] keys = getKeys();
if (keys == null)
{
return getDefaultInt();
}
for (int i = 0; i < keys.length; ++i)
{
if (keys[i] == key)
{
final int[] values = getIntVals();
return values[i];
}
}
return getDefaultInt();
}
@Inject
@Override
public String getStringValue(int key)
{
final int[] keys = getKeys();
if (keys == null)
{
return getDefaultString();
}
for (int i = 0; i < keys.length; ++i)
{
if (keys[i] == key)
{
final String[] values = getStringVals();
return values[i];
}
}
return getDefaultString();
}
}

View File

@@ -0,0 +1,61 @@
package net.runelite.mixins;
import net.runelite.api.Model;
import net.runelite.api.Perspective;
import net.runelite.api.Renderable;
import java.awt.geom.Area;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSFloorDecoration;
@Mixin(RSFloorDecoration.class)
public abstract class RSFloorDecorationMixin implements RSFloorDecoration
{
@Shadow("client")
private static RSClient client;
@Inject
private int groundObjectPlane;
@Inject
@Override
public int getPlane()
{
return groundObjectPlane;
}
@Inject
@Override
public void setPlane(int plane)
{
this.groundObjectPlane = plane;
}
@Inject
private Model getModel()
{
Renderable renderable = getRenderable();
if (renderable == null)
{
return null;
}
if (renderable instanceof Model)
{
return (Model) renderable;
}
else
{
return renderable.getModel();
}
}
@Inject
@Override
public Area getClickbox()
{
return Perspective.getClickbox(client, getModel(), 0, getLocalLocation());
}
}

View File

@@ -1,48 +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.mixins;
import net.runelite.api.events.RemovedFriend;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.MethodHook;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSFriendManager;
@Mixin(RSFriendManager.class)
public abstract class RSFriendManagerMixin implements RSFriendManager
{
@Shadow("clientInstance")
private static RSClient client;
@MethodHook("removeFriend")
@Inject
public void rl$removeFriend(String friendName)
{
RemovedFriend removedFriend = new RemovedFriend(friendName);
client.getCallbacks().post(removedFriend);
}
}

View File

@@ -27,7 +27,7 @@ package net.runelite.mixins;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSFriend;
import net.runelite.rs.api.RSName;
import net.runelite.rs.api.RSUsername;
@Mixin(RSFriend.class)
public abstract class RSFriendMixin implements RSFriend
@@ -43,7 +43,7 @@ public abstract class RSFriendMixin implements RSFriend
@Inject
public String getPrevName()
{
RSName prevName = getRsPrevName();
RSUsername prevName = getRsPrevName();
return prevName == null ? null : prevName.getName();
}
}

View File

@@ -0,0 +1,24 @@
package net.runelite.mixins;
import net.runelite.api.events.RemovedFriend;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.MethodHook;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSFriendSystem;
@Mixin(RSFriendSystem.class)
public abstract class RSFriendSystemMixin implements RSFriendSystem
{
@Shadow("client")
private static RSClient client;
@MethodHook("removeFriend")
@Inject
public void rl$removeFriend(String friendName)
{
RemovedFriend removedFriend = new RemovedFriend(friendName);
client.getCallbacks().post(removedFriend);
}
}

View File

@@ -1,93 +0,0 @@
/*
* Copyright (c) 2018 Abex
* Copyright (c) 2018, Lotto <https://github.com/devLotto>
* 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.mixins;
import java.awt.Canvas;
import java.awt.event.FocusListener;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSGameCanvas;
@Mixin(RSGameCanvas.class)
public abstract class RSGameCanvasMixin extends Canvas implements RSGameCanvas
{
@Shadow("clientInstance")
private static RSClient client;
// This is inverted because it is false initialized.
@Inject
private static boolean shouldNotHaveFocus;
@Inject
@Override
public void removeFocusListener(FocusListener l)
{
super.removeFocusListener(l);
shouldNotHaveFocus = !this.hasFocus();
}
@Inject
@Override
public void requestFocus()
{
// Runescape requests focus whenever the window is resized. Because of this, PluginPanels cannot have focus
// if they cause the sidebar to expand. This change prevents Runescape from requesting focus whenever it wants
if (!shouldNotHaveFocus)
{
this.requestFocusInWindow();
}
}
@Inject
@Override
public void setSize(int width, int height)
{
if (client.isStretchedEnabled())
{
super.setSize(client.getStretchedDimensions().width, client.getStretchedDimensions().height);
}
else
{
super.setSize(width, height);
}
}
@Inject
@Override
public void setLocation(int x, int y)
{
if (client.isStretchedEnabled())
{
super.setLocation((getParent().getWidth() - client.getStretchedDimensions().width) / 2, 0);
}
else
{
super.setLocation(x, y);
}
}
}

View File

@@ -24,24 +24,24 @@
*/
package net.runelite.mixins;
import java.awt.Polygon;
import java.awt.geom.Area;
import net.runelite.api.Perspective;
import net.runelite.api.Point;
import net.runelite.api.coords.Angle;
import net.runelite.api.coords.LocalPoint;
import java.awt.Polygon;
import java.awt.geom.Area;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSEntity;
import net.runelite.rs.api.RSGameObject;
import net.runelite.rs.api.RSModel;
import net.runelite.rs.api.RSRenderable;
@Mixin(RSGameObject.class)
public abstract class RSGameObjectMixin implements RSGameObject
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@Inject
@@ -61,7 +61,7 @@ public abstract class RSGameObjectMixin implements RSGameObject
@Inject
private RSModel getModel()
{
RSRenderable renderable = getRenderable();
RSEntity renderable = getRenderable();
if (renderable == null)
{
return null;

View File

@@ -24,21 +24,21 @@
*/
package net.runelite.mixins;
import java.awt.event.FocusEvent;
import net.runelite.api.events.FocusChanged;
import net.runelite.api.hooks.DrawCallbacks;
import java.awt.event.FocusEvent;
import net.runelite.api.mixins.FieldHook;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.MethodHook;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSGameEngine;
import net.runelite.rs.api.RSGameShell;
@Mixin(RSGameEngine.class)
public abstract class RSGameEngineMixin implements RSGameEngine
@Mixin(RSGameShell.class)
public abstract class RSGameShellMixin implements RSGameShell
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@Inject
@@ -86,7 +86,7 @@ public abstract class RSGameEngineMixin implements RSGameEngine
}
}
@FieldHook("replaceCanvasNextFrame")
@FieldHook("isCanvasInvalid")
@Inject
public void onReplaceCanvasNextFrameChanged(int idx)
{

View File

@@ -0,0 +1,30 @@
package net.runelite.mixins;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.events.GraphicsObjectCreated;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSGraphicsObject;
@Mixin(RSGraphicsObject.class)
public abstract class RSGraphicsObjectMixin implements RSGraphicsObject
{
@Shadow("client")
private static RSClient client;
@Inject
RSGraphicsObjectMixin()
{
final GraphicsObjectCreated event = new GraphicsObjectCreated(this);
client.getCallbacks().post(event);
}
@Override
@Inject
public LocalPoint getLocation()
{
return new LocalPoint(this.getX(), this.getY());
}
}

View File

@@ -1,27 +1,3 @@
/*
* 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.mixins;
import net.runelite.api.Tile;
@@ -31,12 +7,12 @@ import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSItem;
import net.runelite.rs.api.RSGroundItem;
@Mixin(RSItem.class)
public abstract class RSItemMixin implements RSItem
@Mixin(RSGroundItem.class)
public abstract class RSGroundItemMixin implements RSGroundItem
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@Inject
@@ -46,7 +22,7 @@ public abstract class RSItemMixin implements RSItem
private int rl$sceneY = -1;
@Inject
RSItemMixin()
RSGroundItemMixin()
{
}

View File

@@ -0,0 +1,34 @@
package net.runelite.mixins;
import java.awt.geom.Area;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSGroundItemPile;
@Mixin(RSGroundItemPile.class)
public abstract class RSGroundItemPileMixin implements RSGroundItemPile
{
@Inject
private int itemLayerPlane;
@Inject
@Override
public int getPlane()
{
return itemLayerPlane;
}
@Inject
@Override
public void setPlane(int plane)
{
this.itemLayerPlane = plane;
}
@Inject
@Override
public Area getClickbox()
{
throw new UnsupportedOperationException();
}
}

View File

@@ -1,85 +0,0 @@
/*
* Copyright (c) 2018, SomeoneWithAnInternetConnection
* 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.mixins;
import java.awt.geom.Area;
import net.runelite.api.Model;
import net.runelite.api.Perspective;
import net.runelite.api.Renderable;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSGroundObject;
@Mixin(RSGroundObject.class)
public abstract class RSGroundObjectMixin implements RSGroundObject
{
@Shadow("clientInstance")
private static RSClient client;
@Inject
private int groundObjectPlane;
@Inject
@Override
public int getPlane()
{
return groundObjectPlane;
}
@Inject
@Override
public void setPlane(int plane)
{
this.groundObjectPlane = plane;
}
@Inject
private Model getModel()
{
Renderable renderable = getRenderable();
if (renderable == null)
{
return null;
}
if (renderable instanceof Model)
{
return (Model) renderable;
}
else
{
return renderable.getModel();
}
}
@Inject
@Override
public Area getClickbox()
{
return Perspective.getClickbox(client, getModel(), 0, getLocalLocation());
}
}

View File

@@ -1,63 +0,0 @@
/*
* Copyright (c) 2016-2017, 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.mixins;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import net.runelite.api.Node;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSHashTable;
import net.runelite.rs.api.RSNode;
@Mixin(RSHashTable.class)
public abstract class RSHashTableMixin implements RSHashTable
{
@Inject
@Override
public Collection<Node> getNodes()
{
// Copied in RSWidgetMixin.getParentId to reduce allocations
List<Node> nodes = new ArrayList<Node>();
RSNode[] buckets = getBuckets();
for (int i = 0; i < buckets.length; ++i)
{
Node node = buckets[i];
// It looks like the first node in the bucket is always
// a sentinel
Node cur = node.getNext();
while (cur != node)
{
nodes.add(cur);
cur = cur.getNext();
}
}
return nodes;
}
}

View File

@@ -0,0 +1,89 @@
package net.runelite.mixins;
import net.runelite.api.HealthBarOverride;
import net.runelite.api.events.PostHealthBar;
import net.runelite.api.mixins.Copy;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.MethodHook;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSBuffer;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSHealthBarDefinition;
import net.runelite.rs.api.RSSprite;
@Mixin(RSHealthBarDefinition.class)
public abstract class RSHealthBarDefinitionMixin implements RSHealthBarDefinition
{
// Larger values are used for bosses like Corporeal Beast
private static final int DEFAULT_HEALTH_SCALE = 30;
@Shadow("client")
private static RSClient client;
@Shadow("healthBarOverride")
private static HealthBarOverride healthBarOverride;
@Copy("getSprite2")
abstract RSSprite rs$getHealthBarBackSprite();
@Replace("getSprite2")
public RSSprite rl$getHealthBarBackSprite()
{
/*
* If this combat info already uses sprites for health bars,
* use those instead, and don't override.
*/
RSSprite pixels = rs$getHealthBarBackSprite();
if (pixels != null)
{
return pixels;
}
if (healthBarOverride == null)
{
return null;
}
return getHealthScale() == DEFAULT_HEALTH_SCALE
? (RSSprite) healthBarOverride.backSprite
: (RSSprite) healthBarOverride.backSpriteLarge;
}
@Copy("getSprite1")
abstract RSSprite rs$getHealthBarFrontSprite();
@Replace("getSprite1")
public RSSprite rl$getHealthBarFrontSprite()
{
/*
* If this combat info already uses sprites for health bars,
* use those instead, and don't override.
*/
RSSprite pixels = rs$getHealthBarFrontSprite();
if (pixels != null)
{
return pixels;
}
if (healthBarOverride == null)
{
return null;
}
// 30 is the default size, large is for bosses like Corporeal Beast
return getHealthScale() == DEFAULT_HEALTH_SCALE
? (RSSprite) healthBarOverride.frontSprite
: (RSSprite) healthBarOverride.frontSpriteLarge;
}
@MethodHook(value = "read", end = true)
@Inject
public void onRead(RSBuffer buffer)
{
PostHealthBar postHealthBar = new PostHealthBar();
postHealthBar.setHealthBar(this);
client.getCallbacks().post(postHealthBar);
}
}

View File

@@ -1,113 +0,0 @@
/*
* Copyright (c) 2019, Lotto <https://github.com/devLotto>
* 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.mixins;
import net.runelite.api.HealthBarOverride;
import net.runelite.api.events.PostHealthBar;
import net.runelite.api.mixins.Copy;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.MethodHook;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSBuffer;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSHealthBar;
import net.runelite.rs.api.RSSpritePixels;
@Mixin(RSHealthBar.class)
public abstract class RSHealthBarMixin implements RSHealthBar
{
// Larger values are used for bosses like Corporeal Beast
private static final int DEFAULT_HEALTH_SCALE = 30;
@Shadow("clientInstance")
private static RSClient client;
@Shadow("healthBarOverride")
private static HealthBarOverride healthBarOverride;
@Copy("getHealthBarBackSprite")
abstract RSSpritePixels rs$getHealthBarBackSprite();
@Replace("getHealthBarBackSprite")
public RSSpritePixels rl$getHealthBarBackSprite()
{
/*
* If this combat info already uses sprites for health bars,
* use those instead, and don't override.
*/
RSSpritePixels pixels = rs$getHealthBarBackSprite();
if (pixels != null)
{
return pixels;
}
if (healthBarOverride == null)
{
return null;
}
return getHealthScale() == DEFAULT_HEALTH_SCALE
? (RSSpritePixels) healthBarOverride.backSprite
: (RSSpritePixels) healthBarOverride.backSpriteLarge;
}
@Copy("getHealthBarFrontSprite")
abstract RSSpritePixels rs$getHealthBarFrontSprite();
@Replace("getHealthBarFrontSprite")
public RSSpritePixels rl$getHealthBarFrontSprite()
{
/*
* If this combat info already uses sprites for health bars,
* use those instead, and don't override.
*/
RSSpritePixels pixels = rs$getHealthBarFrontSprite();
if (pixels != null)
{
return pixels;
}
if (healthBarOverride == null)
{
return null;
}
// 30 is the default size, large is for bosses like Corporeal Beast
return getHealthScale() == DEFAULT_HEALTH_SCALE
? (RSSpritePixels) healthBarOverride.frontSprite
: (RSSpritePixels) healthBarOverride.frontSpriteLarge;
}
@MethodHook(value = "read", end = true)
@Inject
public void onRead(RSBuffer buffer)
{
PostHealthBar postHealthBar = new PostHealthBar();
postHealthBar.setHealthBar(this);
client.getCallbacks().post(postHealthBar);
}
}

View File

@@ -1,49 +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.mixins;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSIgnore;
import net.runelite.rs.api.RSName;
@Mixin(RSIgnore.class)
public abstract class RSIgnoreMixin implements RSIgnore
{
@Override
@Inject
public String getName()
{
return getRsName().getName();
}
@Override
@Inject
public String getPrevName()
{
RSName prevName = getRsPrevName();
return prevName == null ? null : prevName.getName();
}
}

View File

@@ -0,0 +1,25 @@
package net.runelite.mixins;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSIgnored;
import net.runelite.rs.api.RSUsername;
@Mixin(RSIgnored.class)
public abstract class RSIgnoredMixin implements RSIgnored
{
@Override
@Inject
public String getName()
{
return getRsName().getName();
}
@Override
@Inject
public String getPrevName()
{
RSUsername prevName = getRsPrevName();
return prevName == null ? null : prevName.getName();
}
}

View File

@@ -1,92 +0,0 @@
/*
* Copyright (c) 2018, SomeoneWithAnInternetConnection
* 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.mixins;
import net.runelite.api.events.PostItemComposition;
import net.runelite.api.mixins.Copy;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.MethodHook;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSItemComposition;
@Mixin(RSItemComposition.class)
public abstract class RSItemCompositionMixin implements RSItemComposition
{
private static final int DEFAULT_CUSTOM_SHIFT_CLICK_INDEX = -2;
@Shadow("clientInstance")
private static RSClient client;
@Inject
private int shiftClickActionIndex = DEFAULT_CUSTOM_SHIFT_CLICK_INDEX;
@Inject
RSItemCompositionMixin()
{
}
@Inject
@Override
public boolean isStackable()
{
return getIsStackable() != 0;
}
@Inject
@Override
public void setShiftClickActionIndex(int shiftClickActionIndex)
{
this.shiftClickActionIndex = shiftClickActionIndex;
}
@Copy("getShiftClickActionIndex")
abstract int rs$getShiftClickActionIndex();
@Replace("getShiftClickActionIndex")
public int getShiftClickActionIndex()
{
return shiftClickActionIndex == DEFAULT_CUSTOM_SHIFT_CLICK_INDEX ? rs$getShiftClickActionIndex() : shiftClickActionIndex;
}
@Inject
@Override
public void resetShiftClickActionIndex()
{
shiftClickActionIndex = DEFAULT_CUSTOM_SHIFT_CLICK_INDEX;
}
@Inject
@MethodHook(value = "post", end = true)
public void post()
{
final PostItemComposition event = new PostItemComposition();
event.setItemComposition(this);
client.getCallbacks().post(event);
}
}

View File

@@ -31,13 +31,13 @@ import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSItem;
import net.runelite.rs.api.RSGroundItem;
import net.runelite.rs.api.RSItemContainer;
@Mixin(RSItemContainer.class)
public abstract class RSItemContainerMixin implements RSItemContainer
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@Inject
@@ -53,7 +53,7 @@ public abstract class RSItemContainerMixin implements RSItemContainer
for (int i = 0; i < itemIds.length; ++i)
{
RSItem item = client.createItem();
RSGroundItem item = client.createItem();
item.setId(itemIds[i]);
item.setQuantity(stackSizes[i]);
items[i] = item;
@@ -62,7 +62,7 @@ public abstract class RSItemContainerMixin implements RSItemContainer
return items;
}
@FieldHook("stackSizes")
@FieldHook("quantities")
@Inject
public void stackSizesChanged(int idx)
{

View File

@@ -0,0 +1,67 @@
package net.runelite.mixins;
import net.runelite.api.events.PostItemDefinition;
import net.runelite.api.mixins.Copy;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.MethodHook;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSItemDefinition;
@Mixin(RSItemDefinition.class)
public abstract class RSItemDefinitionMixin implements RSItemDefinition
{
private static final int DEFAULT_CUSTOM_SHIFT_CLICK_INDEX = -2;
@Shadow("client")
private static RSClient client;
@Inject
private int shiftClickActionIndex = DEFAULT_CUSTOM_SHIFT_CLICK_INDEX;
@Inject
RSItemDefinitionMixin()
{
}
@Inject
@Override
public boolean isStackable()
{
return getIsStackable() != 0;
}
@Inject
@Override
public void setShiftClickActionIndex(int shiftClickActionIndex)
{
this.shiftClickActionIndex = shiftClickActionIndex;
}
@Copy("getShiftClickIndex")
abstract int rs$getShiftClickActionIndex();
@Replace("getShiftClickIndex")
public int getShiftClickActionIndex()
{
return shiftClickActionIndex == DEFAULT_CUSTOM_SHIFT_CLICK_INDEX ? rs$getShiftClickActionIndex() : shiftClickActionIndex;
}
@Inject
@Override
public void resetShiftClickActionIndex()
{
shiftClickActionIndex = DEFAULT_CUSTOM_SHIFT_CLICK_INDEX;
}
@Inject
@MethodHook(value = "post", end = true)
public void post()
{
final PostItemDefinition event = new PostItemDefinition();
event.setItemDefinition(this);
client.getCallbacks().post(event);
}
}

View File

@@ -1,58 +0,0 @@
/*
* Copyright (c) 2018, SomeoneWithAnInternetConnection
* 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.mixins;
import java.awt.geom.Area;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSItemLayer;
@Mixin(RSItemLayer.class)
public abstract class RSItemLayerMixin implements RSItemLayer
{
@Inject
private int itemLayerPlane;
@Inject
@Override
public int getPlane()
{
return itemLayerPlane;
}
@Inject
@Override
public void setPlane(int plane)
{
this.itemLayerPlane = plane;
}
@Inject
@Override
public Area getClickbox()
{
throw new UnsupportedOperationException();
}
}

View File

@@ -1,95 +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.mixins;
import java.awt.event.FocusEvent;
import java.awt.event.KeyEvent;
import net.runelite.api.events.FocusChanged;
import net.runelite.api.mixins.Copy;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.MethodHook;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSKeyFocusListener;
@Mixin(RSKeyFocusListener.class)
public abstract class RSKeyFocusListenerMixin implements RSKeyFocusListener
{
@Shadow("clientInstance")
private static RSClient client;
@Copy("keyPressed")
abstract void rs$keyPressed(KeyEvent keyEvent);
@Copy("keyReleased")
abstract void rs$keyReleased(KeyEvent keyEvent);
@Copy("keyTyped")
abstract void rs$keyTyped(KeyEvent keyEvent);
@Override
@Replace("keyPressed")
public final synchronized void keyPressed(KeyEvent keyEvent)
{
client.getCallbacks().keyPressed(keyEvent);
if (!keyEvent.isConsumed())
{
rs$keyPressed(keyEvent);
}
}
@Override
@Replace("keyReleased")
public final synchronized void keyReleased(KeyEvent keyEvent)
{
client.getCallbacks().keyReleased(keyEvent);
if (!keyEvent.isConsumed())
{
rs$keyReleased(keyEvent);
}
}
@Override
@Replace("keyTyped")
public final void keyTyped(KeyEvent keyEvent)
{
client.getCallbacks().keyTyped(keyEvent);
if (!keyEvent.isConsumed())
{
rs$keyTyped(keyEvent);
}
}
@Inject
@MethodHook("focusLost")
public void onFocusLost(FocusEvent focusEvent)
{
final FocusChanged focusChanged = new FocusChanged();
focusChanged.setFocused(false);
client.getCallbacks().post(focusChanged);
}
}

View File

@@ -0,0 +1,71 @@
package net.runelite.mixins;
import net.runelite.api.events.FocusChanged;
import java.awt.event.FocusEvent;
import java.awt.event.KeyEvent;
import net.runelite.api.mixins.Copy;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.MethodHook;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSKeyHandler;
@Mixin(RSKeyHandler.class)
public abstract class RSKeyHandlerMixin implements RSKeyHandler
{
@Shadow("client")
private static RSClient client;
@Copy("keyPressed")
abstract void rs$keyPressed(KeyEvent keyEvent);
@Copy("keyReleased")
abstract void rs$keyReleased(KeyEvent keyEvent);
@Copy("keyTyped")
abstract void rs$keyTyped(KeyEvent keyEvent);
@Override
@Replace("keyPressed")
public final synchronized void keyPressed(KeyEvent keyEvent)
{
client.getCallbacks().keyPressed(keyEvent);
if (!keyEvent.isConsumed())
{
rs$keyPressed(keyEvent);
}
}
@Override
@Replace("keyReleased")
public final synchronized void keyReleased(KeyEvent keyEvent)
{
client.getCallbacks().keyReleased(keyEvent);
if (!keyEvent.isConsumed())
{
rs$keyReleased(keyEvent);
}
}
@Override
@Replace("keyTyped")
public final void keyTyped(KeyEvent keyEvent)
{
client.getCallbacks().keyTyped(keyEvent);
if (!keyEvent.isConsumed())
{
rs$keyTyped(keyEvent);
}
}
@Inject
@MethodHook("focusLost")
public void onFocusLost(FocusEvent focusEvent)
{
final FocusChanged focusChanged = new FocusChanged();
focusChanged.setFocused(false);
client.getCallbacks().post(focusChanged);
}
}

View File

@@ -0,0 +1,73 @@
package net.runelite.mixins;
import net.runelite.api.ChatMessageType;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.MethodHook;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSMessage;
@Mixin(RSMessage.class)
public abstract class RSMessageMixin implements RSMessage
{
@Shadow("client")
private static RSClient client;
@Inject
private String runeLiteFormatMessage;
@Inject
private int rl$timestamp;
@Inject
RSMessageMixin()
{
rl$timestamp = (int) (System.currentTimeMillis() / 1000L);
}
@Inject
@Override
public ChatMessageType getType()
{
return ChatMessageType.of(getRSType());
}
@Inject
@Override
public String getRuneLiteFormatMessage()
{
return runeLiteFormatMessage;
}
@Inject
@Override
public void setRuneLiteFormatMessage(String runeLiteFormatMessage)
{
this.runeLiteFormatMessage = runeLiteFormatMessage;
}
@Inject
@Override
public int getTimestamp()
{
return rl$timestamp;
}
@Inject
@Override
public void setTimestamp(int timestamp)
{
this.rl$timestamp = timestamp;
}
@Inject
@MethodHook(value = "set", end = true)
public void setMessage(int type, String name, String sender, String value)
{
// Message nodes get reused after a time by calling setMessage.
// Clear the runelite formatted message then.
runeLiteFormatMessage = null;
rl$timestamp = (int) (System.currentTimeMillis() / 1000L);
}
}

View File

@@ -1,97 +0,0 @@
/*
* Copyright (c) 2016-2017, 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.mixins;
import net.runelite.api.ChatMessageType;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.MethodHook;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSMessageNode;
@Mixin(RSMessageNode.class)
public abstract class RSMessageNodeMixin implements RSMessageNode
{
@Shadow("clientInstance")
private static RSClient client;
@Inject
private String runeLiteFormatMessage;
@Inject
private int rl$timestamp;
@Inject
RSMessageNodeMixin()
{
rl$timestamp = (int) (System.currentTimeMillis() / 1000L);
}
@Inject
@Override
public ChatMessageType getType()
{
return ChatMessageType.of(getRSType());
}
@Inject
@Override
public String getRuneLiteFormatMessage()
{
return runeLiteFormatMessage;
}
@Inject
@Override
public void setRuneLiteFormatMessage(String runeLiteFormatMessage)
{
this.runeLiteFormatMessage = runeLiteFormatMessage;
}
@Inject
@Override
public int getTimestamp()
{
return rl$timestamp;
}
@Inject
@Override
public void setTimestamp(int timestamp)
{
this.rl$timestamp = timestamp;
}
@Inject
@MethodHook(value = "setMessage", end = true)
public void setMessage(int type, String name, String sender, String value)
{
// Message nodes get reused after a time by calling setMessage.
// Clear the runelite formatted message then.
runeLiteFormatMessage = null;
rl$timestamp = (int) (System.currentTimeMillis() / 1000L);
}
}

View File

@@ -37,7 +37,7 @@ import net.runelite.rs.api.RSModelData;
@Mixin(RSModelData.class)
public abstract class RSModelDataMixin implements RSModelData
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@Inject
@@ -46,10 +46,10 @@ public abstract class RSModelDataMixin implements RSModelData
@Inject
private float[][] faceTextureVCoordinates;
@Copy("light")
@Copy("toModel")
public abstract Model rs$light(int ambient, int contrast, int var3, int var4, int var5);
@Replace("light")
@Replace("toModel")
public Model rl$light(int ambient, int contrast, int var3, int var4, int var5)
{
client.getLogger().trace("Lighting model {}", this);
@@ -198,5 +198,4 @@ public abstract class RSModelDataMixin implements RSModelData
}
}
}
}

View File

@@ -24,31 +24,31 @@
*/
package net.runelite.mixins;
import java.awt.Polygon;
import java.util.ArrayList;
import java.util.List;
import net.runelite.api.Model;
import net.runelite.api.Perspective;
import net.runelite.api.Point;
import net.runelite.api.model.Jarvis;
import net.runelite.api.model.Triangle;
import net.runelite.api.model.Vertex;
import java.awt.Polygon;
import java.util.ArrayList;
import java.util.List;
import net.runelite.api.mixins.Copy;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.MethodHook;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow;
import net.runelite.api.model.Jarvis;
import net.runelite.api.model.Triangle;
import net.runelite.api.model.Vertex;
import net.runelite.rs.api.RSAnimation;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSFrame;
import net.runelite.rs.api.RSFrameMap;
import net.runelite.rs.api.RSFrames;
import net.runelite.rs.api.RSModel;
import net.runelite.rs.api.RSSkeleton;
@Mixin(RSModel.class)
public abstract class RSModelMixin implements RSModel
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@Inject
@@ -66,6 +66,12 @@ public abstract class RSModelMixin implements RSModel
@Inject
private float[][] rl$faceTextureVCoordinates;
@Inject
public void rl$init(Model[] models, int length)
{
rl$init((RSModel[]) models, length);
}
@MethodHook(value = "<init>", end = true)
@Inject
public void rl$init(RSModel[] models, int length)
@@ -194,9 +200,9 @@ public abstract class RSModelMixin implements RSModel
{
if (frameId != -1)
{
RSFrame frame = frames.getFrames()[frameId];
RSFrameMap skin = frame.getSkin();
RSFrame nextFrame = null;
RSAnimation frame = frames.getFrames()[frameId];
RSSkeleton skin = frame.getSkin();
RSAnimation nextFrame = null;
if (nextFrames != null)
{
nextFrame = nextFrames.getFrames()[nextFrameId];
@@ -217,7 +223,7 @@ public abstract class RSModelMixin implements RSModel
}
@Inject
public void interpolateFrames(RSFrameMap skin, RSFrame frame, RSFrame nextFrame, int interval, int intervalCount)
public void interpolateFrames(RSSkeleton skin, RSAnimation frame, RSAnimation nextFrame, int interval, int intervalCount)
{
if (nextFrame == null || interval == 0)
{
@@ -226,7 +232,7 @@ public abstract class RSModelMixin implements RSModel
{
int type = frame.getTransformTypes()[i];
this.animate(skin.getTypes()[type], skin.getList()[type], frame.getTranslatorX()[i],
frame.getTranslatorY()[i], frame.getTranslatorZ()[i]);
frame.getTranslatorY()[i], frame.getTranslatorZ()[i]);
}
}
else
@@ -237,13 +243,13 @@ public abstract class RSModelMixin implements RSModel
{
boolean frameValid = false;
if (transformIndex < frame.getTransformCount()
&& frame.getTransformTypes()[transformIndex] == i)
&& frame.getTransformTypes()[transformIndex] == i)
{
frameValid = true;
}
boolean nextFrameValid = false;
if (nextTransformIndex < nextFrame.getTransformCount()
&& nextFrame.getTransformTypes()[nextTransformIndex] == i)
&& nextFrame.getTransformTypes()[nextTransformIndex] == i)
{
nextFrameValid = true;
}

View File

@@ -1,27 +1,3 @@
/*
* 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.mixins;
import java.awt.event.MouseEvent;
@@ -31,12 +7,12 @@ import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSMouseInput;
import net.runelite.rs.api.RSMouseHandler;
@Mixin(RSMouseInput.class)
public abstract class RSMouseInputMixin implements RSMouseInput
@Mixin(RSMouseHandler.class)
public abstract class RSMouseHandlerMixin implements RSMouseHandler
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@Inject

View File

@@ -35,7 +35,7 @@ import net.runelite.rs.api.RSMouseWheelHandler;
@Mixin(RSMouseWheelHandler.class)
public abstract class RSMouseWheelHandlerMixin implements RSMouseWheelHandler
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@Copy("mouseWheelMoved")
@@ -51,4 +51,4 @@ public abstract class RSMouseWheelHandlerMixin implements RSMouseWheelHandler
rs$mouseWheelMoved(event);
}
}
}
}

View File

@@ -0,0 +1,50 @@
package net.runelite.mixins;
import net.runelite.api.HeadIcon;
import static net.runelite.api.HeadIcon.MAGIC;
import static net.runelite.api.HeadIcon.MELEE;
import static net.runelite.api.HeadIcon.RANGED;
import static net.runelite.api.HeadIcon.RANGE_MAGE;
import net.runelite.api.events.NpcActionChanged;
import net.runelite.api.mixins.FieldHook;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSNPCDefinition;
@Mixin(RSNPCDefinition.class)
public abstract class RSNPCDefinitionMixin implements RSNPCDefinition
{
@Shadow("client")
private static RSClient client;
@Inject
@Override
public HeadIcon getOverheadIcon()
{
switch (getRsOverheadIcon())
{
case 0:
return MELEE;
case 1:
return RANGED;
case 2:
return MAGIC;
case 6:
return RANGE_MAGE;
default:
return null;
}
}
@FieldHook("actions")
@Inject
public void actionsHook(int idx)
{
NpcActionChanged npcActionChanged = new NpcActionChanged();
npcActionChanged.setNpcDefinition(this);
npcActionChanged.setIdx(idx);
client.getCallbacks().post(npcActionChanged);
}
}

View File

@@ -24,12 +24,12 @@
*/
package net.runelite.mixins;
import java.awt.Polygon;
import net.runelite.api.AnimationID;
import net.runelite.api.NPCComposition;
import net.runelite.api.NPCDefinition;
import net.runelite.api.Perspective;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.events.NpcDespawned;
import java.awt.Polygon;
import net.runelite.api.mixins.Copy;
import net.runelite.api.mixins.FieldHook;
import net.runelite.api.mixins.Inject;
@@ -39,12 +39,12 @@ import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSModel;
import net.runelite.rs.api.RSNPC;
import net.runelite.rs.api.RSNPCComposition;
import net.runelite.rs.api.RSNPCDefinition;
@Mixin(RSNPC.class)
public abstract class RSNPCMixin implements RSNPC
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@Inject
@@ -57,7 +57,7 @@ public abstract class RSNPCMixin implements RSNPC
@Override
public int getId()
{
RSNPCComposition composition = getComposition();
RSNPCDefinition composition = getDefinition();
if (composition != null && composition.getConfigs() != null)
{
composition = composition.transform();
@@ -69,7 +69,7 @@ public abstract class RSNPCMixin implements RSNPC
@Override
public String getName()
{
RSNPCComposition composition = getComposition();
RSNPCDefinition composition = getDefinition();
if (composition != null && composition.getConfigs() != null)
{
composition = composition.transform();
@@ -81,7 +81,7 @@ public abstract class RSNPCMixin implements RSNPC
@Override
public int getCombatLevel()
{
RSNPCComposition composition = getComposition();
RSNPCDefinition composition = getDefinition();
if (composition != null && composition.getConfigs() != null)
{
composition = composition.transform();
@@ -103,9 +103,9 @@ public abstract class RSNPCMixin implements RSNPC
npcIndex = id;
}
@FieldHook(value = "composition", before = true)
@FieldHook(value = "definition", before = true)
@Inject
public void onCompositionChanged(RSNPCComposition composition)
public void onDefinitionChanged(RSNPCDefinition composition)
{
if (composition == null)
{
@@ -126,14 +126,14 @@ public abstract class RSNPCMixin implements RSNPC
}
int actionFrame = getActionFrame();
int poseFrame = getPoseFrame();
int spotAnimFrame = getSpotAnimFrame();
int spotAnimFrame = getSpotAnimationFrame();
try
{
// combine the frames with the frame cycle so we can access this information in the sequence methods
// without having to change method calls
setActionFrame(Integer.MIN_VALUE | getActionFrameCycle() << 16 | actionFrame);
setPoseFrame(Integer.MIN_VALUE | getPoseFrameCycle() << 16 | poseFrame);
setSpotAnimFrame(Integer.MIN_VALUE | getSpotAnimFrameCycle() << 16 | spotAnimFrame);
setSpotAnimationFrame(Integer.MIN_VALUE | getSpotAnimationFrameCycle() << 16 | spotAnimFrame);
return rs$getModel();
}
finally
@@ -141,15 +141,15 @@ public abstract class RSNPCMixin implements RSNPC
// reset frames
setActionFrame(actionFrame);
setPoseFrame(poseFrame);
setSpotAnimFrame(spotAnimFrame);
setSpotAnimationFrame(spotAnimFrame);
}
}
@Inject
@Override
public NPCComposition getTransformedComposition()
public NPCDefinition getTransformedDefinition()
{
RSNPCComposition composition = getComposition();
RSNPCDefinition composition = getDefinition();
if (composition != null && composition.getConfigs() != null)
{
composition = composition.transform();
@@ -181,7 +181,7 @@ public abstract class RSNPCMixin implements RSNPC
return null;
}
int size = getComposition().getSize();
int size = getDefinition().getSize();
LocalPoint tileHeightPoint = new LocalPoint(
size * Perspective.LOCAL_HALF_TILE_SIZE - Perspective.LOCAL_HALF_TILE_SIZE + getX(),
size * Perspective.LOCAL_HALF_TILE_SIZE - Perspective.LOCAL_HALF_TILE_SIZE + getY());

View File

@@ -1,72 +0,0 @@
/*
* Copyright (c) 2018, trimbe <github.com/trimbe>
* Copyright (c) 2019, 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.mixins;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.MethodHook;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSName;
import net.runelite.rs.api.RSNameable;
import net.runelite.rs.api.RSNameableContainer;
@Mixin(RSNameableContainer.class)
public abstract class RSNameableContainerMixin implements RSNameableContainer
{
/**
* Default implementation of rl$add
* @param name
* @param prevName
*/
@Inject
@Override
public void rl$add(RSName name, RSName prevName)
{
}
/**
* Default implementation of rl$del
* @param nameable
*/
@Inject
@Override
public void rl$remove(RSNameable nameable)
{
}
@Inject
@MethodHook(value = "add", end = true)
public void add(RSName name, RSName prevName)
{
rl$add(name, prevName);
}
@Inject
@MethodHook("remove")
public void remove(RSNameable nameable)
{
rl$remove(nameable);
}
}

View File

@@ -1,48 +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.mixins;
import net.runelite.api.events.NameableNameChanged;
import net.runelite.api.mixins.FieldHook;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSNameable;
@Mixin(RSNameable.class)
public abstract class RSNameableMixin implements RSNameable
{
@Shadow("clientInstance")
private static RSClient client;
@FieldHook("prevName")
@Inject
public void onPrevNameChanged(int idx)
{
NameableNameChanged nameableNameChanged = new NameableNameChanged(this);
client.getCallbacks().post(nameableNameChanged);
}
}

View File

@@ -0,0 +1,38 @@
package net.runelite.mixins;
import net.runelite.api.Node;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSNodeHashTable;
@Mixin(RSNodeHashTable.class)
public abstract class RSNodeHashTableMixin implements RSNodeHashTable
{
@Inject
@Override
public Collection<Node> getNodes()
{
// Copied in RSWidgetMixin.getParentId to reduce allocations
List<Node> nodes = new ArrayList<Node>();
Node[] buckets = getBuckets();
for (int i = 0; i < buckets.length; ++i)
{
Node node = buckets[i];
// It looks like the first node in the bucket is always
// a sentinel
Node cur = node.getNext();
while (cur != node)
{
nodes.add(cur);
cur = cur.getNext();
}
}
return nodes;
}
}

View File

@@ -38,7 +38,7 @@ public abstract class RSNodeMixin implements RSNode
}
@Inject
@MethodHook("unlink")
@MethodHook("remove")
public void rl$unlink()
{
onUnlink();

View File

@@ -1,74 +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.mixins;
import net.runelite.api.HeadIcon;
import static net.runelite.api.HeadIcon.MAGIC;
import static net.runelite.api.HeadIcon.MELEE;
import static net.runelite.api.HeadIcon.RANGED;
import static net.runelite.api.HeadIcon.RANGE_MAGE;
import net.runelite.api.events.NpcActionChanged;
import net.runelite.api.mixins.FieldHook;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSNPCComposition;
@Mixin(RSNPCComposition.class)
public abstract class RSNpcCompositionMixin implements RSNPCComposition
{
@Shadow("clientInstance")
private static RSClient client;
@Inject
@Override
public HeadIcon getOverheadIcon()
{
switch (getRsOverheadIcon())
{
case 0:
return MELEE;
case 1:
return RANGED;
case 2:
return MAGIC;
case 6:
return RANGE_MAGE;
default:
return null;
}
}
@FieldHook("actions")
@Inject
public void actionsHook(int idx)
{
NpcActionChanged npcActionChanged = new NpcActionChanged();
npcActionChanged.setNpcComposition(this);
npcActionChanged.setIdx(idx);
client.getCallbacks().post(npcActionChanged);
}
}

View File

@@ -0,0 +1,34 @@
package net.runelite.mixins;
import net.runelite.api.kit.KitType;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSPlayerAppearance;
@Mixin(RSPlayerAppearance.class)
public abstract class RSPlayerAppearanceMixin implements RSPlayerAppearance
{
@Inject
@Override
public int getEquipmentId(KitType type)
{
int id = getEquipmentIds()[type.getIndex()];
if (id < 512)
{
return -1; // not an item
}
return id - 512;
}
@Inject
@Override
public int getKitId(KitType type)
{
int id = getEquipmentIds()[type.getIndex()];
if (id < 256 || id >= 512)
{
return -1; // not a kit
}
return id - 256;
}
}

View File

@@ -1,58 +0,0 @@
/*
* Copyright (c) 2016-2017, 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.mixins;
import net.runelite.api.kit.KitType;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSPlayerComposition;
@Mixin(RSPlayerComposition.class)
public abstract class RSPlayerCompositionMixin implements RSPlayerComposition
{
@Inject
@Override
public int getEquipmentId(KitType type)
{
int id = getEquipmentIds()[type.getIndex()];
if (id < 512)
{
return -1; // not an item
}
return id - 512;
}
@Inject
@Override
public int getKitId(KitType type)
{
int id = getEquipmentIds()[type.getIndex()];
if (id < 256 || id >= 512)
{
return -1; // not a kit
}
return id - 256;
}
}

View File

@@ -24,9 +24,6 @@
*/
package net.runelite.mixins;
import java.awt.Polygon;
import java.util.ArrayList;
import java.util.List;
import net.runelite.api.HeadIcon;
import static net.runelite.api.HeadIcon.MAGIC;
import static net.runelite.api.HeadIcon.MELEE;
@@ -46,29 +43,32 @@ import static net.runelite.api.SkullIcon.DEAD_MAN_TWO;
import static net.runelite.api.SkullIcon.SKULL;
import static net.runelite.api.SkullIcon.SKULL_FIGHT_PIT;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.model.Triangle;
import net.runelite.api.model.Vertex;
import java.awt.Polygon;
import java.util.ArrayList;
import java.util.List;
import net.runelite.api.mixins.Copy;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow;
import net.runelite.api.model.Triangle;
import net.runelite.api.model.Vertex;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSModel;
import net.runelite.rs.api.RSName;
import net.runelite.rs.api.RSPlayer;
import net.runelite.rs.api.RSUsername;
@Mixin(RSPlayer.class)
public abstract class RSPlayerMixin implements RSPlayer
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@Inject
@Override
public String getName()
{
final RSName rsName = getRsName();
final RSUsername rsName = getRsName();
if (rsName == null)
{
@@ -112,12 +112,6 @@ public abstract class RSPlayerMixin implements RSPlayer
@Override
public SkullIcon getSkullIcon()
{
if (this != client.getLocalPlayer())
{
// prevent seeing skulls of other players.
return null;
}
switch (getRsSkullIcon())
{
case 0:
@@ -169,28 +163,28 @@ public abstract class RSPlayerMixin implements RSPlayer
Vertex vz = triangle.getC();
Point x = Perspective.localToCanvas(client,
localX - vx.getX(),
localY - vx.getZ(),
tileHeight + vx.getY());
localX - vx.getX(),
localY - vx.getZ(),
tileHeight + vx.getY());
Point y = Perspective.localToCanvas(client,
localX - vy.getX(),
localY - vy.getZ(),
tileHeight + vy.getY());
localX - vy.getX(),
localY - vy.getZ(),
tileHeight + vy.getY());
Point z = Perspective.localToCanvas(client,
localX - vz.getX(),
localY - vz.getZ(),
tileHeight + vz.getY());
localX - vz.getX(),
localY - vz.getZ(),
tileHeight + vz.getY());
int[] xx =
{
x.getX(), y.getX(), z.getX()
};
{
x.getX(), y.getX(), z.getX()
};
int[] yy =
{
x.getY(), y.getY(), z.getY()
};
{
x.getY(), y.getY(), z.getY()
};
polys.add(new Polygon(xx, yy, 3));
}
@@ -222,9 +216,9 @@ public abstract class RSPlayerMixin implements RSPlayer
Vertex c = triangle.getC();
Triangle rotatedTriangle = new Triangle(
a.rotate(orientation),
b.rotate(orientation),
c.rotate(orientation)
a.rotate(orientation),
b.rotate(orientation),
c.rotate(orientation)
);
rotatedTriangles.add(rotatedTriangle);
}
@@ -243,14 +237,14 @@ public abstract class RSPlayerMixin implements RSPlayer
}
int actionFrame = getActionFrame();
int poseFrame = getPoseFrame();
int spotAnimFrame = getSpotAnimFrame();
int spotAnimFrame = getSpotAnimationFrame();
try
{
// combine the frames with the frame cycle so we can access this information in the sequence methods
// without having to change method calls
setActionFrame(Integer.MIN_VALUE | getActionFrameCycle() << 16 | actionFrame);
setPoseFrame(Integer.MIN_VALUE | getPoseFrameCycle() << 16 | poseFrame);
setSpotAnimFrame(Integer.MIN_VALUE | getSpotAnimFrameCycle() << 16 | spotAnimFrame);
setSpotAnimationFrame(Integer.MIN_VALUE | getSpotAnimationFrameCycle() << 16 | spotAnimFrame);
return rs$getModel();
}
finally
@@ -258,7 +252,7 @@ public abstract class RSPlayerMixin implements RSPlayer
// reset frames
setActionFrame(actionFrame);
setPoseFrame(poseFrame);
setSpotAnimFrame(spotAnimFrame);
setSpotAnimationFrame(spotAnimFrame);
}
}
}

View File

@@ -39,7 +39,7 @@ import net.runelite.rs.api.RSProjectile;
@Mixin(RSProjectile.class)
public abstract class RSProjectileMixin implements RSProjectile
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@Inject
@@ -92,7 +92,7 @@ public abstract class RSProjectileMixin implements RSProjectile
* @param cycle
*/
@Inject
@MethodHook("moveProjectile")
@MethodHook("setDestination")
public void projectileMoved(int targetX, int targetY, int targetZ, int cycle)
{
final LocalPoint position = new LocalPoint(targetX, targetY);

View File

@@ -1,27 +1,3 @@
/*
* Copyright (c) 2018, Lotto <https://github.com/devLotto>
* 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.mixins;
import java.awt.Component;
@@ -41,12 +17,12 @@ import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSMainBufferProvider;
import net.runelite.rs.api.RSRasterProvider;
@Mixin(RSMainBufferProvider.class)
public abstract class RSMainBufferProviderMixin implements RSMainBufferProvider
@Mixin(RSRasterProvider.class)
public abstract class RSRasterProviderMixin implements RSRasterProvider
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@Inject
@@ -81,7 +57,7 @@ public abstract class RSMainBufferProviderMixin implements RSMainBufferProvider
* as the method that is replaced draws
* the game's image on the canvas.
*/
@Replace("draw")
@Replace("drawFull0")
final void draw(Graphics graphics, int x, int y)
{
client.getCallbacks().draw(this, graphics, x, y);

View File

@@ -1,27 +1,3 @@
/*
* 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.mixins;
import net.runelite.api.mixins.Copy;
@@ -32,9 +8,9 @@ import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
@Mixin(RSClient.class)
public abstract class Rasterizer2DMixin implements RSClient
public abstract class RSRasterizer2DMixin implements RSClient
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@Inject

View File

@@ -36,14 +36,14 @@ import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSBoundaryObject;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSDecorativeObject;
import net.runelite.rs.api.RSGroundObject;
import net.runelite.rs.api.RSItemLayer;
import net.runelite.rs.api.RSFloorDecoration;
import net.runelite.rs.api.RSGroundItemPile;
import net.runelite.rs.api.RSScene;
import net.runelite.rs.api.RSSceneTileModel;
import net.runelite.rs.api.RSTile;
import net.runelite.rs.api.RSWallObject;
import net.runelite.rs.api.RSTileModel;
import net.runelite.rs.api.RSWallDecoration;
@Mixin(RSScene.class)
public abstract class RSSceneMixin implements RSScene
@@ -56,7 +56,7 @@ public abstract class RSSceneMixin implements RSScene
private static final int MAX_TARGET_DISTANCE = 45;
@Shadow("clientInstance")
@Shadow("client")
static RSClient client;
@Shadow("pitchRelaxEnabled")
@@ -74,7 +74,7 @@ public abstract class RSSceneMixin implements RSScene
@Inject
private static int rl$drawDistance;
@Replace("drawScene")
@Replace("draw")
void rl$drawScene(int cameraX, int cameraY, int cameraZ, int cameraPitch, int cameraYaw, int plane)
{
final DrawCallbacks drawCallbacks = client.getDrawCallbacks();
@@ -89,7 +89,7 @@ public abstract class RSSceneMixin implements RSScene
{
if (skyboxColor != 0)
{
client.RasterizerFillRectangle(
client.rasterizerFillRectangle(
client.getViewportXOffset(),
client.getViewportYOffset(),
client.getViewportWidth(),
@@ -379,17 +379,17 @@ public abstract class RSSceneMixin implements RSScene
client.getCallbacks().drawScene();
}
@Copy("addBoundaryDecoration")
@Copy("newWallDecoration")
abstract public void rs$addBoundaryDecoration(int plane, int x, int y, int floor, Renderable var5, Renderable var6, int var7, int var8, int var9, int var10, long hash, int var12);
@Replace("addBoundaryDecoration")
@Replace("newWallDecoration")
public void rl$addBoundaryDecoration(int plane, int x, int y, int floor, Renderable var5, Renderable var6, int var7, int var8, int var9, int var10, long hash, int var12)
{
rs$addBoundaryDecoration(plane, x, y, floor, var5, var6, var7, var8, var9, var10, hash, var12);
Tile tile = getTiles()[plane][x][y];
if (tile != null)
{
RSDecorativeObject object = (RSDecorativeObject) tile.getDecorativeObject();
RSWallDecoration object = (RSWallDecoration) tile.getDecorativeObject();
if (object != null)
{
object.setPlane(plane);
@@ -397,17 +397,17 @@ public abstract class RSSceneMixin implements RSScene
}
}
@Copy("addItemPile")
@Copy("newGroundItemPile")
abstract public void rs$addItemPile(int plane, int x, int y, int hash, Renderable var5, long var6, Renderable var7, Renderable var8);
@Replace("addItemPile")
@Replace("newGroundItemPile")
public void rl$addItemPile(int plane, int x, int y, int hash, Renderable var5, long var6, Renderable var7, Renderable var8)
{
rs$addItemPile(plane, x, y, hash, var5, var6, var7, var8);
Tile tile = getTiles()[plane][x][y];
if (tile != null)
{
RSItemLayer itemLayer = (RSItemLayer) tile.getItemLayer();
RSGroundItemPile itemLayer = (RSGroundItemPile) tile.getItemLayer();
if (itemLayer != null)
{
itemLayer.setPlane(plane);
@@ -415,17 +415,17 @@ public abstract class RSSceneMixin implements RSScene
}
}
@Copy("groundObjectSpawned")
@Copy("newFloorDecoration")
abstract public void rs$groundObjectSpawned(int plane, int x, int y, int floor, Renderable var5, long hash, int var7);
@Replace("groundObjectSpawned")
@Replace("newFloorDecoration")
public void rl$groundObjectSpawned(int plane, int x, int y, int floor, Renderable var5, long hash, int var7)
{
rs$groundObjectSpawned(plane, x, y, floor, var5, hash, var7);
Tile tile = getTiles()[plane][x][y];
if (tile != null)
{
RSGroundObject groundObject = (RSGroundObject) tile.getGroundObject();
RSFloorDecoration groundObject = (RSFloorDecoration) tile.getGroundObject();
if (groundObject != null)
{
groundObject.setPlane(plane);
@@ -433,17 +433,17 @@ public abstract class RSSceneMixin implements RSScene
}
}
@Copy("addBoundary")
@Copy("newBoundaryObject")
abstract public void rs$addBoundary(int plane, int x, int y, int floor, Renderable var5, Renderable var6, int var7, int var8, long hash, int var10);
@Replace("addBoundary")
@Replace("newBoundaryObject")
public void rl$addBoundary(int plane, int x, int y, int floor, Renderable var5, Renderable var6, int var7, int var8, long hash, int var10)
{
rs$addBoundary(plane, x, y, floor, var5, var6, var7, var8, hash, var10);
Tile tile = getTiles()[plane][x][y];
if (tile != null)
{
RSWallObject wallObject = (RSWallObject) tile.getWallObject();
RSBoundaryObject wallObject = (RSBoundaryObject) tile.getWallObject();
if (wallObject != null)
{
wallObject.setPlane(plane);
@@ -616,7 +616,7 @@ public abstract class RSSceneMixin implements RSScene
return;
}
RSSceneTileModel sceneTileModel = (RSSceneTileModel) tile;
RSTileModel sceneTileModel = (RSTileModel) tile;
final int[] faceX = sceneTileModel.getFaceX();
final int[] faceY = sceneTileModel.getFaceY();

View File

@@ -1,84 +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.mixins;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSSceneTileModel;
@Mixin(RSSceneTileModel.class)
public abstract class RSSceneTileModelMixin implements RSSceneTileModel
{
@Inject
private int rl$modelBufferOffset;
@Inject
private int rl$modelUvBufferOffset;
@Inject
private int rl$modelBufferLen;
@Inject
@Override
public int getBufferOffset()
{
return rl$modelBufferOffset;
}
@Inject
@Override
public void setBufferOffset(int bufferOffset)
{
rl$modelBufferOffset = bufferOffset;
}
@Inject
@Override
public int getUvBufferOffset()
{
return rl$modelUvBufferOffset;
}
@Inject
@Override
public void setUvBufferOffset(int bufferOffset)
{
rl$modelUvBufferOffset = bufferOffset;
}
@Inject
@Override
public int getBufferLen()
{
return rl$modelBufferLen;
}
@Inject
@Override
public void setBufferLen(int bufferLen)
{
rl$modelBufferLen = bufferLen;
}
}

View File

@@ -1,84 +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.mixins;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSSceneTilePaint;
@Mixin(RSSceneTilePaint.class)
public abstract class RSSceneTilePaintMixin implements RSSceneTilePaint
{
@Inject
private int rl$paintModelBufferOffset;
@Inject
private int rl$paintModelUvBufferOffset;
@Inject
private int rl$paintModelBufferLen;
@Inject
@Override
public int getBufferOffset()
{
return rl$paintModelBufferOffset;
}
@Inject
@Override
public void setBufferOffset(int bufferOffset)
{
rl$paintModelBufferOffset = bufferOffset;
}
@Inject
@Override
public int getUvBufferOffset()
{
return rl$paintModelUvBufferOffset;
}
@Inject
@Override
public void setUvBufferOffset(int bufferOffset)
{
rl$paintModelUvBufferOffset = bufferOffset;
}
@Inject
@Override
public int getBufferLen()
{
return rl$paintModelBufferLen;
}
@Inject
@Override
public void setBufferLen(int bufferLen)
{
rl$paintModelBufferLen = bufferLen;
}
}

View File

@@ -1,27 +1,3 @@
/*
* 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.mixins;
import net.runelite.api.mixins.Copy;
@@ -31,19 +7,19 @@ import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSFrames;
import net.runelite.rs.api.RSModel;
import net.runelite.rs.api.RSSequence;
import net.runelite.rs.api.RSSequenceDefinition;
@Mixin(RSSequence.class)
public abstract class RSSequenceMixin implements RSSequence
@Mixin(RSSequenceDefinition.class)
public abstract class RSSequenceDefinitionMixin implements RSSequenceDefinition
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@Copy("applyTransformations")
public abstract RSModel rs$applyTransformations(RSModel model, int actionFrame, RSSequence poseSeq, int poseFrame);
@Copy("animateSequence2")
public abstract RSModel rs$applyTransformations(RSModel model, int actionFrame, RSSequenceDefinition poseSeq, int poseFrame);
@Replace("applyTransformations")
public RSModel rl$applyTransformations(RSModel model, int actionFrame, RSSequence poseSeq, int poseFrame)
@Replace("animateSequence2")
public RSModel rl$applyTransformations(RSModel model, int actionFrame, RSSequenceDefinition poseSeq, int poseFrame)
{
// reset frame ids because we're not interpolating this
if (actionFrame < 0)
@@ -59,10 +35,10 @@ public abstract class RSSequenceMixin implements RSSequence
return rs$applyTransformations(model, actionFrame, poseSeq, poseFrame);
}
@Copy("transformActorModel")
@Copy("animateSequence")
public abstract RSModel rs$transformActorModel(RSModel model, int frameIdx);
@Replace("transformActorModel")
@Replace("animateSequence")
public RSModel rl$transformActorModel(RSModel model, int frame)
{
// check if the frame has been modified
@@ -101,7 +77,7 @@ public abstract class RSSequenceMixin implements RSSequence
{
RSModel animatedModel = model.toSharedModel(!frames.getFrames()[frameIdx].isShowing());
animatedModel.interpolateFrames(frames, frameIdx, nextFrames, nextFrameIdx, interval,
getFrameLenths()[frame]);
getFrameLenths()[frame]);
return animatedModel;
}
}
@@ -111,10 +87,10 @@ public abstract class RSSequenceMixin implements RSSequence
}
}
@Copy("transformObjectModel")
@Copy("animateObject")
public abstract RSModel rs$transformObjectModel(RSModel model, int frame, int rotation);
@Replace("transformObjectModel")
@Replace("animateObject")
public RSModel rl$transformObjectModel(RSModel model, int frame, int rotation)
{
// check if the frame has been modified
@@ -167,7 +143,7 @@ public abstract class RSSequenceMixin implements RSSequence
animatedModel.rotateY90Ccw();
}
animatedModel.interpolateFrames(frames, frameIdx, nextFrames, nextFrameIdx, interval,
getFrameLenths()[frame]);
getFrameLenths()[frame]);
// reapply rotation after animating
if (rotation == 1)
{
@@ -190,10 +166,10 @@ public abstract class RSSequenceMixin implements RSSequence
}
}
@Copy("transformSpotAnimModel")
@Copy("animateSpotAnimation")
public abstract RSModel rs$transformSpotAnimModel(RSModel model, int frame);
@Replace("transformSpotAnimModel")
@Replace("animateSpotAnimation")
public RSModel rl$transformSpotAnimModel(RSModel model, int frame)
{
// check if the frame has been modified
@@ -231,7 +207,7 @@ public abstract class RSSequenceMixin implements RSSequence
{
RSModel animatedModel = model.toSharedSpotAnimModel(!frames.getFrames()[frameIdx].isShowing());
animatedModel.interpolateFrames(frames, frameIdx, nextFrames, nextFrameIdx, interval,
getFrameLenths()[frame]);
getFrameLenths()[frame]);
return animatedModel;
}
}

View File

@@ -1,37 +1,13 @@
/*
* Copyright (c) 2016-2017, 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.mixins;
import java.awt.Color;
import java.awt.image.BufferedImage;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSSpritePixels;
import net.runelite.rs.api.RSSprite;
@Mixin(RSSpritePixels.class)
public abstract class RSSpritePixelsMixin implements RSSpritePixels
@Mixin(RSSprite.class)
public abstract class RSSpriteMixin implements RSSprite
{
@Inject
@Override
@@ -53,7 +29,7 @@ public abstract class RSSpritePixelsMixin implements RSSpritePixels
if (img.getWidth() != width || img.getHeight() != height)
{
throw new IllegalArgumentException("Image bounds do not match SpritePixels");
throw new IllegalArgumentException("Image bounds do not match Sprite");
}
int[] pixels = getPixels();
@@ -90,7 +66,7 @@ public abstract class RSSpritePixelsMixin implements RSSpritePixels
if (img.getWidth() != width || img.getHeight() != height)
{
throw new IllegalArgumentException("Image bounds do not match SpritePixels");
throw new IllegalArgumentException("Image bounds do not match Sprite");
}
int[] pixels = getPixels();

View File

@@ -35,7 +35,7 @@ import net.runelite.rs.api.RSTexture;
@Mixin(RSTexture.class)
public abstract class RSTextureMixin implements RSTexture
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@Inject
@@ -44,10 +44,10 @@ public abstract class RSTextureMixin implements RSTexture
@Inject
private float rl$v;
@Copy("animate")
@Copy("Texture_animate")
public abstract void rs$animate(int diff);
@Replace("animate")
@Replace("Texture_animate")
public void rl$animate(int diff)
{
// The client animates textures by cycling the backing pixels of the texture each fram

View File

@@ -35,7 +35,7 @@ import net.runelite.rs.api.RSTextureProvider;
@Mixin(RSTextureProvider.class)
public abstract class RSTextureProviderMixin implements RSTextureProvider
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@MethodHook(value = "<init>", end = true)
@@ -49,7 +49,7 @@ public abstract class RSTextureProviderMixin implements RSTextureProvider
setSize(64);
}
@MethodHook(value = "checkTextures", end = true)
@MethodHook(value = "animate", end = true)
@Inject
public void checkTextures(int diff)
{

View File

@@ -24,12 +24,12 @@
*/
package net.runelite.mixins;
import java.util.ArrayList;
import java.util.List;
import net.runelite.api.Actor;
import net.runelite.api.CollisionData;
import net.runelite.api.CollisionDataFlag;
import net.runelite.api.Constants;
import net.runelite.api.DecorativeObject;
import net.runelite.api.GameObject;
import net.runelite.api.GroundObject;
import net.runelite.api.Item;
import net.runelite.api.ItemLayer;
@@ -53,31 +53,31 @@ import net.runelite.api.events.ItemSpawned;
import net.runelite.api.events.WallObjectChanged;
import net.runelite.api.events.WallObjectDespawned;
import net.runelite.api.events.WallObjectSpawned;
import java.util.ArrayList;
import java.util.List;
import net.runelite.api.mixins.FieldHook;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSActor;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSDeque;
import net.runelite.rs.api.RSGameObject;
import net.runelite.rs.api.RSGraphicsObject;
import net.runelite.rs.api.RSItem;
import net.runelite.rs.api.RSItemLayer;
import net.runelite.rs.api.RSGroundItem;
import net.runelite.rs.api.RSGroundItemPile;
import net.runelite.rs.api.RSNode;
import net.runelite.rs.api.RSProjectile;
import net.runelite.rs.api.RSRenderable;
import net.runelite.rs.api.RSNodeDeque;
import net.runelite.rs.api.RSTile;
import org.slf4j.Logger;
@Mixin(RSTile.class)
public abstract class RSTileMixin implements RSTile
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@Inject
private static RSDeque[][][] lastGroundItems = new RSDeque[Constants.MAX_Z][Constants.SCENE_SIZE][Constants.SCENE_SIZE];
private static GameObject lastGameObject;
@Inject
private static RSNodeDeque[][][] lastGroundItems = new RSNodeDeque[Constants.MAX_Z][Constants.SCENE_SIZE][Constants.SCENE_SIZE];
@Inject
private WallObject previousWallObject;
@@ -89,7 +89,7 @@ public abstract class RSTileMixin implements RSTile
private GroundObject previousGroundObject;
@Inject
private RSGameObject[] previousGameObjects;
private GameObject[] previousGameObjects;
@Inject
@Override
@@ -112,7 +112,7 @@ public abstract class RSTileMixin implements RSTile
return LocalPoint.fromScene(getX(), getY());
}
@FieldHook("wallObject")
@FieldHook("boundaryObject")
@Inject
public void wallObjectChanged(int idx)
{
@@ -145,7 +145,7 @@ public abstract class RSTileMixin implements RSTile
}
}
@FieldHook("decorativeObject")
@FieldHook("wallDecoration")
@Inject
public void decorativeObjectChanged(int idx)
{
@@ -178,7 +178,7 @@ public abstract class RSTileMixin implements RSTile
}
}
@FieldHook("groundObject")
@FieldHook("floorDecoration")
@Inject
public void groundObjectChanged(int idx)
{
@@ -211,7 +211,7 @@ public abstract class RSTileMixin implements RSTile
}
}
@FieldHook("objects")
@FieldHook("gameObjects")
@Inject
public void gameObjectsChanged(int idx)
{
@@ -222,96 +222,69 @@ public abstract class RSTileMixin implements RSTile
if (previousGameObjects == null)
{
previousGameObjects = new RSGameObject[5];
previousGameObjects = new GameObject[5];
}
// Previous game object
RSGameObject previous = previousGameObjects[idx];
GameObject previous = previousGameObjects[idx];
// GameObject that was changed.
RSGameObject current = (RSGameObject) getGameObjects()[idx];
// Last game object
GameObject last = lastGameObject;
// Update last game object
lastGameObject = current;
// Update previous object to current
previousGameObjects[idx] = current;
// Duplicate event, return
if (current == previous)
if (current != null && current.equals(last))
{
return;
}
// actors, projectiles, and graphics objects are added and removed from the scene each frame as GameObjects,
// so ignore them.
boolean currentInvalid = false, prevInvalid = false;
if (current != null)
// Characters seem to generate a constant stream of new GameObjects
if (current == null || !(current.getRenderable() instanceof Actor))
{
RSRenderable renderable = current.getRenderable();
currentInvalid = renderable instanceof RSActor || renderable instanceof RSProjectile || renderable instanceof RSGraphicsObject;
}
if (previous != null)
{
RSRenderable renderable = previous.getRenderable();
prevInvalid = renderable instanceof RSActor || renderable instanceof RSProjectile || renderable instanceof RSGraphicsObject;
}
Logger logger = client.getLogger();
if (current == null)
{
if (prevInvalid)
if (current == null && previous != null)
{
return;
GameObjectDespawned gameObjectDespawned = new GameObjectDespawned();
gameObjectDespawned.setTile(this);
gameObjectDespawned.setGameObject(previous);
client.getCallbacks().post(gameObjectDespawned);
}
logger.trace("Game object despawn: {}", previous.getId());
GameObjectDespawned gameObjectDespawned = new GameObjectDespawned();
gameObjectDespawned.setTile(this);
gameObjectDespawned.setGameObject(previous);
client.getCallbacks().post(gameObjectDespawned);
}
else if (previous == null)
{
if (currentInvalid)
else if (current != null && previous == null)
{
return;
GameObjectSpawned gameObjectSpawned = new GameObjectSpawned();
gameObjectSpawned.setTile(this);
gameObjectSpawned.setGameObject(current);
client.getCallbacks().post(gameObjectSpawned);
}
logger.trace("Game object spawn: {}", current.getId());
GameObjectSpawned gameObjectSpawned = new GameObjectSpawned();
gameObjectSpawned.setTile(this);
gameObjectSpawned.setGameObject(current);
client.getCallbacks().post(gameObjectSpawned);
}
else
{
if (currentInvalid && prevInvalid)
else if (current != null && previous != null)
{
return;
GameObjectChanged gameObjectsChanged = new GameObjectChanged();
gameObjectsChanged.setTile(this);
gameObjectsChanged.setPrevious(previous);
gameObjectsChanged.setGameObject(current);
client.getCallbacks().post(gameObjectsChanged);
}
logger.trace("Game object change: {} -> {}", previous.getId(), current.getId());
GameObjectChanged gameObjectsChanged = new GameObjectChanged();
gameObjectsChanged.setTile(this);
gameObjectsChanged.setPrevious(previous);
gameObjectsChanged.setGameObject(current);
client.getCallbacks().post(gameObjectsChanged);
}
}
@FieldHook("itemLayer")
@FieldHook("groundItemPile")
@Inject
public void itemLayerChanged(int idx)
{
int x = getX();
int y = getY();
int z = client.getPlane();
RSDeque[][][] groundItemDeque = client.getGroundItemDeque();
RSNodeDeque[][][] groundItemDeque = client.getGroundItemDeque();
RSDeque oldQueue = lastGroundItems[z][x][y];
RSDeque newQueue = groundItemDeque[z][x][y];
RSNodeDeque oldQueue = lastGroundItems[z][x][y];
RSNodeDeque newQueue = groundItemDeque[z][x][y];
if (oldQueue != newQueue)
{
@@ -321,7 +294,7 @@ public abstract class RSTileMixin implements RSTile
RSNode head = oldQueue.getHead();
for (RSNode cur = head.getNext(); cur != head; cur = cur.getNext())
{
RSItem item = (RSItem) cur;
RSGroundItem item = (RSGroundItem) cur;
ItemDespawned itemDespawned = new ItemDespawned(this, item);
client.getCallbacks().post(itemDespawned);
}
@@ -329,13 +302,13 @@ public abstract class RSTileMixin implements RSTile
lastGroundItems[z][x][y] = newQueue;
}
RSItem lastUnlink = client.getLastItemDespawn();
RSGroundItem lastUnlink = client.getLastItemDespawn();
if (lastUnlink != null)
{
client.setLastItemDespawn(null);
}
RSItemLayer itemLayer = (RSItemLayer) getItemLayer();
RSGroundItemPile itemLayer = (RSGroundItemPile) getItemLayer();
if (itemLayer == null)
{
if (lastUnlink != null)
@@ -346,7 +319,7 @@ public abstract class RSTileMixin implements RSTile
return;
}
RSDeque itemDeque = newQueue;
RSNodeDeque itemDeque = newQueue;
if (itemDeque == null)
{
@@ -365,7 +338,7 @@ public abstract class RSTileMixin implements RSTile
boolean forward = false;
if (head != previous)
{
RSItem prev = (RSItem) previous;
RSGroundItem prev = (RSGroundItem) previous;
if (x != prev.getX() || y != prev.getY())
{
current = prev;
@@ -375,7 +348,7 @@ public abstract class RSTileMixin implements RSTile
RSNode next = head.getNext();
if (current == null && head != next)
{
RSItem n = (RSItem) next;
RSGroundItem n = (RSGroundItem) next;
if (x != n.getX() || y != n.getY())
{
current = n;
@@ -396,7 +369,7 @@ public abstract class RSTileMixin implements RSTile
do
{
RSItem item = (RSItem) current;
RSGroundItem item = (RSGroundItem) current;
item.setX(x);
item.setY(y);
@@ -407,7 +380,7 @@ public abstract class RSTileMixin implements RSTile
// Send spawn events for anything on this tile which is at the wrong location, which happens
// when the scene base changes
} while (current != head && (((RSItem) current).getX() != x || ((RSItem) current).getY() != y));
} while (current != head && (((RSGroundItem) current).getX() != x || ((RSGroundItem) current).getY() != y));
}
@Inject

View File

@@ -0,0 +1,60 @@
package net.runelite.mixins;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSTileModel;
@Mixin(RSTileModel.class)
public abstract class RSTileModelMixin implements RSTileModel
{
@Inject
private int rl$modelBufferOffset;
@Inject
private int rl$modelUvBufferOffset;
@Inject
private int rl$modelBufferLen;
@Inject
@Override
public int getBufferOffset()
{
return rl$modelBufferOffset;
}
@Inject
@Override
public void setBufferOffset(int bufferOffset)
{
rl$modelBufferOffset = bufferOffset;
}
@Inject
@Override
public int getUvBufferOffset()
{
return rl$modelUvBufferOffset;
}
@Inject
@Override
public void setUvBufferOffset(int bufferOffset)
{
rl$modelUvBufferOffset = bufferOffset;
}
@Inject
@Override
public int getBufferLen()
{
return rl$modelBufferLen;
}
@Inject
@Override
public void setBufferLen(int bufferLen)
{
rl$modelBufferLen = bufferLen;
}
}

View File

@@ -0,0 +1,89 @@
package net.runelite.mixins;
import net.runelite.api.Perspective;
import net.runelite.api.Point;
import net.runelite.api.TileObject;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint;
import java.awt.Graphics2D;
import java.awt.Polygon;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Mixins;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSBoundaryObject;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSFloorDecoration;
import net.runelite.rs.api.RSGameObject;
import net.runelite.rs.api.RSGroundItemPile;
import net.runelite.rs.api.RSWallDecoration;
@Mixins({
@Mixin(RSWallDecoration.class),
@Mixin(RSGameObject.class),
@Mixin(RSFloorDecoration.class),
@Mixin(RSGroundItemPile.class),
@Mixin(RSBoundaryObject.class)
})
public abstract class RSTileObjectMixin implements TileObject
{
@Shadow("client")
private static RSClient client;
@Override
@Inject
public int getId()
{
long hash = getHash();
return (int) (hash >>> 17 & 4294967295L);
}
@Override
@Inject
public WorldPoint getWorldLocation()
{
return WorldPoint.fromLocal(client, getX(), getY(), getPlane());
}
@Override
@Inject
public LocalPoint getLocalLocation()
{
return new LocalPoint(getX(), getY());
}
@Override
@Inject
public Point getCanvasLocation()
{
return getCanvasLocation(0);
}
@Override
@Inject
public Point getCanvasLocation(int zOffset)
{
return Perspective.localToCanvas(client, getLocalLocation(), getPlane(), zOffset);
}
@Override
@Inject
public Polygon getCanvasTilePoly()
{
return Perspective.getCanvasTilePoly(client, getLocalLocation());
}
@Override
@Inject
public Point getCanvasTextLocation(Graphics2D graphics, String text, int zOffset)
{
return Perspective.getCanvasTextLocation(client, graphics, getLocalLocation(), text, zOffset);
}
@Override
@Inject
public Point getMinimapLocation()
{
return Perspective.localToMinimap(client, getLocalLocation());
}
}

View File

@@ -0,0 +1,60 @@
package net.runelite.mixins;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSTilePaint;
@Mixin(RSTilePaint.class)
public abstract class RSTilePaintMixin implements RSTilePaint
{
@Inject
private int rl$paintModelBufferOffset;
@Inject
private int rl$paintModelUvBufferOffset;
@Inject
private int rl$paintModelBufferLen;
@Inject
@Override
public int getBufferOffset()
{
return rl$paintModelBufferOffset;
}
@Inject
@Override
public void setBufferOffset(int bufferOffset)
{
rl$paintModelBufferOffset = bufferOffset;
}
@Inject
@Override
public int getUvBufferOffset()
{
return rl$paintModelUvBufferOffset;
}
@Inject
@Override
public void setUvBufferOffset(int bufferOffset)
{
rl$paintModelUvBufferOffset = bufferOffset;
}
@Inject
@Override
public int getBufferLen()
{
return rl$paintModelBufferLen;
}
@Inject
@Override
public void setBufferLen(int bufferLen)
{
rl$paintModelBufferLen = bufferLen;
}
}

View File

@@ -0,0 +1,47 @@
package net.runelite.mixins;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.MethodHook;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSUser;
import net.runelite.rs.api.RSUserList;
import net.runelite.rs.api.RSUsername;
@Mixin(RSUserList.class)
public abstract class RSUserListMixin implements RSUserList
{
/**
* Default implementation of rl$add
* @param name
* @param prevName
*/
@Inject
@Override
public void rl$add(RSUsername name, RSUsername prevName)
{
}
/**
* Default implementation of rl$del
* @param nameable
*/
@Inject
@Override
public void rl$remove(RSUser nameable)
{
}
@Inject
@MethodHook(value = "addLast", end = true)
public void add(RSUsername name, RSUsername prevName)
{
rl$add(name, prevName);
}
@Inject
@MethodHook("remove")
public void remove(RSUser nameable)
{
rl$remove(nameable);
}
}

View File

@@ -12,17 +12,17 @@ import net.runelite.rs.api.RSVarcs;
@Mixin(RSVarcs.class)
public abstract class RSVarcsMixin implements RSVarcs
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@MethodHook(value = "putVarc", end = true)
@MethodHook(value = "setInt", end = true)
@Inject
public void onVarCIntChanged(int id, int value)
{
client.getCallbacks().post(new VarClientIntChanged(id));
}
@MethodHook(value = "putVarcStringNew", end = true)
@MethodHook(value = "setString", end = true)
@Inject
public void onVarCStrChanged(int id, String value)
{

View File

@@ -1,46 +1,22 @@
/*
* Copyright (c) 2016-2017, 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.mixins;
import java.awt.Polygon;
import java.awt.geom.Area;
import net.runelite.api.Model;
import net.runelite.api.Perspective;
import net.runelite.api.coords.LocalPoint;
import java.awt.Polygon;
import java.awt.geom.Area;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSDecorativeObject;
import net.runelite.rs.api.RSEntity;
import net.runelite.rs.api.RSModel;
import net.runelite.rs.api.RSRenderable;
import net.runelite.rs.api.RSWallDecoration;
@Mixin(RSDecorativeObject.class)
public abstract class RSDecorativeObjectMixin implements RSDecorativeObject
@Mixin(RSWallDecoration.class)
public abstract class RSWallDecorationMixin implements RSWallDecoration
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@Inject
@@ -63,7 +39,7 @@ public abstract class RSDecorativeObjectMixin implements RSDecorativeObject
@Inject
private RSModel getModel()
{
RSRenderable renderable = getRenderable();
RSEntity renderable = getRenderable();
if (renderable == null)
{
return null;
@@ -86,7 +62,7 @@ public abstract class RSDecorativeObjectMixin implements RSDecorativeObject
@Inject
private RSModel getModel2()
{
RSRenderable renderable = getRenderable2();
RSEntity renderable = getRenderable2();
if (renderable == null)
{
return null;

View File

@@ -1,124 +0,0 @@
/*
* Copyright (c) 2018, SomeoneWithAnInternetConnection
* 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.mixins;
import java.awt.geom.Area;
import net.runelite.api.Model;
import net.runelite.api.Perspective;
import net.runelite.api.Renderable;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSWallObject;
@Mixin(RSWallObject.class)
public abstract class RSWallObjectMixin implements RSWallObject
{
@Shadow("clientInstance")
private static RSClient client;
@Inject
private int wallPlane;
@Inject
@Override
public int getPlane()
{
return wallPlane;
}
@Inject
@Override
public void setPlane(int plane)
{
this.wallPlane = plane;
}
@Inject
private Model getModelA()
{
Renderable renderable = getRenderable1();
if (renderable == null)
{
return null;
}
if (renderable instanceof Model)
{
return (Model) renderable;
}
else
{
return renderable.getModel();
}
}
@Inject
private Model getModelB()
{
Renderable renderable = getRenderable2();
if (renderable == null)
{
return null;
}
if (renderable instanceof Model)
{
return (Model) renderable;
}
else
{
return renderable.getModel();
}
}
@Inject
@Override
public Area getClickbox()
{
Area clickbox = new Area();
Area clickboxA = Perspective.getClickbox(client, getModelA(), 0, getLocalLocation());
Area clickboxB = Perspective.getClickbox(client, getModelB(), 0, getLocalLocation());
if (clickboxA == null && clickboxB == null)
{
return null;
}
if (clickboxA != null)
{
clickbox.add(clickboxA);
}
if (clickboxB != null)
{
clickbox.add(clickboxB);
}
return clickbox;
}
}

View File

@@ -24,28 +24,28 @@
*/
package net.runelite.mixins;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import net.runelite.api.HashTable;
import net.runelite.api.Node;
import net.runelite.api.Point;
import net.runelite.api.WidgetNode;
import net.runelite.api.events.WidgetHiddenChanged;
import net.runelite.api.events.WidgetPositioned;
import net.runelite.api.mixins.FieldHook;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.api.widgets.Widget;
import static net.runelite.api.widgets.WidgetInfo.TO_CHILD;
import static net.runelite.api.widgets.WidgetInfo.TO_GROUP;
import net.runelite.api.widgets.WidgetItem;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import net.runelite.api.mixins.FieldHook;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSHashTable;
import net.runelite.rs.api.RSNode;
import net.runelite.rs.api.RSNodeHashTable;
import net.runelite.rs.api.RSWidget;
@Mixin(RSWidget.class)
@@ -53,7 +53,7 @@ public abstract class RSWidgetMixin implements RSWidget
{
private static final int ITEM_SLOT_SIZE = 32;
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@Inject
@@ -153,7 +153,7 @@ public abstract class RSWidgetMixin implements RSWidget
// also the widget may not have been drawn, yet
int groupId = TO_GROUP(getId());
RSHashTable componentTable = client.getComponentTable();
RSNodeHashTable componentTable = client.getComponentTable();
RSNode[] buckets = componentTable.getBuckets();
for (RSNode node : buckets)
{
@@ -258,11 +258,6 @@ public abstract class RSWidgetMixin implements RSWidget
for (int i = 0; i < itemIds.length; ++i)
{
if (itemIds[i] <= 0)
{
continue;
}
WidgetItem item = getWidgetItem(i);
if (item != null)
@@ -292,17 +287,19 @@ public abstract class RSWidgetMixin implements RSWidget
int itemId = itemIds[index];
int itemQuantity = itemQuantities[index];
if (columns <= 0)
Point widgetCanvasLocation = getCanvasLocation();
if (itemId <= 0 || itemQuantity <= 0 || columns <= 0)
{
return null;
}
int row = index / columns;
int col = index % columns;
int itemX = rl$x + ((ITEM_SLOT_SIZE + xPitch) * col);
int itemY = rl$y + ((ITEM_SLOT_SIZE + yPitch) * row);
int itemX = widgetCanvasLocation.getX() + ((ITEM_SLOT_SIZE + xPitch) * col);
int itemY = widgetCanvasLocation.getY() + ((ITEM_SLOT_SIZE + yPitch) * row);
Rectangle bounds = new Rectangle(itemX, itemY, ITEM_SLOT_SIZE, ITEM_SLOT_SIZE);
Rectangle bounds = new Rectangle(itemX - 1, itemY - 1, ITEM_SLOT_SIZE, ITEM_SLOT_SIZE);
return new WidgetItem(itemId - 1, itemQuantity, index, bounds, this);
}
@@ -476,7 +473,7 @@ public abstract class RSWidgetMixin implements RSWidget
broadcastHidden(isSelfHidden());
}
@FieldHook("relativeY")
@FieldHook("y")
@Inject
public void onPositionChanged(int idx)
{

View File

@@ -0,0 +1,34 @@
package net.runelite.mixins;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSWorldMapManager;
@Mixin(RSWorldMapManager.class)
public abstract class RSWorldMapManagerMixin implements RSWorldMapManager
{
@Shadow("client")
static RSClient client;
/*
The worldMapZoom is essentially pixels per tile. In most instances
getPixelsPerTile returns the same as worldMapZoom.
At some map widths when 100% zoomed in the Jagex version of this function
returns 7.89 instead of 8.0 (the worldMapZoom at this level).
This would cause both the x and y positions of the map to shift
slightly when the map was certain widths.
This mixin function replaces Jagex calculation with getWorldMapZoom.
This small change makes the world map tile sizing predictable.
*/
@Replace("getPixelsPerTile")
@Override
public float getPixelsPerTile(int graphicsDiff, int worldDiff)
{
return client.getRenderOverview().getWorldMapZoom();
}
}

View File

@@ -0,0 +1,29 @@
package net.runelite.mixins;
import net.runelite.api.Point;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSWorldMap;
import net.runelite.rs.api.RSWorldMapManager;
@Mixin(RSWorldMap.class)
public abstract class RSWorldMapMixin implements RSWorldMap
{
@Override
@Inject
public Point getWorldMapPosition()
{
RSWorldMapManager worldMapManager = getWorldMapManager();
int worldX = getWorldMapX() + worldMapManager.getSurfaceOffsetX();
int worldY = getWorldMapY() + worldMapManager.getSurfaceOffsetY();
return new Point(worldX, worldY);
}
@Inject
public void setWorldMapPositionTarget(WorldPoint worldPoint)
{
setWorldMapPositionTarget(worldPoint.getX(), worldPoint.getY());
}
}

View File

@@ -24,9 +24,9 @@
*/
package net.runelite.mixins;
import java.util.EnumSet;
import net.runelite.api.WorldType;
import net.runelite.api.events.WorldListLoad;
import java.util.EnumSet;
import net.runelite.api.mixins.FieldHook;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
@@ -37,7 +37,7 @@ import net.runelite.rs.api.RSWorld;
@Mixin(RSWorld.class)
public abstract class RSWorldMixin implements RSWorld
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@Inject
@@ -55,7 +55,7 @@ public abstract class RSWorldMixin implements RSWorld
}
@Inject
@FieldHook("playerCount")
@FieldHook("population")
public void playerCountChanged(int idx)
{
RSWorld[] worlds = client.getWorldList();

View File

@@ -24,26 +24,26 @@
*/
package net.runelite.mixins;
import net.runelite.api.Client;
import static net.runelite.api.Opcodes.RUNELITE_EXECUTE;
import net.runelite.api.events.ScriptCallbackEvent;
import net.runelite.api.widgets.JavaScriptCallback;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.runelite.api.Client;
import net.runelite.api.events.ScriptCallbackEvent;
import net.runelite.api.mixins.Copy;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow;
import net.runelite.api.widgets.JavaScriptCallback;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSScript;
import net.runelite.rs.api.RSScriptEvent;
import static net.runelite.api.Opcodes.RUNELITE_EXECUTE;
@Mixin(RSClient.class)
public abstract class ScriptVMMixin implements RSClient
{
@Shadow("clientInstance")
@Shadow("client")
private static Client client;
// This field is set by the ScriptVM raw injector
@@ -107,13 +107,13 @@ public abstract class ScriptVMMixin implements RSClient
return false;
}
@Copy("runScript")
@Copy("runScript0")
static void rs$runScript(RSScriptEvent event, int maxExecutionTime)
{
throw new RuntimeException();
}
@Replace("runScript")
@Replace("runScript0")
static void rl$runScript(RSScriptEvent event, int maxExecutionTime)
{
Object[] arguments = event.getArguments();

View File

@@ -1,78 +1,53 @@
/*
* Copyright (c) 2018, Lotto <https://github.com/devLotto>
* 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 HOLDER 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.mixins;
import net.runelite.api.Sprite;
import java.util.HashMap;
import java.util.Map;
import net.runelite.api.SpritePixels;
import net.runelite.api.mixins.Copy;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.rs.api.RSAbstractIndexCache;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSIndexDataBase;
import net.runelite.rs.api.RSSpritePixels;
import net.runelite.rs.api.RSSprite;
@Mixin(RSClient.class)
public abstract class SpriteMixin implements RSClient
{
@Inject
private static final Map<Integer, SpritePixels> spriteOverrides = new HashMap<Integer, SpritePixels>();
private static final Map<Integer, Sprite> spriteOverrides = new HashMap<Integer, Sprite>();
@Inject
private static final Map<Integer, SpritePixels> widgetSpriteOverrides = new HashMap<Integer, SpritePixels>();
private static final Map<Integer, Sprite> widgetSpriteOverrides = new HashMap<Integer, Sprite>();
@Inject
@Override
public Map<Integer, SpritePixels> getSpriteOverrides()
public Map<Integer, Sprite> getSpriteOverrides()
{
return spriteOverrides;
}
@Inject
@Override
public Map<Integer, SpritePixels> getWidgetSpriteOverrides()
public Map<Integer, Sprite> getWidgetSpriteOverrides()
{
return widgetSpriteOverrides;
}
@Copy("getSpriteAsSpritePixels")
public static RSSpritePixels rs$loadSprite(RSIndexDataBase var0, int var1, int var2)
@Copy("readSprite")
public static RSSprite rs$loadSprite(RSAbstractIndexCache var0, int var1, int var2)
{
throw new RuntimeException();
}
@Replace("getSpriteAsSpritePixels")
public static RSSpritePixels rl$loadSprite(RSIndexDataBase var0, int var1, int var2)
@Replace("readSprite")
public static RSSprite rl$loadSprite(RSAbstractIndexCache var0, int var1, int var2)
{
SpritePixels sprite = spriteOverrides.get(var1);
Sprite sprite = spriteOverrides.get(var1);
if (sprite != null)
{
return (RSSpritePixels) sprite;
return (RSSprite) sprite;
}
return rs$loadSprite(var0, var1, var2);

View File

@@ -1,41 +1,18 @@
/*
* Copyright (c) 2018, Lotto <https://github.com/devLotto>
* 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.mixins;
import java.awt.Dimension;
import net.runelite.api.mixins.Copy;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSGameEngine;
import net.runelite.rs.api.RSGameShell;
@Mixin(RSGameEngine.class)
public abstract class StretchedModeMaxSizeMixin implements RSGameEngine
@Mixin(RSGameShell.class)
public abstract class StretchedModeMaxSizeMixin implements RSGameShell
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@Copy("resizeCanvas")

View File

@@ -1,32 +1,9 @@
/*
* Copyright (c) 2018, Lotto <https://github.com/devLotto>
* 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.mixins;
import net.runelite.api.Constants;
import java.awt.Container;
import java.awt.Dimension;
import net.runelite.api.Constants;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSClient;

View File

@@ -1,113 +0,0 @@
/*
* Copyright (c) 2016-2017, 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.mixins;
import java.awt.Graphics2D;
import java.awt.Polygon;
import net.runelite.api.Perspective;
import net.runelite.api.Point;
import net.runelite.api.TileObject;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Mixins;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSDecorativeObject;
import net.runelite.rs.api.RSGameObject;
import net.runelite.rs.api.RSGroundObject;
import net.runelite.rs.api.RSItemLayer;
import net.runelite.rs.api.RSWallObject;
@Mixins({
@Mixin(RSDecorativeObject.class),
@Mixin(RSGameObject.class),
@Mixin(RSGroundObject.class),
@Mixin(RSItemLayer.class),
@Mixin(RSWallObject.class)
})
public abstract class TileObjectMixin implements TileObject
{
@Shadow("clientInstance")
private static RSClient client;
@Override
@Inject
public int getId()
{
long hash = getHash();
return (int) (hash >>> 17 & 4294967295L);
}
@Override
@Inject
public WorldPoint getWorldLocation()
{
return WorldPoint.fromLocal(client, getX(), getY(), getPlane());
}
@Override
@Inject
public LocalPoint getLocalLocation()
{
return new LocalPoint(getX(), getY());
}
@Override
@Inject
public Point getCanvasLocation()
{
return getCanvasLocation(0);
}
@Override
@Inject
public Point getCanvasLocation(int zOffset)
{
return Perspective.localToCanvas(client, getLocalLocation(), getPlane(), zOffset);
}
@Override
@Inject
public Polygon getCanvasTilePoly()
{
return Perspective.getCanvasTilePoly(client, getLocalLocation());
}
@Override
@Inject
public Point getCanvasTextLocation(Graphics2D graphics, String text, int zOffset)
{
return Perspective.getCanvasTextLocation(client, graphics, getLocalLocation(), text, zOffset);
}
@Override
@Inject
public Point getMinimapLocation()
{
return Perspective.localToMinimap(client, getLocalLocation());
}
}

View File

@@ -1,50 +1,26 @@
/*
* 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.mixins;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import java.util.Map;
import net.runelite.api.VarClientInt;
import net.runelite.api.VarClientStr;
import net.runelite.api.Varbits;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import java.util.Map;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSNodeCache;
import net.runelite.rs.api.RSVarbit;
import net.runelite.rs.api.RSEvictingDualNodeHashTable;
import net.runelite.rs.api.RSVarbitDefinition;
@Mixin(RSClient.class)
public abstract class VarbitMixin implements RSClient
{
@Shadow("clientInstance")
@Shadow("client")
private static RSClient client;
@Inject
private Cache<Integer, RSVarbit> varbitCache = CacheBuilder.newBuilder()
private Cache<Integer, RSVarbitDefinition> varbitCache = CacheBuilder.newBuilder()
.maximumSize(128)
.build();
@@ -75,12 +51,12 @@ public abstract class VarbitMixin implements RSClient
{
assert client.isClientThread();
RSVarbit v = varbitCache.getIfPresent(varbitId);
RSVarbitDefinition v = varbitCache.getIfPresent(varbitId);
if (v == null)
{
client.getVarbit(varbitId); // load varbit into cache
RSNodeCache varbits = client.getVarbitCache();
v = (RSVarbit) varbits.get(varbitId); // get from cache
RSEvictingDualNodeHashTable varbits = client.getVarbitCache();
v = (RSVarbitDefinition) varbits.get(varbitId); // get from cache
varbitCache.put(varbitId, v);
}
@@ -100,12 +76,12 @@ public abstract class VarbitMixin implements RSClient
@Override
public void setVarbitValue(int[] varps, int varbitId, int value)
{
RSVarbit v = varbitCache.getIfPresent(varbitId);
RSVarbitDefinition v = varbitCache.getIfPresent(varbitId);
if (v == null)
{
client.getVarbit(varbitId); // load varbit into cache
RSNodeCache varbits = client.getVarbitCache();
v = (RSVarbit) varbits.get(varbitId); // get from cache
RSEvictingDualNodeHashTable varbits = client.getVarbitCache();
v = (RSVarbitDefinition) varbits.get(varbitId); // get from cache
varbitCache.put(varbitId, v);
}

View File

@@ -1,61 +1,36 @@
/*
* Copyright (c) 2018, Lotto <https://github.com/devLotto>
* 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 HOLDER 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.mixins;
import net.runelite.api.Sprite;
import java.util.Map;
import net.runelite.api.SpritePixels;
import net.runelite.api.mixins.Copy;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSSpritePixels;
import net.runelite.rs.api.RSSprite;
import net.runelite.rs.api.RSWidget;
@Mixin(RSWidget.class)
public abstract class WidgetSpriteMixin implements RSWidget
{
@Shadow("widgetSpriteOverrides")
private static Map<Integer, SpritePixels> widgetSpriteOverrides;
private static Map<Integer, Sprite> widgetSpriteOverrides;
@Copy("getWidgetSprite")
public RSSpritePixels rs$getWidgetSprite(boolean var1)
@Copy("getSprite")
public RSSprite rs$getWidgetSprite(boolean var1)
{
throw new RuntimeException();
}
@Replace("getWidgetSprite")
public RSSpritePixels rl$getWidgetSprite(boolean var1)
@Replace("getSprite")
public RSSprite rl$getWidgetSprite(boolean var1)
{
if (getSpriteId() != -1)
{
SpritePixels sprite = widgetSpriteOverrides.get(getId());
Sprite sprite = widgetSpriteOverrides.get(getId());
if (sprite != null)
{
return (RSSpritePixels) sprite;
return (RSSprite) sprite;
}
}

View File

@@ -1,34 +1,10 @@
/*
* Copyright (c) 2018, Lotto <https://github.com/devLotto>
* 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.mixins;
import net.runelite.api.MenuAction;
import net.runelite.api.World;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.rs.api.RSClient;
@Mixin(RSClient.class)
@@ -39,7 +15,7 @@ public abstract class WorldHoppingMixin implements RSClient
public void openWorldHopper()
{
// The clicked x & y coordinates (the last arguments) are not processed in the game or sent to Jagex, so they don't have to be real.
menuAction(-1, WidgetInfo.WORLD_SWITCHER_BUTTON.getId(), MenuAction.WIDGET_DEFAULT.getId(), 1, "World Switcher", "", 658, 384);
invokeMenuAction(-1, WidgetInfo.WORLD_SWITCHER_BUTTON.getId(), MenuAction.WIDGET_DEFAULT.getId(), 1, "World Switcher", "", 658, 384);
}
@Inject
@@ -47,6 +23,6 @@ public abstract class WorldHoppingMixin implements RSClient
public void hopToWorld(World world)
{
final int worldId = world.getId();
menuAction(worldId, WidgetInfo.WORLD_SWITCHER_LIST.getId(), MenuAction.WIDGET_DEFAULT.getId(), 1, "Switch", "<col=ff9040>" + (worldId - 300) + "</col>", 683, 244);
invokeMenuAction(worldId, WidgetInfo.WORLD_SWITCHER_LIST.getId(), MenuAction.WIDGET_DEFAULT.getId(), 1, "Switch", "<col=ff9040>" + (worldId - 300) + "</col>", 683, 244);
}
}

View File

@@ -1,58 +0,0 @@
/*
* Copyright (c) 2018, Morgan Lewis <https://github.com/MESLewis>
* 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.mixins;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSWorldMapManager;
@Mixin(RSWorldMapManager.class)
public abstract class WorldMapManagerMixin implements RSWorldMapManager
{
@Shadow("clientInstance")
static RSClient client;
/*
The worldMapZoom is essentially pixels per tile. In most instances
getPixelsPerTile returns the same as worldMapZoom.
At some map widths when 100% zoomed in the Jagex version of this function
returns 7.89 instead of 8.0 (the worldMapZoom at this level).
This would cause both the x and y positions of the map to shift
slightly when the map was certain widths.
This mixin function replaces Jagex calculation with getWorldMapZoom.
This small change makes the world map tile sizing predictable.
*/
@Replace("getPixelsPerTile")
@Override
public float getPixelsPerTile(int graphicsDiff, int worldDiff)
{
return client.getRenderOverview().getWorldMapZoom();
}
}

View File

@@ -1,53 +0,0 @@
/*
* Copyright (c) 2018, Morgan Lewis <https://github.com/MESLewis>
* 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.mixins;
import net.runelite.api.Point;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSRenderOverview;
import net.runelite.rs.api.RSWorldMapManager;
@Mixin(RSRenderOverview.class)
public abstract class WorldMapMixin implements RSRenderOverview
{
@Override
@Inject
public Point getWorldMapPosition()
{
RSWorldMapManager worldMapManager = getWorldMapManager();
int worldX = getWorldMapX() + worldMapManager.getSurfaceOffsetX();
int worldY = getWorldMapY() + worldMapManager.getSurfaceOffsetY();
return new Point(worldX, worldY);
}
@Inject
public void setWorldMapPositionTarget(WorldPoint worldPoint)
{
setWorldMapPositionTarget(worldPoint.getX(), worldPoint.getY());
}
}