Compare commits
5 Commits
6ad5bc0465
...
7bdb37e031
Author | SHA1 | Date | |
---|---|---|---|
7bdb37e031
|
|||
2e9808c32c
|
|||
9ec09e42d5
|
|||
01a71ba399
|
|||
08dde87681
|
@ -24,7 +24,7 @@
|
||||
*/
|
||||
|
||||
object ProjectVersions {
|
||||
const val openosrsVersion = "4.17.0"
|
||||
const val openosrsVersion = "4.19.0"
|
||||
const val apiVersion = "^1.0.0"
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,10 @@ package io.reisub.openosrs.consume;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
import net.runelite.client.config.ConfigSection;
|
||||
import net.runelite.client.config.Keybind;
|
||||
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
@ConfigGroup("chaosconsume")
|
||||
|
||||
@ -223,7 +227,7 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
unhide = "drinkStrength"
|
||||
)
|
||||
default int strengthLevel() {
|
||||
return 100;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
@ -260,7 +264,7 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
unhide = "drinkAttack"
|
||||
)
|
||||
default int attackLevel() {
|
||||
return 100;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
@ -297,7 +301,7 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
unhide = "drinkDefence"
|
||||
)
|
||||
default int defenceLevel() {
|
||||
return 100;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
@ -334,7 +338,7 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
unhide = "drinkRanged"
|
||||
)
|
||||
default int rangedLevel() {
|
||||
return 100;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
@ -371,7 +375,7 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
unhide = "drinkMagic"
|
||||
)
|
||||
default int magicLevel() {
|
||||
return 100;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
@ -426,5 +430,29 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
)
|
||||
default int specialCost() { return 100; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "pkTeleport",
|
||||
name = "PK teleport hotkey",
|
||||
description = "Pressing the hotkey will toggle watching for skulled players or players attacking you and try to teleport away. Requires an equipped charged amulet of glory.",
|
||||
position = 50
|
||||
)
|
||||
default Keybind pkTeleport() {
|
||||
return new Keybind(KeyEvent.VK_F1, InputEvent.CTRL_DOWN_MASK);
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "tpOnDangerousPlayer",
|
||||
name = "TP on dangerous player",
|
||||
description = "Attempt to teleport when a skulled player within level range appears.",
|
||||
position = 51
|
||||
)
|
||||
default boolean tpOnDangerousPlayer() { return true; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "tpOnPlayerAttack",
|
||||
name = "TP on player attack",
|
||||
description = "Attempt to teleport when we're being attacked by a player.",
|
||||
position = 52
|
||||
)
|
||||
default boolean tpOnPlayerAttack() { return true; }
|
||||
}
|
@ -11,21 +11,28 @@ import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.input.KeyListener;
|
||||
import net.runelite.client.input.KeyManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDependency;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.iutils.game.EquipmentItem;
|
||||
import net.runelite.client.plugins.iutils.game.Game;
|
||||
import net.runelite.client.plugins.iutils.game.InventoryItem;
|
||||
import net.runelite.client.plugins.iutils.game.iWidget;
|
||||
import net.runelite.client.plugins.iutils.iUtils;
|
||||
import net.runelite.client.plugins.iutils.ui.Bank;
|
||||
import net.runelite.client.plugins.iutils.ui.Equipment;
|
||||
import org.pf4j.Extension;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@Extension
|
||||
@PluginDependency(Util.class)
|
||||
@ -36,7 +43,7 @@ import java.util.concurrent.TimeUnit;
|
||||
enabledByDefault = false
|
||||
)
|
||||
@Slf4j
|
||||
public class Consume extends Plugin {
|
||||
public class Consume extends Plugin implements KeyListener {
|
||||
@SuppressWarnings("unused")
|
||||
@Inject
|
||||
private Game game;
|
||||
@ -45,6 +52,9 @@ public class Consume extends Plugin {
|
||||
@Inject
|
||||
private Config config;
|
||||
|
||||
@Inject
|
||||
private KeyManager keyManager;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Inject
|
||||
private Calculations calc;
|
||||
@ -52,6 +62,9 @@ public class Consume extends Plugin {
|
||||
@Inject
|
||||
private Bank bank;
|
||||
|
||||
@Inject
|
||||
private Equipment equipment;
|
||||
|
||||
private final Set<Integer> IGNORE_FOOD = Set.of(ItemID.DWARVEN_ROCK_CAKE, ItemID.DWARVEN_ROCK_CAKE_7510);
|
||||
private final Set<Integer> DRINK_SET = Set.of(ItemID.JUG_OF_WINE, ItemID.SARADOMIN_BREW1, ItemID.SARADOMIN_BREW2, ItemID.SARADOMIN_BREW3, ItemID.SARADOMIN_BREW4, ItemID.XERICS_AID_1, ItemID.XERICS_AID_2, ItemID.XERICS_AID_3, ItemID.XERICS_AID_4, ItemID.XERICS_AID_1_20977, ItemID.XERICS_AID_2_20978, ItemID.XERICS_AID_3_20979, ItemID.XERICS_AID_4_20980, ItemID.XERICS_AID_1_20981, ItemID.XERICS_AID_2_20982, ItemID.XERICS_AID_3_20983, ItemID.XERICS_AID_4_20984, ItemID.BANDAGES);
|
||||
private final Set<Integer> ANTI_POISON_IDS = Set.of(ItemID.ANTIPOISON1, ItemID.ANTIPOISON2, ItemID.ANTIPOISON3, ItemID.ANTIPOISON4, ItemID.SUPERANTIPOISON1, ItemID.SUPERANTIPOISON2, ItemID.SUPERANTIPOISON3, ItemID.SUPERANTIPOISON4,
|
||||
@ -113,6 +126,7 @@ public class Consume extends Plugin {
|
||||
private boolean shouldDrinkMagic;
|
||||
private long lastMagic;
|
||||
private boolean shouldUseSpecial;
|
||||
private boolean pkTeleport;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Provides
|
||||
@ -128,6 +142,7 @@ public class Consume extends Plugin {
|
||||
generateNewPrayerThreshold();
|
||||
|
||||
executor = Executors.newSingleThreadScheduledExecutor();
|
||||
keyManager.registerKeyListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -135,6 +150,7 @@ public class Consume extends Plugin {
|
||||
log.info("Stopping Chaos Consume");
|
||||
|
||||
executor.shutdownNow();
|
||||
keyManager.unregisterKeyListener(this);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@ -237,7 +253,6 @@ public class Consume extends Plugin {
|
||||
}
|
||||
|
||||
private void tick() {
|
||||
|
||||
int hp = game.modifiedLevel(Skill.HITPOINTS);
|
||||
|
||||
if (config.enableEating() && hp <= eatThreshold && canEat()) {
|
||||
@ -357,6 +372,85 @@ public class Consume extends Plugin {
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onPlayerSpawned(PlayerSpawned event) {
|
||||
if (!config.tpOnDangerousPlayer() || !pkTeleport || game.client().getVar(Varbits.IN_WILDERNESS) == 0 || event.getPlayer() == null) return;
|
||||
|
||||
iWidget wildernessLevelWidget = game.widget(WidgetInfo.PVP_WILDERNESS_LEVEL);
|
||||
if (wildernessLevelWidget == null || wildernessLevelWidget.text() == null) return;
|
||||
|
||||
Pattern regex = Pattern.compile("\\d+-\\d+");
|
||||
Matcher levelMatcher = regex.matcher(wildernessLevelWidget.text());
|
||||
|
||||
if (levelMatcher.find()) {
|
||||
String[] levelRange = levelMatcher.group(0).split("-");
|
||||
int lowerLevel = Integer.parseInt(levelRange[0]);
|
||||
int upperLevel = Integer.parseInt(levelRange[1]);
|
||||
|
||||
int playerLevel = event.getPlayer().getCombatLevel();
|
||||
|
||||
if (event.getPlayer().getSkullIcon() != null && (playerLevel >= lowerLevel && playerLevel <= upperLevel)) {
|
||||
log.info("Dangerous player spawned: " + event.getPlayer().getName());
|
||||
executor.schedule(this::teleport, 0, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onInteractingChanged(InteractingChanged event) {
|
||||
if (!config.tpOnPlayerAttack() || !pkTeleport || game.client().getVar(Varbits.IN_WILDERNESS) == 0) return;
|
||||
|
||||
if (event.getSource() == null || event.getTarget() == null) return;
|
||||
|
||||
if (event.getSource() instanceof Player && event.getTarget().equals(game.client().getLocalPlayer())) {
|
||||
log.info("Player attacking us: " + event.getSource().getName());
|
||||
executor.schedule(this::teleport, 0, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
private void teleport() {
|
||||
pkTeleport = false;
|
||||
|
||||
iWidget wildernessLevelWidget = game.widget(WidgetInfo.PVP_WILDERNESS_LEVEL);
|
||||
if (wildernessLevelWidget == null || wildernessLevelWidget.text() == null) return;
|
||||
|
||||
Pattern regex = Pattern.compile("Level: \\d+");
|
||||
Matcher levelMatcher = regex.matcher(wildernessLevelWidget.text());
|
||||
|
||||
if (!levelMatcher.find()) return;
|
||||
|
||||
if (Integer.parseInt(levelMatcher.group(0).split(" ")[1]) > 30) return;
|
||||
|
||||
EquipmentItem amuletOfGlory = game.equipment().withAction("Edgeville").first();
|
||||
if (amuletOfGlory == null) return;
|
||||
|
||||
amuletOfGlory.interact("Edgeville");
|
||||
game.tick(3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(KeyEvent e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (config.pkTeleport().matches(e)) {
|
||||
pkTeleport = !pkTeleport;
|
||||
|
||||
if (pkTeleport) {
|
||||
game.utils.sendGameMessage("Enabled PK teleport");
|
||||
} else {
|
||||
game.utils.sendGameMessage("Disabled PK teleport");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent e) {
|
||||
|
||||
}
|
||||
|
||||
private void generateNewEatThreshold() {
|
||||
eatThreshold = calc.random(config.minEatHP(), config.maxEatHP() + 1);
|
||||
}
|
||||
|
@ -39,6 +39,14 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
)
|
||||
default Product targetProduct() { return Product.LANTERN_LENS; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "farmSeaweedSpores",
|
||||
name = "Farm seaweed spores",
|
||||
description = "Go underwater at the Fossil Island to farm seaweed spores.",
|
||||
position = 1
|
||||
)
|
||||
default boolean farmSeaweedSpores() { return true; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "startButton",
|
||||
name = "Start/Stop",
|
||||
|
@ -32,7 +32,7 @@ public class Blow extends Task {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
if (game.localPlayer().position().regionID() == Glassblower.FOSSIL_ISLAND_SMALL_ISLAND_REGION) {
|
||||
if (config.farmSeaweedSpores() && game.localPlayer().position().regionID() == Glassblower.FOSSIL_ISLAND_SMALL_ISLAND_REGION) {
|
||||
iObject rowboat = game.objects().withName("Rowboat").nearest();
|
||||
if (rowboat == null) return;
|
||||
|
||||
@ -47,7 +47,7 @@ public class Blow extends Task {
|
||||
game.tick();
|
||||
}
|
||||
|
||||
if (game.groundItems().withId(ItemID.SEAWEED_SPORE).exists()) return;
|
||||
if (config.farmSeaweedSpores() && game.groundItems().withId(ItemID.SEAWEED_SPORE).exists()) return;
|
||||
|
||||
InventoryItem pipe = game.inventory().withId(ItemID.GLASSBLOWING_PIPE).first();
|
||||
InventoryItem moltenGlass = game.inventory().withId(ItemID.MOLTEN_GLASS).first();
|
||||
|
@ -1,14 +1,17 @@
|
||||
package io.reisub.openosrs.glassblower.tasks;
|
||||
|
||||
import io.reisub.openosrs.glassblower.Config;
|
||||
import io.reisub.openosrs.glassblower.Glassblower;
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import io.reisub.openosrs.util.tasks.BankTask;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.client.plugins.iutils.game.iObject;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
|
||||
public class HandleBank extends Task {
|
||||
public class HandleBank extends BankTask {
|
||||
private Instant lastBanking = Instant.EPOCH;
|
||||
|
||||
@Override
|
||||
@ -39,13 +42,7 @@ public class HandleBank extends Task {
|
||||
game.tick();
|
||||
}
|
||||
|
||||
if (!bank.isOpen()) {
|
||||
iObject bankObj = game.objects().withName("Bank chest", "Bank booth", "Bank Chest-wreck").nearest();
|
||||
if (bankObj == null) return;
|
||||
|
||||
bankObj.interact(0);
|
||||
game.waitUntil(() -> bank.isOpen(), 15);
|
||||
}
|
||||
openBank(5);
|
||||
|
||||
bank.depositExcept(false, ItemID.GLASSBLOWING_PIPE, ItemID.SEAWEED_SPORE);
|
||||
// bank.depositAll(false, ItemID.BEER_GLASS,
|
||||
|
BIN
release/agility-0.0.1.jar
Normal file
BIN
release/agility-0.0.1.jar
Normal file
Binary file not shown.
BIN
release/consume-0.0.1.jar
Normal file
BIN
release/consume-0.0.1.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
release/cooker-0.0.1.jar
Normal file
BIN
release/cooker-0.0.1.jar
Normal file
Binary file not shown.
BIN
release/fisher-0.0.1.jar
Normal file
BIN
release/fisher-0.0.1.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
release/masterthiever-0.0.1.jar
Normal file
BIN
release/masterthiever-0.0.1.jar
Normal file
Binary file not shown.
BIN
release/prayerflick-1.0.0.jar
Normal file
BIN
release/prayerflick-1.0.0.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,58 @@
|
||||
package io.reisub.openosrs.util.tasks;
|
||||
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import net.runelite.client.plugins.iutils.game.iNPC;
|
||||
import net.runelite.client.plugins.iutils.game.iObject;
|
||||
|
||||
public abstract class BankTask extends Task {
|
||||
@Override
|
||||
public String getStatus() {
|
||||
return "Banking";
|
||||
}
|
||||
|
||||
protected void openBank() {
|
||||
openBank(15);
|
||||
}
|
||||
|
||||
protected boolean openBank(int waitTicks) {
|
||||
if (!bank.isOpen()) {
|
||||
iObject bankObj = getBankObject();
|
||||
|
||||
if (bankObj != null) {
|
||||
if (bankObj.actions().contains("Bank")) {
|
||||
bankObj.interact("Bank");
|
||||
} else if (bankObj.actions().contains("Use")) {
|
||||
bankObj.interact("Use");
|
||||
} else {
|
||||
bankObj.interact(0);
|
||||
}
|
||||
} else {
|
||||
iNPC bankNpc = getBankNpc();
|
||||
if (bankNpc == null) return false;
|
||||
|
||||
if (bankNpc.actions().contains("Bank")) {
|
||||
bankNpc.interact("Bank");
|
||||
} else {
|
||||
bankNpc.interact(0);
|
||||
}
|
||||
}
|
||||
|
||||
game.waitUntil(() -> bank.isOpen(), waitTicks);
|
||||
}
|
||||
|
||||
return bank.isOpen();
|
||||
}
|
||||
|
||||
protected iObject getBankObject() {
|
||||
return game.objects()
|
||||
.withName("Bank chest", "Bank booth", "Bank Chest-wreck", "Bank chest")
|
||||
.nearest();
|
||||
}
|
||||
|
||||
protected iNPC getBankNpc() {
|
||||
return game.npcs()
|
||||
.withAction("Bank")
|
||||
.nearest();
|
||||
}
|
||||
|
||||
}
|
@ -307,7 +307,7 @@ public class Wintertodt extends CScript {
|
||||
if (projectile.getId() == 501) {
|
||||
int x = game.client().getBaseX() + event.getPosition().getSceneX();
|
||||
int y = game.client().getBaseY() + event.getPosition().getSceneY();
|
||||
int cycles = projectile.getEndCycle() - projectile.getStartMovementCycle();
|
||||
int cycles = projectile.getEndCycle() - projectile.getStartCycle();
|
||||
|
||||
// we don't care about any of the projectiles that don't go to our play area
|
||||
if (y >= 4001) return;
|
||||
|
Reference in New Issue
Block a user