Skip to content

Commit

Permalink
Merge pull request #538 from chsami/development
Browse files Browse the repository at this point in the history
1.6.4.3
  • Loading branch information
chsami authored Dec 3, 2024
2 parents 96a8b0d + 265d1cb commit 6a05218
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 49 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ jobs:
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "1.6.4.2"
automatic_release_tag: "1.6.4.3"
prerelease: false
title: "Release 1.6.4.1"
title: "Release 1.6.4.3"
files: |
/home/runner/work/Microbot/Microbot/runelite-client/target/microbot-*.jar
Expand Down
2 changes: 1 addition & 1 deletion runelite-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<git.commit.id.abbrev>nogit</git.commit.id.abbrev>
<git.dirty>false</git.dirty>
<shade.skip>false</shade.skip>
<microbot.version>1.6.4.2</microbot.version>
<microbot.version>1.6.4.3</microbot.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

import static net.runelite.api.NullObjectID.*;
import static net.runelite.api.ObjectID.LADDER_36231;
import static net.runelite.client.plugins.microbot.util.math.Random.random;
import static net.runelite.client.plugins.microbot.agility.enums.AgilityCourseName.GNOME_STRONGHOLD_AGILITY_COURSE;
import static net.runelite.client.plugins.microbot.agility.enums.AgilityCourseName.PRIFDDINAS_AGILITY_COURSE;

Expand Down Expand Up @@ -59,6 +58,7 @@ public class AgilityScript extends Script {
WorldPoint startCourse = null;

public static int currentObstacle = 0;
private static boolean isWalkingToStart = false;

public static final Set<Integer> PORTAL_OBSTACLE_IDS = ImmutableSet.of(
// Prifddinas portals
Expand Down Expand Up @@ -163,7 +163,6 @@ public boolean run(MicroAgilityConfig config) {

Rs2Antiban.resetAntibanSettings();
Rs2Antiban.antibanSetupTemplates.applyAgilitySetup();

init(config);
mainScheduledFuture = scheduledExecutorService.scheduleWithFixedDelay(() -> {
try {
Expand All @@ -182,7 +181,8 @@ public boolean run(MicroAgilityConfig config) {
// Eat food.
Rs2Player.eatAt(config.hitpoints());

if (Rs2Player.isMoving()) return;
if(isWalkingToStart) Microbot.log("isWalkingToStart: true");
else if (Rs2Player.isMoving()) return;
if (Rs2Player.isAnimating()) return;

if (currentObstacle >= getCurrentCourse(config).size()) {
Expand All @@ -209,6 +209,8 @@ public boolean run(MicroAgilityConfig config) {
}
if (Rs2Player.getWorldLocation().distanceTo(startCourse) < 100) {//extra check for prif course
Rs2Walker.walkTo(startCourse, 8);
Microbot.log("Going back to course's starting point");
isWalkingToStart = true;
return;
}
}
Expand Down Expand Up @@ -267,6 +269,7 @@ public boolean run(MicroAgilityConfig config) {
}

if (Rs2GameObject.interact(gameObject)) {
isWalkingToStart = false;
//LADDER_36231 in prifddinas does not give experience
if (gameObject.getId() != LADDER_36231 && waitForAgilityObstabcleToFinish(agilityExp))
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,12 +399,14 @@ private Pickaxe getBestPickaxe(List<Rs2Item> items) {
}

private boolean shouldBreak() {
boolean isReadyToBreak = BreakHandlerScript.breakIn <= 1;
if (!plugin.isBreakHandlerEnabled()) return false;

return plugin.isBreakHandlerEnabled() && isReadyToBreak;
return BreakHandlerScript.breakIn <= 1;
}

public void toggleLockState(boolean lock) {
if (!plugin.isBreakHandlerEnabled()) return;

if (plugin.isBreakHandlerEnabled() && plugin.useBreakAtBank()) {
if (lock && !BreakHandlerScript.isLockState()) {
BreakHandlerScript.setLockState(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,8 @@ private boolean requiresChronicle(Transport transport) {

/** Checks if the Chronicle has charges */
private boolean hasChronicleCharges() {
if (!Rs2Equipment.isWearing(ItemID.CHRONICLE) || !Rs2Inventory.hasItem(ItemID.CHRONICLE)) return false;

String charges = Microbot.getConfigManager()
.getRSProfileConfiguration(ItemChargeConfig.GROUP, ItemChargeConfig.KEY_CHRONICLE);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public boolean run(VarrockAnvilConfig config) {
}

if (!Rs2Player.isRunEnabled()) {
debug("Enabled run for fishing spot");
debug("Enabled run to anvil");
Rs2Player.toggleRunEnergy(true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import net.runelite.api.*;
import net.runelite.client.plugins.microbot.Microbot;
import net.runelite.client.plugins.microbot.util.keyboard.Rs2Keyboard;
import net.runelite.client.plugins.microbot.util.math.Random;
import net.runelite.client.plugins.microbot.util.math.Rs2Random;

import java.awt.event.KeyEvent;
import java.lang.reflect.Field;
Expand All @@ -17,12 +17,16 @@
import java.util.stream.Collectors;

/**
* @Export("sequence")
* int sequence = -1;
* @ObfuscatedName("cz")
* @ObfuscatedGetter(
* intValue = -1043355907
* )
* @ObfuscatedName("cr")
* @ObfuscatedGetter(
* intValue = 1400873349 --> animationMultiplier
* )
* @Export("sequence")
* int sequence;
* @ObfuscatedName("cz")
* @ObfuscatedGetter(
* intValue = -1043355907
)
*
* @ObfuscatedName("hw")
* @Implements("NPCComposition")
Expand All @@ -43,7 +47,7 @@ public class Rs2Reflection {
* sequence maps to an actor animation
* actor can be an npc/player
*/
static int sequence = -1043355907;
static int animationMultiplier = 1400873349;

/**
* Credits to EthanApi
Expand All @@ -55,41 +59,46 @@ public static int getAnimation(NPC npc) {
if (npc == null) {
return -1;
}
if (animationField == null) {
for (Field declaredField : npc.getClass().getSuperclass().getDeclaredFields()) {
if (declaredField == null) {
continue;
}
declaredField.setAccessible(true);
if (declaredField.getType() != int.class) {
continue;
}
if (Modifier.isFinal(declaredField.getModifiers())) {
continue;
}
if (Modifier.isStatic(declaredField.getModifiers())) {
continue;
}
int value = declaredField.getInt(npc);
declaredField.setInt(npc, 4795789);
if (npc.getAnimation() == sequence * 4795789) {
animationField = declaredField.getName();
try {
if (animationField == null) {
for (Field declaredField : npc.getClass().getSuperclass().getDeclaredFields()) {
if (declaredField == null) {
continue;
}
declaredField.setAccessible(true);
if (declaredField.getType() != int.class) {
continue;
}
if (Modifier.isFinal(declaredField.getModifiers())) {
continue;
}
if (Modifier.isStatic(declaredField.getModifiers())) {
continue;
}
int value = declaredField.getInt(npc);
declaredField.setInt(npc, 4795789);
if (npc.getAnimation() == sequence * 4795789) {
animationField = declaredField.getName();
declaredField.setInt(npc, value);
declaredField.setAccessible(false);
break;
}
declaredField.setInt(npc, value);
declaredField.setAccessible(false);
break;
}
declaredField.setInt(npc, value);
declaredField.setAccessible(false);
}
if (animationField == null) {
return -1;
}
Field animation = npc.getClass().getSuperclass().getDeclaredField(animationField);
animation.setAccessible(true);
int anim = animation.getInt(npc) * animationMultiplier;
animation.setAccessible(false);
return anim;
} catch(Exception ex) {
Microbot.log("Failed to get animation : " + ex.getMessage());
}
if (animationField == null) {
return -1;
}
Field animation = npc.getClass().getSuperclass().getDeclaredField(animationField);
animation.setAccessible(true);
int anim = animation.getInt(npc) * sequence;
animation.setAccessible(false);
return anim;
return -1;
}

@SneakyThrows
Expand Down Expand Up @@ -165,7 +174,7 @@ public static void invokeMenu(int param0, int param1, int opcode, int identifier

doAction.setAccessible(true);
Microbot.getClientThread().runOnClientThread(() -> doAction.invoke(null, param0, param1, opcode, identifier, itemId, option, target, x, y));
if (Microbot.getClient().getKeyboardIdleTicks() > Random.random(5000, 10000)) {
if (Microbot.getClient().getKeyboardIdleTicks() > Rs2Random.between(5000, 10000)) {
Rs2Keyboard.keyPress(KeyEvent.VK_BACK_SPACE);
}
System.out.println("[INVOKE] => param0: " + param0 + " param1: " + param1 + " opcode: " + opcode + " id: " + identifier + " itemid: " + itemId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,18 @@ private static WalkerState processWalk(WorldPoint target, int distance) {
System.out.println("start loop " + i);

if (ShortestPathPlugin.getMarker() == null) {
System.out.println("market is null");
System.out.println("marker is null");
break;
}

if (!isNearPath()) {
System.out.println("No longer near path");
if (config.cancelInstead()) {
System.out.println("cancel instead of recalculate");
setTarget(null);
} else {
recalculatePath();
}
break;
}

Expand Down Expand Up @@ -1205,6 +1216,22 @@ public static boolean isNear(WorldPoint target) {
return Rs2Player.getWorldLocation().equals(target);
}

public static boolean isNearPath() {
if (ShortestPathPlugin.getPathfinder() == null || ShortestPathPlugin.getPathfinder() .getPath() == null || ShortestPathPlugin.getPathfinder().getPath().isEmpty() ||
config.recalculateDistance() < 0 || lastPosition.equals(lastPosition = Rs2Player.getWorldLocation())) {
return true;
}

var reachableTiles = Rs2Tile.getReachableTilesFromTile(Rs2Player.getWorldLocation(), config.recalculateDistance() - 1);
for (WorldPoint point : ShortestPathPlugin.getPathfinder().getPath()) {
if (reachableTiles.containsKey(point)) {
return true;
}
}

return false;
}

private static void checkIfStuck() {
if (Rs2Player.getWorldLocation().equals(lastPosition)) {
stuckCount++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,8 @@
3237 9858 0 3236 3458 0 Climb-up;Ladder;11806
3236 3458 0 3237 9858 0 Open;Manhole;881
3236 3458 0 3237 9858 0 Climb-down;Manhole;882
3210 9899 0 3210 9898 0 Slash;Web;733 8
3210 9898 0 3210 9899 0 Slash;Web;733 8

# Stronghold of Security
3081 3421 0 1859 5243 0 Climb-down;Entrance;20790
Expand Down

0 comments on commit 6a05218

Please sign in to comment.