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
Gage307 committed Jan 26, 2025
2 parents d20d0de + 93ff23e commit 2ea7ad9
Show file tree
Hide file tree
Showing 24 changed files with 253 additions and 336 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.9"
automatic_release_tag: "1.7.0"
prerelease: false
title: "Release 1.6.9"
title: "Release 1.7.0"
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.9</microbot.version>
<microbot.version>1.7.0</microbot.version>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package net.runelite.client.plugins.microbot;

public interface BlockingEvent {
boolean validate();
boolean execute();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package net.runelite.client.plugins.microbot;

import lombok.Getter;
import net.runelite.client.plugins.microbot.util.events.DisableLevelUpInterfaceEvent;
import net.runelite.client.plugins.microbot.util.events.WelcomeScreenEvent;

import java.util.ArrayList;
import java.util.List;

@Getter
public class BlockingEventManager {
private final List<BlockingEvent> blockingEvents = new ArrayList<>();

public BlockingEventManager() {
blockingEvents.add(new WelcomeScreenEvent());
blockingEvents.add(new DisableLevelUpInterfaceEvent());
}

public void remove(BlockingEvent blockingEvent) {
blockingEvents.remove(blockingEvent);
}

public void add(BlockingEvent blockingEvent) {
blockingEvents.add(blockingEvent);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ public class Microbot {
public static boolean cantHopWorld = false;

public static int cantReachTargetRetries = 0;

@Getter
public static final BlockingEventManager blockingEventManager = new BlockingEventManager();

@Getter
public static HashMap<String, Integer> scriptRuntimes = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,16 @@
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.WidgetLoaded;
import net.runelite.api.widgets.InterfaceID;
import net.runelite.api.widgets.Widget;
import net.runelite.client.plugins.microbot.globval.enums.InterfaceTab;
import net.runelite.client.plugins.microbot.shortestpath.ShortestPathPlugin;
import net.runelite.client.plugins.microbot.util.Global;
import net.runelite.client.plugins.microbot.util.inventory.Rs2Inventory;
import net.runelite.client.plugins.microbot.util.keyboard.Rs2Keyboard;
import net.runelite.client.plugins.microbot.util.player.Rs2Player;
import net.runelite.client.plugins.microbot.util.settings.Rs2Settings;
import net.runelite.client.plugins.microbot.util.tabs.Rs2Tab;
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.time.Duration;
import java.time.LocalTime;
import java.util.concurrent.Executors;
Expand All @@ -45,10 +42,6 @@ public boolean isRunning() {

public LocalTime startTime;

public Script() {

}

/**
* Get the total runtime of the script
* @return
Expand Down Expand Up @@ -178,32 +171,21 @@ public boolean run() {
return false;

if (Microbot.isLoggedIn()) {

boolean hasRunEnergy = Microbot.getClient().getEnergy() > Microbot.runEnergyThreshold;

if (Microbot.enableAutoRunOn && hasRunEnergy)
Rs2Player.toggleRunEnergy(true);

if (Rs2Widget.getWidget(15269889) != null) { //levelup congratulations interface
Rs2Keyboard.keyPress(KeyEvent.VK_SPACE);
}
Widget clickHereToPlayButton = Rs2Widget.getWidget(24772680); // on login screen

if (clickHereToPlayButton != null && !Microbot.getClientThread().runOnClientThread(clickHereToPlayButton::isHidden)) {
// Runs a synchronized block to prevent multiple plugins from clicking the play button
synchronized (Rs2Widget.class) {
if (!Microbot.getClientThread().runOnClientThread(clickHereToPlayButton::isHidden)) {
Rs2Widget.clickWidget(clickHereToPlayButton.getId());

sleepUntil(() -> Microbot.getClientThread().runOnClientThread(clickHereToPlayButton::isHidden), 10000);
synchronized (BlockingEventManager.class) {
if (!Microbot.getBlockingEventManager().getBlockingEvents().isEmpty()) {
for (BlockingEvent blockingEvent : Microbot.getBlockingEventManager().getBlockingEvents()) {
if (blockingEvent.validate()) {
blockingEvent.execute();
return false;
}
}
}
}

if (Rs2Settings.isLevelUpNotificationsEnabled()) {
Rs2Settings.disableLevelUpInterface();
}

boolean hasRunEnergy = Microbot.getClient().getEnergy() > Microbot.runEnergyThreshold;
if (Microbot.enableAutoRunOn && hasRunEnergy)
Rs2Player.toggleRunEnergy(true);

if (!hasRunEnergy && Microbot.useStaminaPotsIfNeeded && Rs2Player.isMoving()) {
Rs2Inventory.useRestoreEnergyItem();
Expand All @@ -212,7 +194,8 @@ public boolean run() {

return true;
}


@Deprecated(since = "1.6.9 - Use Rs2Keyboard.keyPress", forRemoval = true)
public void keyPress(char c) {
Rs2Keyboard.keyPress(c);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,14 @@
import net.runelite.client.plugins.microbot.util.inventory.InteractOrder;

@ConfigGroup("BankStander")
@ConfigInformation("• Code update by eXioStorm. commit #84316ee <br />" +
"• Last commit prior to update : #1bcb195 <br />" )
@ConfigInformation("This Script will perform bank standing activities. <br /> "
+ "<ul>" +
"<li>Crafting</li>" +
"<li>Herblore</li>" +
"<li>Fletching</li>" +
"<li>Cooking<li>" +
"</ul>")
public interface BanksBankStanderConfig extends Config {
@ConfigItem(
keyName = "Instructions",
name = "Instructions",
description = "Instructions",
position = 0
)
default String basicInstructions() {
return "This Script will combine items for you" +
"\n If using a Knife etc. make sure qty is set to 1. and use Item Slot 1." +
"\nChisel Item ID = 1755" +
"\nKnife Item ID = 946" +
"\nGlassblowing Pipe Item ID = 1785" +
"\nFor Bug reports & Future updates, my discord is Bank.js" +
"\nor find me in the Microbot discord.";
}
@ConfigSection(
name = "Item Settings",
description = "Set Items to Combine",
Expand Down Expand Up @@ -213,16 +203,6 @@ default boolean waitForAnimation() {
default boolean depositAll() {
return false;
}
@ConfigItem(
keyName = "withdrawAll",
name = "withdraw all",
description = "for using things like a chisel or knife where the item is not consumed in the process.",
position = 7,
section = toggles
)
default boolean withdrawAll() {
return false;
}
@ConfigItem(
keyName = "Interaction Option",
name = "Interaction Option",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,7 @@ public Dimension render(Graphics2D graphics) {
.left("Items processed : " + BanksBankStanderScript.itemsProcessed)
.leftColor(Color.GREEN)
.build());
panelComponent.getChildren().add(LineComponent.builder()
.left("Item 1 : " + BanksBankStanderScript.firstIdentity+", Quantity : "+BanksBankStanderScript.firstItemSum)
.leftColor(Color.GREEN)
.build());
if(config.secondItemQuantity() > 0 && !config.secondItemIdentifier().isEmpty()) {
panelComponent.getChildren().add(LineComponent.builder()
.left("Item 2 : " + BanksBankStanderScript.secondIdentity + ", Quantity : " + BanksBankStanderScript.secondItemSum)
.leftColor(Color.GREEN)
.build());
}
if(config.thirdItemQuantity() > 0 && !config.thirdItemIdentifier().isEmpty()) {
panelComponent.getChildren().add(LineComponent.builder()
.left("Item 3 : " + BanksBankStanderScript.thirdIdentity+", Quantity : "+BanksBankStanderScript.thirdItemSum)
.leftColor(Color.GREEN)
.build());
}
if(config.fourthItemQuantity() > 0 && !config.fourthItemIdentifier().isEmpty()) {
panelComponent.getChildren().add(LineComponent.builder()
.left("Item 4 : " + BanksBankStanderScript.fourthIdentity+", Quantity : "+BanksBankStanderScript.fourthItemSum)
.leftColor(Color.GREEN)
.build());
}//*/ Added by Storm

panelComponent.getChildren().add(LineComponent.builder().build());

panelComponent.getChildren().add(LineComponent.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import com.google.inject.Provides;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.GameState;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.ItemContainerChanged;
import net.runelite.api.events.WidgetLoaded;
import net.runelite.client.config.ConfigManager;
Expand Down Expand Up @@ -55,52 +53,9 @@ protected void startUp() throws AWTException {
@Subscribe
public void onItemContainerChanged(ItemContainerChanged inventory){
if(inventory.getContainerId()==93){
if(BanksBankStanderScript.currentStatus == CurrentStatus.COMBINE_ITEMS) {
if (BanksBankStanderScript.firstItemId != null) {
if (Rs2Inventory.items().stream().filter(item -> item.id == BanksBankStanderScript.firstItemId).mapToInt(item -> item.quantity).sum() < config.firstItemQuantity()) {
if (BanksBankStanderScript.firstItemSum > 0) { BanksBankStanderScript.firstItemSum--; }
BanksBankStanderScript.itemsProcessed++;
}
} else {
if (Rs2Inventory.count(config.firstItemIdentifier()) < config.firstItemQuantity()) {
if (BanksBankStanderScript.firstItemSum > 0) { BanksBankStanderScript.firstItemSum--; }
BanksBankStanderScript.itemsProcessed++;
}
}
if(config.secondItemQuantity() > 0) {
if (BanksBankStanderScript.secondItemId != null) {
if (Rs2Inventory.items().stream().filter(item -> item.id == BanksBankStanderScript.secondItemId).mapToInt(item -> item.quantity).sum() < config.secondItemQuantity()) {
if (BanksBankStanderScript.secondItemSum > 0) { BanksBankStanderScript.secondItemSum--; }
}
} else {
if (Rs2Inventory.count(config.secondItemIdentifier()) < config.secondItemQuantity()) {
if (BanksBankStanderScript.secondItemSum > 0) { BanksBankStanderScript.secondItemSum--; }
}
}
}
if(config.thirdItemQuantity() > 0) {
if (BanksBankStanderScript.thirdItemId != null) {
if (Rs2Inventory.items().stream().filter(item -> item.id == BanksBankStanderScript.thirdItemId).mapToInt(item -> item.quantity).sum() < config.thirdItemQuantity()) {
if (BanksBankStanderScript.thirdItemSum > 0) { BanksBankStanderScript.thirdItemSum--; }
}
} else {
if (Rs2Inventory.count(config.thirdItemIdentifier()) < config.thirdItemQuantity()) {
if (BanksBankStanderScript.thirdItemSum > 0) { BanksBankStanderScript.thirdItemSum--; }
}
}
}
if(config.fourthItemQuantity() > 0) {
if (BanksBankStanderScript.fourthItemId != null) {
if (Rs2Inventory.items().stream().filter(item -> item.id == BanksBankStanderScript.fourthItemId).mapToInt(item -> item.quantity).sum() < config.fourthItemQuantity()) {
if (BanksBankStanderScript.fourthItemSum > 0) { BanksBankStanderScript.fourthItemSum--; }
}
} else {
if (Rs2Inventory.count(config.fourthItemIdentifier()) < config.fourthItemQuantity()) {
if (BanksBankStanderScript.fourthItemSum > 0) { BanksBankStanderScript.fourthItemSum--; }
}
}
}
} else { System.out.println("currentStatus : " + BanksBankStanderScript.currentStatus); }
if (!Rs2Bank.isOpen()) {
BanksBankStanderScript.itemsProcessed++;
}
if (BanksBankStanderScript.secondItemId != null) { // Use secondItemId if it's available
if (Arrays.stream(inventory.getItemContainer().getItems())
.anyMatch(x -> x.getId() == BanksBankStanderScript.secondItemId)) {
Expand All @@ -120,7 +75,6 @@ public void onItemContainerChanged(ItemContainerChanged inventory){
BanksBankStanderScript.previousItemChange = (System.currentTimeMillis() - 2500);
}
}

}
}
@Subscribe
Expand Down
Loading

0 comments on commit 2ea7ad9

Please sign in to comment.