Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
@Slf4j
public class AmmoniteCrabPlugin extends Plugin {

public final static String version = "1.1.4";
public final static String version = "1.1.6";
@Inject
public AmmoniteCrabScript ammoniteCrabScript;
@Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,12 @@
import net.runelite.client.plugins.microbot.util.grounditem.LootingParameters;
import net.runelite.client.plugins.microbot.util.grounditem.Rs2GroundItem;
import net.runelite.client.plugins.microbot.util.inventory.Rs2Inventory;
import net.runelite.client.plugins.microbot.util.keyboard.Rs2Keyboard;
import net.runelite.client.plugins.microbot.api.npc.models.Rs2NpcModel;
import net.runelite.client.plugins.microbot.util.player.Rs2Player;
import net.runelite.client.plugins.microbot.util.player.Rs2PlayerModel;
import net.runelite.client.plugins.microbot.util.security.Login;
import net.runelite.client.plugins.microbot.util.walker.Rs2Walker;
import net.runelite.client.plugins.microbot.util.widget.Rs2Widget;

import java.awt.event.KeyEvent;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -101,11 +98,11 @@ public boolean run(AmmoniteCrabConfig config) {
break;
case HOP_WORLD:
int world = Login.getRandomWorld(true, null);
Microbot.hopToWorld(world);
if (!Microbot.hopToWorld(world)) {
Microbot.log("World hop to " + world + " refused, retrying next loop");
break;
}
timesHopped++;
boolean result = sleepUntil(() -> Rs2Widget.findWidget("Switch World") != null);
Rs2Keyboard.keyPress(KeyEvent.VK_SPACE);
sleepUntil(() -> Microbot.getClient().getGameState() == GameState.HOPPING);
sleepUntil(() -> Microbot.getClient().getGameState() == GameState.LOGGED_IN);
sleep(1200, 2000);
// After successful hop, reset counters and scan the area
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
)
@Slf4j
public class BanksShopperPlugin extends Plugin {
public final static String version = "1.4.2";
public final static String version = "1.4.3";
@Inject
private BanksShopperConfig config;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,9 @@ public boolean run(BanksShopperConfig config) {
state = ShopperState.SHOPPING;
break;
case HOPPING:
hopWorld();
state = ShopperState.SHOPPING;
if (hopWorld()) {
state = ShopperState.SHOPPING;
}
break;
}
} catch (Exception ex) {
Expand Down Expand Up @@ -298,13 +299,17 @@ private boolean ensureShopOpen() {
/**
* Hops to a new world
*/
private void hopWorld() {
private boolean hopWorld() {
System.out.println("Hopping worlds...");
Rs2Random.waitEx(3200, 800); // this sleep is required to avoid the message: please finish what you're doing before using the world switcher.

int world = plugin.isUseNextWorld() ? Login.getNextWorld(Rs2Player.isMember()) : Login.getRandomWorld(Rs2Player.isMember());
sleepUntil(() -> Microbot.hopToWorld(world), 15000);
if (!Microbot.hopToWorld(world)) {
System.out.println("World hop to " + world + " refused, retrying next loop");
return false;
}
System.out.println("Successfully hopped to world: " + world);
return true;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
)
public class BlueDragonsPlugin extends Plugin {

public static final String version = "1.2.0";
public static final String version = "1.2.1";
static final String CONFIG = "bluedragons";

@Inject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ private void handleBanking() {

private void handleTravelToDragons() {
if (isPlayerAtSafeSpot()) {
currentState = BlueDragonState.COMBAT;
if (hopIfPlayerAtSafeSpot()) {
currentState = BlueDragonState.COMBAT;
}
return;
}

Expand All @@ -199,8 +201,7 @@ private void handleTravelToDragons() {
sleepUntil(this::isPlayerAtSafeSpot, 10000);
}

if (isPlayerAtSafeSpot()) {
hopIfPlayerAtSafeSpot();
if (isPlayerAtSafeSpot() && hopIfPlayerAtSafeSpot()) {
currentState = BlueDragonState.COMBAT;
}
}
Expand Down Expand Up @@ -343,17 +344,23 @@ private boolean isPlayerAtSafeSpot() {
Microbot.getClient().getLocalPlayer().getWorldLocation()));
}

private void hopIfPlayerAtSafeSpot() {
private boolean hopIfPlayerAtSafeSpot() {
List<Player> players = Rs2Player.getPlayers(it -> it != null).collect(Collectors.toList());
boolean occupied = players.stream().anyMatch(p ->
p != null && !p.equals(Microbot.getClient().getLocalPlayer())
&& p.getWorldLocation().distanceTo(SAFE_SPOT) <= 1);

if (occupied) {
Microbot.log("Player at safe spot. Hopping worlds.");
Microbot.hopToWorld(findRandomWorld());
sleep(5000);
if (!occupied) {
return true;
}
Microbot.log("Player at safe spot. Hopping worlds.");
int world = findRandomWorld();
if (!Microbot.hopToWorld(world)) {
Microbot.log("World hop to " + world + " refused, retrying next loop");
return false;
}
sleep(5000);
return true;
}

private int findRandomWorld() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
)
@Slf4j
public class GiantMolePlugin extends Plugin {
public static final String version = "0.0.5";
public static final String version = "0.0.6";

@Inject
private GiantMoleConfig config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,11 @@ public static boolean isInMoleTunnel()
public void hopWorlds()
{
int randomWorld = Login.getRandomWorld(isMember());
Microbot.hopToWorld(randomWorld);
if (!Microbot.hopToWorld(randomWorld))
{
Microbot.log("World hop to " + randomWorld + " refused, retrying next loop");
return;
}
checkedIfWorldOccupied = false;
state = GiantMoleState.IDLE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
@Slf4j
public class HSBlackJackPlugin extends Plugin {

static final String version = "1.0.1";
static final String version = "1.0.2";

@Inject
private HSBlackJackConfig config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -685,10 +685,14 @@ private Rs2NpcModel findReachableTarget(String targetName) {
* Hops to a random world - used when the tent stays blocked too long, the
* bar's stock is too low, or a lure's NPC never makes it inside in time.
*/
private void hopWorld() {
private boolean hopWorld() {
sleep(600, 1000);
int world = Login.getRandomWorld(Rs2Player.isMember());
sleepUntil(() -> Microbot.hopToWorld(world), 15000);
if (Microbot.hopToWorld(world)) {
return true;
}
setState("World hop to " + world + " refused - retrying next loop");
return false;
}

/**
Expand Down Expand Up @@ -768,8 +772,9 @@ private void handleCheckTentOccupancy() {

if (allInTent.size() != 1 || targetsInTent.size() != 1) {
setState("Tent occupied by " + allInTent.size() + " NPC(s), not a clean single target - hopping world");
hopWorld();
phase = Phase.TRAVEL_TO_START;
if (hopWorld()) {
phase = Phase.TRAVEL_TO_START;
}
return;
}

Expand Down Expand Up @@ -1013,7 +1018,9 @@ private void handleCloseCurtain() {

if (waitedFor >= NPC_ENTER_TENT_TIMEOUT_MS) {
setState("NPC never entered tent (" + (waitedFor / 1000) + "s) - hopping world, restarting");
hopWorld();
if (!hopWorld()) {
return;
}
npcEnterTentWaitSince = -1;
luredNpc = null;
needsLureInsideTent = false;
Expand Down Expand Up @@ -1062,7 +1069,9 @@ private void handleKnockOut() {

if (blockedFor >= ROOM_BLOCKED_HOP_THRESHOLD_MS) {
setState("Tent occupied too long (" + (blockedFor / 1000) + "s) - hopping world");
hopWorld();
if (!hopWorld()) {
return;
}
roomBlockedSince = -1;
luredNpc = null;
phase = Phase.TRAVEL_TO_START;
Expand Down Expand Up @@ -1219,8 +1228,9 @@ private void handleRestockFlow() {
long stuckFor = System.currentTimeMillis() - restockCurtainStuckSince;
if (stuckFor >= CURTAIN_STUCK_TIMEOUT_MS) {
setState("Restock: stuck opening curtain for " + (stuckFor / 1000) + "s - hopping world");
hopWorld();
restockCurtainStuckSince = -1;
if (hopWorld()) {
restockCurtainStuckSince = -1;
}
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
@Slf4j
@PluginDependency(HunterPlugin.class)
public class AutoHunterPlugin extends Plugin {
public static final String version = "1.5.0";
public static final String version = "1.5.4";
@Inject
private AutoHunterConfig config;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@
import net.runelite.client.plugins.microbot.breakhandler.BreakHandlerScript;
import net.runelite.client.plugins.microbot.util.antiban.Rs2Antiban;
import net.runelite.client.plugins.microbot.util.antiban.enums.ActivityIntensity;
import net.runelite.client.plugins.microbot.util.bank.Rs2Bank;
import net.runelite.client.plugins.microbot.util.combat.Rs2Combat;
import net.runelite.client.plugins.microbot.util.dialogues.Rs2Dialogue;
import net.runelite.client.plugins.microbot.microhunter.AutoHunterConfig;
import net.runelite.client.plugins.microbot.util.menu.NewMenuEntry;
import net.runelite.client.plugins.microbot.util.inventory.Rs2Inventory;
import net.runelite.client.plugins.microbot.util.player.Rs2Player;
import net.runelite.client.plugins.microbot.util.player.Rs2PlayerModel;
import net.runelite.client.plugins.microbot.util.shop.Rs2Shop;
import net.runelite.client.plugins.microbot.util.tile.Rs2Tile;
import net.runelite.http.api.worlds.World;
import net.runelite.http.api.worlds.WorldRegion;
Expand Down Expand Up @@ -84,9 +88,13 @@ private enum Action {
private static final long OCCUPANCY_SCAN_MS = 7_000;
private static final long PLAYER_PERSISTENCE_MS = 3_500;
private static final long WORLD_HOP_TIMEOUT_MS = 15_000;
private static final long REFUSED_HOP_RETRY_MS = 3_000;
private static final int MAX_REFUSED_HOPS_PER_WORLD = 3;
private static final long LOCAL_HOP_BLOCK_LIMIT_MS = 180_000;
private static final long REJECTED_WORLD_COOLDOWN_MS = 600_000;
private static final long BREAK_RECOVERY_CLEAR_MS = 1_500;
private static final int MAX_WORLD_HOP_ATTEMPTS = 5;
private static final String HOP_BLOCKER_DIALOGUE = "dialogue open";
private static final EnumSet<WorldType> UNSAFE_WORLD_TYPES = EnumSet.of(
WorldType.PVP, WorldType.BOUNTY, WorldType.PVP_ARENA, WorldType.SKILL_TOTAL,
WorldType.QUEST_SPEEDRUNNING, WorldType.HIGH_RISK, WorldType.LAST_MAN_STANDING,
Expand Down Expand Up @@ -140,6 +148,10 @@ private enum Action {
private int hopTargetWorld = -1;
private int hopSourceWorld = -1;
private long hopStartedAt;
private boolean hopRefused;
private int hopRefusals;
private String hopBlocker;
private long hopBlockedSince;
private boolean breakRecoveryRequested;
private boolean breakRecoveryComplete;
private boolean breakRecoveryLockHeld;
Expand Down Expand Up @@ -196,6 +208,10 @@ private void resetSession() {
hopTargetWorld = -1;
hopSourceWorld = -1;
hopStartedAt = 0;
hopRefused = false;
hopRefusals = 0;
hopBlocker = null;
hopBlockedSince = 0;
breakRecoveryRequested = false;
breakRecoveryComplete = false;
breakRecoveryLockHeld = false;
Expand Down Expand Up @@ -307,6 +323,10 @@ private void beginWorldArrival(AutoHunterConfig config, int world) {
hopTargetWorld = -1;
hopSourceWorld = -1;
hopStartedAt = 0;
hopRefused = false;
hopRefusals = 0;
hopBlocker = null;
hopBlockedSince = 0;
nearbyPlayerSeenSince = 0;
if (!config.avoidOccupiedWorlds()) {
worldHopAttempts = 0;
Expand Down Expand Up @@ -426,14 +446,58 @@ private void requestAustralianWorldHop(String reason) {
stopSafely("No eligible Australian world is currently available");
return;
}
worldHopAttempts++;
hopSourceWorld = Microbot.getClient().getWorld();
hopTargetWorld = target;
hopStartedAt = System.currentTimeMillis();
hopRefusals = 0;
hopBlocker = null;
transition(State.HOPPING_WORLD, "Hopping to Australian world " + target + " (" + reason + ")");
Microbot.log("AutoHunter occupancy: hopping " + hopSourceWorld + " -> " + target
+ " attempt=" + worldHopAttempts);
Microbot.hopToWorld(target);
+ " attempt=" + (worldHopAttempts + 1));
issueWorldHop();
}

private void issueWorldHop() {
hopStartedAt = System.currentTimeMillis();
String blocker = localHopBlocker();
if (blocker == null) {
if (Microbot.hopToWorld(hopTargetWorld)) {
hopRefused = false;
hopBlocker = null;
hopBlockedSince = 0;
worldHopAttempts++;
return;
}
blocker = localHopBlocker();
}
hopRefused = true;
if (blocker != null) {
if (hopBlockedSince == 0) hopBlockedSince = hopStartedAt;
long blockedFor = hopStartedAt - hopBlockedSince;
if (blockedFor >= LOCAL_HOP_BLOCK_LIMIT_MS) {
stopSafely("World hop blocked locally for " + (blockedFor / 1_000) + "s: " + blocker);
return;
}
if (!blocker.equals(hopBlocker)) {
Microbot.log("AutoHunter occupancy: hop to world " + hopTargetWorld + " waiting (" + blocker + ")");
}
hopBlocker = blocker;
if (HOP_BLOCKER_DIALOGUE.equals(blocker)) Rs2Dialogue.clickContinue();
return;
}
hopBlocker = null;
hopBlockedSince = 0;
hopRefusals++;
Microbot.log("AutoHunter occupancy: hop to world " + hopTargetWorld + " refused ("
+ hopRefusals + "/" + MAX_REFUSED_HOPS_PER_WORLD + ")");
}

private String localHopBlocker() {
if (!Microbot.isLoggedIn()) return "not logged in";
if (Rs2Player.isInCombat() || Rs2Combat.inCombat()) return "in combat";
if (Rs2Bank.isOpen() || Rs2Shop.isOpen()) return "interface open";
if (Rs2Dialogue.isInDialogue()) return HOP_BLOCKER_DIALOGUE;
if (Rs2Player.isAnimating()) return "animating";
return null;
}

private Integer selectAustralianWorld() {
Expand All @@ -460,6 +524,19 @@ private Integer selectAustralianWorld() {
private void monitorWorldHop() {
int currentWorld = Microbot.getClient().getWorld();
if (hopSourceWorld > 0 && currentWorld != hopSourceWorld) return;
if (hopRefused) {
if (System.currentTimeMillis() - hopStartedAt < REFUSED_HOP_RETRY_MS) return;
if (hopRefusals < MAX_REFUSED_HOPS_PER_WORLD) {
issueWorldHop();
return;
}
worldHopAttempts++;
rejectedWorlds.put(hopTargetWorld, System.currentTimeMillis() + REJECTED_WORLD_COOLDOWN_MS);
Microbot.log("AutoHunter occupancy: giving up on world " + hopTargetWorld + " after "
+ hopRefusals + " refused hops");
requestAustralianWorldHop("previous hop refused");
return;
}
if (System.currentTimeMillis() - hopStartedAt < WORLD_HOP_TIMEOUT_MS) return;
if (hopTargetWorld > 0) {
rejectedWorlds.put(hopTargetWorld, System.currentTimeMillis() + REJECTED_WORLD_COOLDOWN_MS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
)
@Slf4j
public class MKE_WintertodtPlugin extends Plugin {
static final String version = "2.2.3";
static final String version = "2.2.4";

// Core plugin components
@Inject
Expand Down
Loading
Loading