Skip to content

Commit 61c1a7c

Browse files
committed
feat(api): add ClientConfiguration interface and update related classes
2 parents e659fff + ea4f6d5 commit 61c1a7c

File tree

31 files changed

+382
-334
lines changed

31 files changed

+382
-334
lines changed

cache/src/main/java/net/runelite/cache/definitions/NpcDefinition.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public class NpcDefinition
5151
public int crawlRotate180Animation = -1;
5252
public int crawlRotateLeftAnimation = -1;
5353
public int crawlRotateRightAnimation = -1;
54+
public boolean idleAnimRestart;
5455
public short[] recolorToFind;
5556
public short[] recolorToReplace;
5657
public short[] retextureToFind;
@@ -81,4 +82,5 @@ public class NpcDefinition
8182
public boolean canHideForOverlap;
8283
public int overlapTintHSL = 39188;
8384
public boolean unknown1 = false;
85+
public boolean zbuf = true;
8486
}

cache/src/main/java/net/runelite/cache/definitions/ObjectDefinition.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public class ObjectDefinition
6868
private boolean obstructsGround = false;
6969
private int contouredGround = -1;
7070
private int supportsItems = -1;
71+
private int raise;
7172
private int[] configChangeDest;
7273
private int category;
7374
private boolean isRotated = false;

cache/src/main/java/net/runelite/cache/definitions/loaders/NpcLoader.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,10 @@ else if (opcode == 129)
383383
{
384384
def.unknown1 = true;
385385
}
386+
else if (opcode == 130)
387+
{
388+
def.idleAnimRestart = true;
389+
}
386390
else if (opcode == 145)
387391
{
388392
def.canHideForOverlap = true;
@@ -391,6 +395,10 @@ else if (opcode == 146)
391395
{
392396
def.overlapTintHSL = stream.readUnsignedShort();
393397
}
398+
else if (opcode == 147)
399+
{
400+
def.zbuf = false;
401+
}
394402
else if (opcode == 249)
395403
{
396404
length = stream.readUnsignedByte();

cache/src/main/java/net/runelite/cache/definitions/loaders/ObjectLoader.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,10 @@ else if (opcode == 95)
396396
{
397397
def.setSoundVisibility(is.readUnsignedByte());
398398
}
399+
else if (opcode == 96)
400+
{
401+
def.setRaise(is.readUnsignedByte());
402+
}
399403
else if (opcode == 249)
400404
{
401405
int length = is.readUnsignedByte();

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ org.gradle.parallel=true
2828
org.gradle.caching=false
2929

3030
project.build.group=net.runelite
31-
project.build.version=1.12.14
31+
project.build.version=1.12.15
3232

3333
glslang.path=
34-
microbot.version=2.1.16
34+
microbot.version=2.1.17
3535
microbot.commit.sha=nogit
3636
microbot.repo.url=http://138.201.81.246:8081/repository/microbot-snapshot/
3737
microbot.repo.username=

runelite-api/src/main/java/net/runelite/api/Client.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@ public interface Client extends OAuthApi, GameEngine
144144
void setGameState(GameState gameState);
145145

146146
/**
147-
* Causes the client to shutdown. It is faster than
148-
* {@link java.applet.Applet#stop()} because it doesn't wait for 4000ms.
147+
* Causes the client to shutdown.
149148
* This will call {@link System#exit} when it is done
150149
*/
151150
void stopNow();
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright (c) 2025 Abex
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are met:
7+
*
8+
* 1. Redistributions of source code must retain the above copyright notice, this
9+
* list of conditions and the following disclaimer.
10+
* 2. Redistributions in binary form must reproduce the above copyright notice,
11+
* this list of conditions and the following disclaimer in the documentation
12+
* and/or other materials provided with the distribution.
13+
*
14+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18+
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24+
*/
25+
package net.runelite.api;
26+
27+
import java.net.URL;
28+
29+
public interface ClientConfiguration
30+
{
31+
URL getCodeBase();
32+
String getParameter(String key);
33+
void onError(String code);
34+
}

runelite-api/src/main/java/net/runelite/api/DecorativeObject.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ public interface DecorativeObject extends TileObject
5555
*/
5656
int getYOffset();
5757

58+
int getXOffset2();
59+
60+
int getYOffset2();
61+
5862
/**
5963
* A bitfield containing various flags:
6064
* <pre>{@code

runelite-api/src/main/java/net/runelite/api/GameEngine.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
*/
3232
public interface GameEngine
3333
{
34+
void setConfiguration(ClientConfiguration configuration);
35+
void initialize();
36+
3437
/**
3538
* Gets the canvas that contains everything.
3639
*

runelite-api/src/main/java/net/runelite/api/Perspective.java

Lines changed: 10 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ public static Point localToCanvas(@Nonnull Client client, @Nonnull LocalPoint po
132132
}
133133

134134
LocalPoint entityLocation = we.getLocalLocation();
135-
int height = getTileHeight(we.getWorldView(), point.getX(), point.getY(), plane); // height in wv
136-
height += getTileHeight(wv, entityLocation.getX(), entityLocation.getY(), wv.getPlane()); // height of we
135+
int height = we.getWorldView().getTileHeight(point.getX(), point.getY(), plane); // height in wv
136+
height += wv.getTileHeight(entityLocation.getX(), entityLocation.getY(), wv.getPlane()); // height of we
137137
height -= heightOffset;
138138

139139
WorldView subWv = we.getWorldView();
@@ -671,30 +671,6 @@ public static int getFootprintTileHeight(@Nonnull Client client, @Nonnull LocalP
671671
return h;
672672
}
673673

674-
/**
675-
* Get the height of a location, in local coordinates. Interpolates the height from the adjacent tiles.
676-
* Does not account for bridges.
677-
* @return
678-
*/
679-
private static int getTileHeight(@Nonnull WorldView wv, int localX, int localY, int plane)
680-
{
681-
int offset = wv.isTopLevel() ? ESCENE_OFFSET : 0;
682-
int sceneX = (localX >> LOCAL_COORD_BITS) + offset;
683-
int sceneY = (localY >> LOCAL_COORD_BITS) + offset;
684-
if (sceneX >= 0 && sceneY >= 0 && sceneX < wv.getSizeX() + offset && sceneY < wv.getSizeY() + offset)
685-
{
686-
int[][][] tileHeights = wv.getScene().getTileHeights();
687-
688-
int x = localX & (LOCAL_TILE_SIZE - 1);
689-
int y = localY & (LOCAL_TILE_SIZE - 1);
690-
int var8 = x * tileHeights[plane][sceneX + 1][sceneY] + (LOCAL_TILE_SIZE - x) * tileHeights[plane][sceneX][sceneY] >> LOCAL_COORD_BITS;
691-
int var9 = tileHeights[plane][sceneX][sceneY + 1] * (LOCAL_TILE_SIZE - x) + x * tileHeights[plane][sceneX + 1][sceneY + 1] >> LOCAL_COORD_BITS;
692-
return (LOCAL_TILE_SIZE - y) * var8 + y * var9 >> LOCAL_COORD_BITS;
693-
}
694-
695-
return 0;
696-
}
697-
698674
/**
699675
* Calculates a tile polygon from offset worldToScreen() points.
700676
*
@@ -761,10 +737,11 @@ public static Polygon getCanvasTileAreaPoly(
761737
}
762738

763739
int offset = wv.isTopLevel() ? ESCENE_OFFSET : 0;
740+
int escene = offset << 1;
764741
final int msx = localLocation.getSceneX() + offset;
765742
final int msy = localLocation.getSceneY() + offset;
766743

767-
if (msx < 0 || msy < 0 || msx >= wv.getSizeX() + offset || msy >= wv.getSizeY() + offset)
744+
if (msx < 0 || msy < 0 || msx >= wv.getSizeX() + escene || msy >= wv.getSizeY() + escene)
768745
{
769746
// out of scene
770747
return null;
@@ -778,10 +755,10 @@ public static Polygon getCanvasTileAreaPoly(
778755
var scene = wv.getScene();
779756
final byte[][][] tileSettings = scene.getExtendedTileSettings();
780757

781-
int tilePlane = level;
758+
int mapLevel = level;
782759
if (level < Constants.MAX_Z - 1 && (tileSettings[1][msx][msy] & TILE_FLAG_BRIDGE) == TILE_FLAG_BRIDGE)
783760
{
784-
tilePlane = level + 1;
761+
mapLevel = level + 1;
785762
}
786763

787764
final int swX = localLocation.getX() - (sizeX * LOCAL_TILE_SIZE / 2);
@@ -796,10 +773,10 @@ public static Polygon getCanvasTileAreaPoly(
796773
final int nwX = neX;
797774
final int nwY = swY;
798775

799-
final int swHeight = getTileHeight(wv, swX, swY, tilePlane) - heightOffset;
800-
final int nwHeight = getTileHeight(wv, nwX, nwY, tilePlane) - heightOffset;
801-
final int neHeight = getTileHeight(wv, neX, neY, tilePlane) - heightOffset;
802-
final int seHeight = getTileHeight(wv, seX, seY, tilePlane) - heightOffset;
776+
final int swHeight = wv.getTileHeight(swX, swY, mapLevel) - heightOffset;
777+
final int nwHeight = wv.getTileHeight(nwX, nwY, mapLevel) - heightOffset;
778+
final int neHeight = wv.getTileHeight(neX, neY, mapLevel) - heightOffset;
779+
final int seHeight = wv.getTileHeight(seX, seY, mapLevel) - heightOffset;
803780

804781
Point p1 = localToCanvas(client, wv.getId(), swX, swY, swHeight);
805782
Point p2 = localToCanvas(client, wv.getId(), nwX, nwY, nwHeight);

0 commit comments

Comments
 (0)