Skip to content

Commit

Permalink
Merge pull request #602 from g-mason0/development
Browse files Browse the repository at this point in the history
Rs2Magic Fix & Various Plugin Updates
  • Loading branch information
chsami authored Dec 31, 2024
2 parents 4cdee56 + 1e56cf3 commit f9a992a
Show file tree
Hide file tree
Showing 20 changed files with 658 additions and 174 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,20 @@ public void onConfigChanged(ConfigChanged ev) {
@Subscribe
public void onGameTick(GameTick event) {
if (client.getLocalPlayer().isInteracting()) {
if (client.getLocalPlayer().getInteracting() instanceof Player
|| client.getLocalPlayer().getInteracting() instanceof NPC) {
Actor interactingActor = client.getLocalPlayer().getInteracting();
if (interactingActor instanceof Player) {
if (ticks.get() == 2) {
ticks.set(0);
Rs2Player.updateCombatTime();
Rs2Player.lastInteractWasPlayer = true;
} else {
ticks.incrementAndGet();
}
} else if (interactingActor instanceof NPC) {
if (ticks.get() == 2) {
ticks.set(0);
if (Rs2Player.lastInteractWasPlayer) Rs2Player.lastInteractWasPlayer = false;
Rs2Player.updateCombatTime();
} else {
ticks.incrementAndGet();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public boolean run() {
Rs2Dialogue.clickCombinationOption(plugin.getJewelry().getGem().getUncutItemName());
sleepUntil(Rs2Player::isAnimating);
Rs2Antiban.actionCooldown();
Rs2Antiban.takeMicroBreakByChance();
Rs2Bank.preHover();
break;
case BANKING:
Expand Down Expand Up @@ -319,6 +320,7 @@ public boolean run() {
sleepUntilTrue(() -> Rs2Widget.isGoldCraftingWidgetOpen() || Rs2Widget.isSilverCraftingWidgetOpen(), 500, 20000);
Rs2Widget.clickWidget(plugin.getJewelry().getItemName());
Rs2Antiban.actionCooldown();
Rs2Antiban.takeMicroBreakByChance();
break;
case ALCHING:
if (!Rs2Equipment.hasEquipped(staffItemID)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void run(CraftingConfig config) {
if (!Microbot.isLoggedIn()) return;
if (!super.run()) return;

if (Rs2Player.isAnimating(2400) || Rs2Antiban.getCategory().isBusy() || Microbot.pauseAllScripts) return;
if (Rs2Player.isAnimating(3000) || Rs2Antiban.getCategory().isBusy() || Microbot.pauseAllScripts) return;
if (Rs2AntibanSettings.actionCooldownActive) return;

if (config.glassType() == Glass.PROGRESSIVE) {
Expand Down Expand Up @@ -101,8 +101,7 @@ private void craft(CraftingConfig config) {

Rs2Widget.sleepUntilHasNotWidgetText("How many do you wish to make?", 270, 5, false, 5000);
Rs2Antiban.actionCooldown();

sleepUntil(() -> !Rs2Inventory.hasItem(moltenGlass), 60000);
Rs2Antiban.takeMicroBreakByChance();
}

public ProgressiveGlassblowingModel calculateItemToCraft() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,19 +117,22 @@ public void selectMould() {
Microbot.getMouse().click(forte.getBounds());
sleep(600, 1200);
MouldHelper.selectBest();
sleep(600, 1200);
}

Widget blades = Rs2Widget.findWidget("Blades", null);
if (blades != null) {
Microbot.getMouse().click(blades.getBounds());
sleep(600, 1200);
MouldHelper.selectBest();
sleep(600, 1200);
}
Widget tips = Rs2Widget.findWidget("Tips", null);
if (tips != null) {
Microbot.getMouse().click(tips.getBounds());
sleep(600, 1200);
MouldHelper.selectBest();
sleep(600, 1200);
Microbot.getMouse().click(forte.getBounds());
}
Widget setMould = Rs2Widget.getWidget(47054854);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
import net.runelite.client.config.ConfigSection;
import net.runelite.client.plugins.microbot.magic.aiomagic.enums.MagicActivity;
import net.runelite.client.plugins.microbot.magic.aiomagic.enums.SuperHeatItem;
import net.runelite.client.plugins.microbot.magic.aiomagic.enums.TeleportSpell;
import net.runelite.client.plugins.microbot.util.magic.Rs2CombatSpells;
import net.runelite.client.plugins.microbot.util.magic.Rs2Spells;
import net.runelite.client.plugins.microbot.util.magic.Rs2Staff;

@ConfigGroup(AIOMagicConfig.configGroup)
public interface AIOMagicConfig extends Config {
Expand All @@ -16,6 +19,9 @@ public interface AIOMagicConfig extends Config {
String alchItems = "alchItems";
String superHeatItem = "superHeatItem";
String npcName = "npcName";
String staff = "staff";
String teleportSpell = "teleportSpell";
String castAmount = "castAmount";

@ConfigSection(
name = "General Settings",
Expand Down Expand Up @@ -45,6 +51,13 @@ public interface AIOMagicConfig extends Config {
)
String superHeatSection = "superHeat";

@ConfigSection(
name = "Teleport Settings",
description = "Configure teleport settings",
position = 3
)
String teleportSection = "teleport";

@ConfigItem(
keyName = activity,
name = "Activity",
Expand Down Expand Up @@ -99,4 +112,37 @@ default String alchItems() {
default SuperHeatItem superHeatItem() {
return SuperHeatItem.IRON;
}

@ConfigItem(
keyName = teleportSpell,
name = "Teleport Spell",
description = "Select the teleport spell you would like to use",
position = 0,
section = teleportSection
)
default TeleportSpell teleportSpell() {
return TeleportSpell.VARROCK_TELEPORT;
}

@ConfigItem(
keyName = staff,
name = "Staff",
description = "Select the staff you would like to use",
position = 1,
section = teleportSection
)
default Rs2Staff staff() {
return Rs2Staff.STAFF_OF_AIR;
}

@ConfigItem(
keyName = castAmount,
name = "Total amount of casts",
description = "Define the amount of teleport casts",
position = 2,
section = teleportSection
)
default int castAmount() {
return 1000;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
import net.runelite.client.plugins.microbot.Microbot;
import net.runelite.client.plugins.microbot.magic.aiomagic.enums.MagicActivity;
import net.runelite.client.plugins.microbot.magic.aiomagic.enums.SuperHeatItem;
import net.runelite.client.plugins.microbot.magic.aiomagic.scripts.AlchScript;
import net.runelite.client.plugins.microbot.magic.aiomagic.scripts.SplashScript;
import net.runelite.client.plugins.microbot.magic.aiomagic.scripts.SuperHeatScript;
import net.runelite.client.plugins.microbot.magic.aiomagic.enums.TeleportSpell;
import net.runelite.client.plugins.microbot.magic.aiomagic.scripts.*;
import net.runelite.client.plugins.microbot.util.magic.Rs2CombatSpells;
import net.runelite.client.plugins.microbot.util.magic.Rs2Staff;
import net.runelite.client.ui.overlay.OverlayManager;

import javax.inject.Inject;
Expand Down Expand Up @@ -53,6 +53,10 @@ AIOMagicConfig provideConfig(ConfigManager configManager) {
private AlchScript alchScript;
@Inject
private SuperHeatScript superHeatScript;
@Inject
private TeleportScript teleportScript;
@Inject
private TeleAlchScript teleAlchScript;

public static String version = "1.0.0";

Expand All @@ -64,13 +68,22 @@ AIOMagicConfig provideConfig(ConfigManager configManager) {
private SuperHeatItem superHeatItem;
@Getter
private String npcName;
@Getter
private TeleportSpell teleportSpell;
@Getter
private Rs2Staff staff;
@Getter
private int totalCasts;

@Override
protected void startUp() throws AWTException {
combatSpell = config.combatSpell();
alchItemNames = updateItemList(config.alchItems());
superHeatItem = config.superHeatItem();
npcName = config.npcName();
teleportSpell = config.teleportSpell();
staff = config.staff();
totalCasts = config.castAmount();

if (overlayManager != null) {
overlayManager.add(aioMagicOverlay);
Expand All @@ -86,13 +99,21 @@ protected void startUp() throws AWTException {
case SUPERHEAT:
superHeatScript.run();
break;
case TELEPORT:
teleportScript.run();
break;
case TELEALCH:
teleAlchScript.run();
break;
}
}

protected void shutDown() {
splashScript.shutdown();
alchScript.shutdown();
superHeatScript.shutdown();
teleportScript.shutdown();
teleAlchScript.shutdown();
overlayManager.remove(aioMagicOverlay);
}

Expand All @@ -114,6 +135,18 @@ public void onConfigChanged(ConfigChanged event) {
if (event.getKey().equals(AIOMagicConfig.npcName)) {
npcName = config.npcName();
}

if (event.getKey().equals(AIOMagicConfig.teleportSpell)) {
teleportSpell = config.teleportSpell();
}

if (event.getKey().equals(AIOMagicConfig.staff)) {
staff = config.staff();
}

if (event.getKey().equals(AIOMagicConfig.castAmount)) {
totalCasts = config.castAmount();
}
}

@Subscribe
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ public enum MagicActivity {
SPLASHING,
ALCHING,
SUPERHEAT,
TELEPORT,
TELEALCH,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package net.runelite.client.plugins.microbot.magic.aiomagic.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;
import net.runelite.client.plugins.microbot.util.magic.Rs2Spells;

@Getter
@RequiredArgsConstructor
public enum TeleportSpell {
VARROCK_TELEPORT(Rs2Spells.VARROCK_TELEPORT),
LUMBRIDGE_TELEPORT(Rs2Spells.LUMBRIDGE_TELEPORT),
FALADOR_TELEPORT(Rs2Spells.FALADOR_TELEPORT),
CAMELOT_TELEPORT(Rs2Spells.CAMELOT_TELEPORT),
ARDOUGNE_TELEPORT(Rs2Spells.ARDOUGNE_TELEPORT),
WATCHTOWER_TELEPORT(Rs2Spells.WATCHTOWER_TELEPORT),
TROLLHEIM_TELEPORT(Rs2Spells.TROLLHEIM_TELEPORT),;

private final Rs2Spells rs2Spell;
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ public boolean run() {
}

Rs2Bank.setWithdrawAsNote();
for (String item : plugin.getAlchItemNames()) {
plugin.getAlchItemNames().forEach((itemName) -> {
if (!isRunning()) return;
Rs2Bank.withdrawAll(item);
Rs2Random.waitEx(600, 100);
}
Rs2Bank.withdrawAll(itemName);
Rs2Inventory.waitForInventoryChanges(1200);
});
Rs2Bank.setWithdrawAsItem();

Rs2Bank.closeBank();
Expand All @@ -135,7 +135,7 @@ public boolean run() {
return;
}

Rs2Magic.alch(plugin.getAlchItemNames().get(0));
Rs2Magic.alch(alchItem);
Rs2Player.waitForXpDrop(Skill.MAGIC, 10000, false);
break;
}
Expand Down
Loading

0 comments on commit f9a992a

Please sign in to comment.