Skip to content

Commit

Permalink
Fix broken offsets after game update
Browse files Browse the repository at this point in the history
  • Loading branch information
Punikekk committed Jun 20, 2024
1 parent d06a03b commit 59c7a4e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void update() {
if (petAddress != pet.address) pet.update(petAddress);
pet.update();

long targetPtr = API.readLong(main.mapManager.mapAddress, 120, 40);
long targetPtr = API.readLong(main.mapManager.mapAddress, 128, 40);

if (targetPtr == 0) inGameTarget = null;
else if (targetPtr == petAddress) inGameTarget = pet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,14 @@ public void tick() {
private void update(long address) {
mapAddress = address;

internalWidth = API.readInt(address + 68);
internalHeight = API.readInt(address + 72);
internalWidth = API.readInt(address + 76);
internalHeight = API.readInt(address + 80);
if (internalHeight == 13100) internalHeight = 13500;
if (internalHeight == 26200) internalHeight = 27000;

mapBound.set(0, 0, internalWidth, internalHeight);

int currMap = API.readInt(address + 76);
int currMap = API.readInt(address + 84);
boolean switched = currMap != id;

if (switched)
Expand Down Expand Up @@ -428,11 +428,11 @@ private boolean isMarker(long sprite, double scale, Location result) {
}

public boolean isTarget(Entity entity) {
return API.readLong(API.readLong(mapAddress + 120) + 40) == entity.address;
return API.readLong(API.readLong(mapAddress + 128) + 40) == entity.address;
}

public boolean setTarget(long entity) {
long targetWrapper = API.readLong(mapAddress + 120);
long targetWrapper = API.readLong(mapAddress + 128);
if (ByteUtils.isValidPtr(targetWrapper)) {
return API.callMethodChecked(true, "23(set target)(2626)1016221500", 4, targetWrapper, entity);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ public Optional<eu.darkbot.api.game.other.Location> getDestination() {

@Override
public void update() {
long newTarget = API.readLong(address + 112);
long newTarget = API.readLong(address + 120);
if (newTarget != 0 || keepTargetTime > System.currentTimeMillis()) {
target = newTarget;
if (target != 0) keepTargetTime = System.currentTimeMillis() + 1000;
}
angle = Math.toRadians(API.readInt(API.readLong(address + 48) + 32));
speed = API.readInt(API.readLong(address + 72) + 40);
angle = Math.toRadians(API.readInt(API.readLong(address + 56) + 32));
speed = API.readInt(API.readLong(address + 80) + 40);

destination.update(API.readLong(address + 96));
destination.update(API.readLong(address + 104));
destination.update();

updateSpeedAndAngle();
Expand All @@ -62,7 +62,7 @@ private void updateSpeedAndAngle() {

if (speed != 1) return; // Entities with a valid real speed do not need to have this speed prediction done

long tweenLiteAddress = API.readLong(address, 104);
long tweenLiteAddress = API.readLong(address, 112);

double timeNeeded = API.readDouble(tweenLiteAddress, 152);
if (pastTimeNeeded == timeNeeded) return;
Expand Down

0 comments on commit 59c7a4e

Please sign in to comment.