Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/development' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
chsami committed Dec 27, 2024
2 parents 616fb5e + 117ae7c commit f847e24
Show file tree
Hide file tree
Showing 96 changed files with 5,619 additions and 1,508 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public interface BreakHandlerConfig extends Config {
@ConfigSection(
name = "Play Schedule",
description = "Options related to using a play schedule",
position = 5
position = 51
)
String usePlaySchedule = "usePlaySchedule";

Expand Down Expand Up @@ -57,11 +57,22 @@ default int breakDurationEnd() {
return 15;
}

// boolean to only use microbreaks
@ConfigItem(
keyName = "OnlyMicroBreaks",
name = "Micro Breaks Only",
description = "Only use micro breaks if enabled",
position = 4
)
default boolean onlyMicroBreaks() {
return false;
}

@ConfigItem(
keyName = "Logout",
name = "Logout",
description = "Logout when taking a break",
position = 4
position = 5
)
default boolean logoutAfterBreak() {
return true;
Expand All @@ -71,7 +82,7 @@ default boolean logoutAfterBreak() {
keyName = "useRandomWorld",
name = "Use RandomWorld",
description = "Change to a random world once break is finished",
position = 5
position = 6
)
default boolean useRandomWorld() {
return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.runelite.client.plugins.microbot.breakhandler;

import net.runelite.client.plugins.microbot.util.antiban.Rs2AntibanSettings;
import net.runelite.client.ui.overlay.OverlayPanel;
import net.runelite.client.ui.overlay.OverlayPosition;
import net.runelite.client.ui.overlay.components.LineComponent;
Expand Down Expand Up @@ -40,7 +41,7 @@ public Dimension render(Graphics2D graphics) {

if (BreakHandlerScript.breakIn > 0) {
panelComponent.getChildren().add(LineComponent.builder()
.left(BreakHandlerScript.formatDuration(BreakHandlerScript.breakInDuration, "Break in:"))
.left((Rs2AntibanSettings.takeMicroBreaks && config.onlyMicroBreaks()) ? "Only Micro Breaks" : BreakHandlerScript.formatDuration(BreakHandlerScript.breakInDuration, "Break in:"))
.build());
}
if (BreakHandlerScript.breakDuration > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import net.runelite.client.plugins.microbot.Microbot;
import net.runelite.client.plugins.microbot.Script;
import net.runelite.client.plugins.microbot.util.antiban.Rs2AntibanSettings;
import net.runelite.client.plugins.microbot.util.math.Random;
import net.runelite.client.plugins.microbot.util.math.Rs2Random;
import net.runelite.client.plugins.microbot.util.player.Rs2Player;
import net.runelite.client.plugins.microbot.util.security.Login;
import net.runelite.client.ui.ClientUI;
Expand Down Expand Up @@ -44,7 +44,7 @@ public boolean run(BreakHandlerConfig config) {

Microbot.enableAutoRunOn = false;
title = ClientUI.getFrame().getTitle();
breakIn = Random.random(config.timeUntilBreakStart() * 60, config.timeUntilBreakEnd() * 60);
breakIn = Rs2Random.between(config.timeUntilBreakStart() * 60, config.timeUntilBreakEnd() * 60);
mainScheduledFuture = scheduledExecutorService.scheduleWithFixedDelay(() -> {
try {

Expand All @@ -55,7 +55,9 @@ public boolean run(BreakHandlerConfig config) {
}

if (breakIn > 0 && breakDuration <= 0) {
breakIn--;
if(!(Rs2AntibanSettings.takeMicroBreaks && config.onlyMicroBreaks()))
breakIn--;

duration = Duration.between(LocalDateTime.now(), LocalDateTime.now().plusSeconds(breakIn));
breakInDuration = duration;
}
Expand All @@ -80,7 +82,7 @@ public boolean run(BreakHandlerConfig config) {
return;
Microbot.pauseAllScripts = false;
if (breakIn <= 0)
breakIn = Random.random(config.timeUntilBreakStart() * 60, config.timeUntilBreakEnd() * 60);
breakIn = Rs2Random.between(config.timeUntilBreakStart() * 60, config.timeUntilBreakEnd() * 60);

if (config.useRandomWorld()) {
new Login(Login.getRandomWorld(Login.activeProfile.isMember()));
Expand All @@ -106,7 +108,7 @@ public boolean run(BreakHandlerConfig config) {
}


breakDuration = Random.random(config.breakDurationStart() * 60, config.breakDurationEnd() * 60);
breakDuration = Rs2Random.between(config.breakDurationStart() * 60, config.breakDurationEnd() * 60);

if (config.logoutAfterBreak()) {
Rs2Player.logout();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,32 @@ public boolean run(GrapeFarmerConfig config) {
if (!Rs2Inventory.contains(ItemID.GARDENING_TROWEL)) {
Rs2Bank.useBank();
Rs2Bank.depositAll();
if (Rs2Bank.hasItem(ItemID.FARMING_CAPE) || Rs2Bank.hasItem(ItemID.FARMING_CAPET)) {
Rs2Bank.withdrawAndEquip(Rs2Bank.hasItem(ItemID.FARMING_CAPE) ? ItemID.FARMING_CAPE : ItemID.FARMING_CAPET);
}
if (Rs2Bank.hasItem(ItemID.MAGIC_SECATEURS)) {
Rs2Bank.withdrawAndEquip(ItemID.MAGIC_SECATEURS);
}
Rs2Bank.withdrawAllButOne(ItemID.GRAPE_SEED);
Rs2Bank.withdrawOne(ItemID.GARDENING_TROWEL);
Rs2Bank.withdrawOne(ItemID.SEED_DIBBER);
Rs2Bank.withdrawOne(ItemID.SPADE);
Rs2Bank.withdrawAllButOne(ItemID.BOLOGAS_BLESSING);
Rs2Bank.withdrawX(ItemID.SALTPETRE, 12);
if (config.FARMING_OUTFIT()) {
Rs2Bank.depositEquipment();
Rs2Bank.withdrawAndEquip(ItemID.FARMERS_STRAWHAT_13647);
Rs2Bank.withdrawAndEquip(ItemID.FARMERS_SHIRT);
Rs2Bank.withdrawAndEquip(ItemID.FARMERS_BORO_TROUSERS_13641);
Rs2Bank.withdrawAndEquip(ItemID.FARMERS_BOOTS_13645);
}
Rs2Bank.closeBank();
sleep(300);
}
if (Rs2Inventory.contains(ItemID.GARDENING_TROWEL) && Rs2Inventory.count(ItemID.SALTPETRE) < 12) {
if (Rs2Inventory.contains(ItemID.GARDENING_TROWEL) && Rs2Inventory.count(ItemID.SALTPETRE) < 1) {
Rs2Bank.useBank();
Rs2Bank.depositAll(ItemID.ZAMORAKS_GRAPES);
Rs2Bank.depositAll(ItemID.GRAPES);
Rs2Bank.withdrawX(ItemID.SALTPETRE, 12);
Rs2Bank.closeBank();
}
Expand Down Expand Up @@ -179,6 +188,7 @@ private void pickGrapes(int gameObjectId) {
Rs2Inventory.use(ItemID.GRAPES);
Rs2Npc.interact(0);
sleepUntil(() -> !Rs2Inventory.contains(ItemID.GRAPES), 5000);
sleep(50, 500);
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package net.runelite.client.plugins.microbot.holidayevent;

import net.runelite.api.events.GameTick;
import net.runelite.client.plugins.microbot.Microbot;
import net.runelite.client.plugins.microbot.util.gameobject.Rs2GameObject;
import net.runelite.client.plugins.microbot.util.math.Rs2Random;
import net.runelite.client.plugins.microbot.util.player.Rs2Player;

public class CollectSnow {
private static long randomDelay;

public static boolean nearTheSnow() {
return Rs2GameObject.findObjectByIdAndDistance(19035, 1) != null;
}

public static void onGameTick(GameTick event) {
if (Rs2Player.checkIdleLogout(randomDelay)) {
randomDelay = Rs2Random.between(1000,3000);
if (Rs2GameObject.getGameObjects(19035) != null
&& nearTheSnow()) {
Rs2GameObject.interact(19035, "Take");
Microbot.log("Done tooken snow cus about to log");
} else {
Microbot.log("Restart plugin 1 tile to snow");}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,15 @@ default boolean showCutscenePopup() {
return true; // Default to true
}

@ConfigItem(
keyName = "collectSnow",
name = "Collect Snow",
description = "Only use if 1 tile next to snow. Will interact with snow on the client thread when near logout."
)
default boolean collectSnow() {
return true; // Default to true
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,21 @@
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.ChatMessageType;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.GameTick;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.microbot.Microbot;
import net.runelite.client.ui.overlay.OverlayManager;

import javax.inject.Inject;
import java.awt.*;

@PluginDescriptor(
name = PluginDescriptor.Default + "Holiday events",
name = PluginDescriptor.Default + "Holiday event",
description = "Holiday event plugin",
tags = {"holiday", "microbot"},
tags = {"holiday event", "microbot", "christmas"},
enabledByDefault = false
)

Expand Down Expand Up @@ -67,9 +65,12 @@ protected void shutDown() {

int ticks = 10;
@Subscribe
public void onGameTick(GameTick tick)
public void onGameTick(GameTick event)
{
//System.out.println(getName().chars().mapToObj(i -> (char)(i + 3)).map(String::valueOf).collect(Collectors.joining()));

if (config.collectSnow()) {
CollectSnow.onGameTick(event);
}

if (ticks > 0) {
ticks--;
Expand Down
Loading

0 comments on commit f847e24

Please sign in to comment.