Compare commits
2 Commits
fb86f97efa
...
7efda7494a
Author | SHA1 | Date | |
---|---|---|---|
7efda7494a
|
|||
78786709eb
|
@ -23,7 +23,7 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
version = "0.0.1"
|
||||
version = "1.0.0"
|
||||
|
||||
project.extra["PluginName"] = "Chaos Agility" // This is the name that is used in the external plugin manager panel
|
||||
project.extra["PluginDescription"] = "Hippity hoppity, jumps on your property" // This is the description that is used in the external plugin manager panel
|
||||
|
@ -4,24 +4,23 @@ import com.google.inject.Provides;
|
||||
import io.reisub.openosrs.agility.tasks.Alch;
|
||||
import io.reisub.openosrs.agility.tasks.HandleObstacle;
|
||||
import io.reisub.openosrs.agility.tasks.PickupMark;
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import io.reisub.openosrs.util.CScript;
|
||||
import io.reisub.openosrs.util.Util;
|
||||
import io.reisub.openosrs.util.tasks.Eat;
|
||||
import io.reisub.openosrs.util.tasks.KittenTask;
|
||||
import io.reisub.openosrs.util.tasks.Run;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.events.*;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.HitsplatApplied;
|
||||
import net.runelite.api.events.StatChanged;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.PluginDependency;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.iutils.iUtils;
|
||||
import net.runelite.client.plugins.iutils.scripts.iScript;
|
||||
import org.pf4j.Extension;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Extension
|
||||
@PluginDependency(Util.class)
|
||||
@ -32,38 +31,22 @@ import java.util.List;
|
||||
enabledByDefault = false
|
||||
)
|
||||
@Slf4j
|
||||
public class AgilityPlugin extends iScript {
|
||||
public class Agility extends CScript {
|
||||
@Inject
|
||||
private AgilityConfig config;
|
||||
private Config config;
|
||||
|
||||
private List<Task> tasks;
|
||||
|
||||
private KittenTask kittenTask;
|
||||
private Alch alchTask;
|
||||
private HandleObstacle handleObstacleTask;
|
||||
private PickupMark pickupMarkTask;
|
||||
|
||||
@Provides
|
||||
AgilityConfig provideConfig(ConfigManager configManager) {
|
||||
return configManager.getConfig(AgilityConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loop() {
|
||||
for (Task t : tasks) {
|
||||
if (t.validate()) {
|
||||
log.info(t.getStatus());
|
||||
t.execute();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
game.sleepDelay();
|
||||
Config provideConfig(ConfigManager configManager) {
|
||||
return configManager.getConfig(Config.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
log.info("Starting Chaos Agility");
|
||||
super.onStart();
|
||||
|
||||
Eat eatTask = injector.getInstance(Eat.class);
|
||||
eatTask.setInterval(14, 24);
|
||||
@ -71,7 +54,6 @@ public class AgilityPlugin extends iScript {
|
||||
Run runTask = injector.getInstance(Run.class);
|
||||
runTask.setInterval(70, 95);
|
||||
|
||||
kittenTask = KittenTask.getInstance(injector);
|
||||
handleObstacleTask = injector.getInstance(HandleObstacle.class);
|
||||
pickupMarkTask = injector.getInstance(PickupMark.class);
|
||||
|
||||
@ -79,10 +61,8 @@ public class AgilityPlugin extends iScript {
|
||||
alchTask = injector.getInstance(Alch.class);
|
||||
}
|
||||
|
||||
tasks = new ArrayList<>();
|
||||
tasks.add(eatTask);
|
||||
tasks.add(runTask);
|
||||
tasks.add(kittenTask);
|
||||
tasks.add(pickupMarkTask);
|
||||
if (config.highAlch()) {
|
||||
tasks.add(alchTask);
|
||||
@ -92,23 +72,6 @@ public class AgilityPlugin extends iScript {
|
||||
handleObstacleTask.setReady(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
log.info("Stopping Chaos Agility");
|
||||
if (tasks != null) {
|
||||
tasks.clear();
|
||||
}
|
||||
|
||||
KittenTask.handleKitten = false;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onConfigButtonPressed(ConfigButtonClicked configButtonClicked) {
|
||||
if (configButtonClicked.getKey().equals("startButton")) {
|
||||
execute();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onHitsplatApplied(HitsplatApplied event) {
|
||||
if (handleObstacleTask != null) {
|
||||
@ -148,10 +111,6 @@ public class AgilityPlugin extends iScript {
|
||||
|
||||
@Subscribe
|
||||
private void onChatMessage(ChatMessage chatMessage) {
|
||||
if (kittenTask != null) {
|
||||
kittenTask.onChatMessage(chatMessage);
|
||||
}
|
||||
|
||||
if (handleObstacleTask != null) {
|
||||
handleObstacleTask.onChatMessage(chatMessage);
|
||||
}
|
@ -24,13 +24,12 @@
|
||||
*/
|
||||
package io.reisub.openosrs.agility;
|
||||
import net.runelite.client.config.Button;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup("ChaosAgilityConfig")
|
||||
@ConfigGroup("chaosagility")
|
||||
|
||||
public interface AgilityConfig extends Config {
|
||||
public interface Config extends net.runelite.client.config.Config {
|
||||
@ConfigItem(
|
||||
position = 0,
|
||||
keyName = "courseSelection",
|
@ -1,6 +1,6 @@
|
||||
package io.reisub.openosrs.agility.tasks;
|
||||
|
||||
import io.reisub.openosrs.agility.AgilityConfig;
|
||||
import io.reisub.openosrs.agility.Config;
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.api.events.GameTick;
|
||||
@ -14,7 +14,7 @@ import javax.inject.Inject;
|
||||
|
||||
public class Alch extends Task {
|
||||
@Inject
|
||||
private AgilityConfig config;
|
||||
private Config config;
|
||||
|
||||
private boolean ready;
|
||||
private long lastAlchTick;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package io.reisub.openosrs.agility.tasks;
|
||||
|
||||
import io.reisub.openosrs.agility.AgilityConfig;
|
||||
import io.reisub.openosrs.agility.Config;
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.api.events.*;
|
||||
@ -10,7 +10,7 @@ import javax.inject.Inject;
|
||||
|
||||
public class HandleObstacle extends Task {
|
||||
@Inject
|
||||
private AgilityConfig config;
|
||||
private Config config;
|
||||
|
||||
private boolean ready;
|
||||
private int timeout = 10;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package io.reisub.openosrs.agility.tasks;
|
||||
|
||||
import io.reisub.openosrs.agility.AgilityConfig;
|
||||
import io.reisub.openosrs.agility.Config;
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.api.events.HitsplatApplied;
|
||||
@ -12,7 +12,7 @@ import javax.inject.Inject;
|
||||
|
||||
public class PickupMark extends Task {
|
||||
@Inject
|
||||
private AgilityConfig config;
|
||||
private Config config;
|
||||
|
||||
private boolean failed;
|
||||
|
||||
|
@ -7,6 +7,7 @@ import net.runelite.api.ItemID;
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum Ashes {
|
||||
NONE(-1),
|
||||
FIENDISH_ASHES(ItemID.FIENDISH_ASHES),
|
||||
VILE_ASHES(ItemID.VILE_ASHES),
|
||||
MALICIOUS_ASHES(ItemID.MALICIOUS_ASHES),
|
||||
@ -14,4 +15,21 @@ public enum Ashes {
|
||||
INFERNAL_ASHES(ItemID.INFERNAL_ASHES);
|
||||
|
||||
private final int id;
|
||||
|
||||
static Ashes[] allBelow(Ashes ashes) {
|
||||
if (ashes == NONE) return new Ashes[0];
|
||||
|
||||
Ashes[] allBelow = new Ashes[ashes.ordinal()];
|
||||
int i = 0;
|
||||
|
||||
for (Ashes a : Ashes.values()) {
|
||||
if (a == NONE) continue;
|
||||
|
||||
allBelow[i++] = a;
|
||||
|
||||
if (a == ashes) break;
|
||||
}
|
||||
|
||||
return allBelow;
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import com.google.inject.Provides;
|
||||
import io.reisub.openosrs.util.Util;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.events.ConfigButtonClicked;
|
||||
import net.runelite.api.events.ItemContainerChanged;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
@ -13,13 +12,10 @@ 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.Game;
|
||||
import net.runelite.client.plugins.iutils.game.InventoryItem;
|
||||
import net.runelite.client.plugins.iutils.iUtils;
|
||||
import org.pf4j.Extension;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@ -48,12 +44,16 @@ public class Autobones extends Plugin {
|
||||
return configManager.getConfig(Config.class);
|
||||
}
|
||||
|
||||
private int[] itemIds;
|
||||
|
||||
private ScheduledExecutorService executor;
|
||||
|
||||
@Override
|
||||
protected void startUp() {
|
||||
log.info("Starting Chaos Autobones");
|
||||
|
||||
itemIds = parseItemIds();
|
||||
|
||||
executor = Executors.newSingleThreadScheduledExecutor();
|
||||
}
|
||||
|
||||
@ -61,9 +61,19 @@ public class Autobones extends Plugin {
|
||||
protected void shutDown() {
|
||||
log.info("Stopping Chaos Autobones");
|
||||
|
||||
itemIds = null;
|
||||
|
||||
executor.shutdownNow();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Subscribe
|
||||
private void onConfigChanged(ConfigChanged event) {
|
||||
if (event.getGroup().equals("chaosautobones")) {
|
||||
itemIds = parseItemIds();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Subscribe
|
||||
private void onItemContainerChanged(ItemContainerChanged event) {
|
||||
@ -72,7 +82,34 @@ public class Autobones extends Plugin {
|
||||
if (config.bones().getId() == -1 && config.ashes().getId() == -1) return;
|
||||
|
||||
executor.schedule(() -> {
|
||||
game.inventory().withId(config.bones().getId(), config.ashes().getId()).first().interact(0);
|
||||
game.inventory().withId(itemIds).first().interact(0);
|
||||
}, 0, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
private int[] parseItemIds() {
|
||||
int[] ids;
|
||||
|
||||
if (config.allBelow()) {
|
||||
Ashes[] allAshes = Ashes.allBelow(config.ashes());
|
||||
Bones[] allBones = Bones.allBelow(config.bones());
|
||||
|
||||
ids = new int[allAshes.length + allBones.length];
|
||||
int i = 0;
|
||||
|
||||
for (Ashes a : allAshes) {
|
||||
ids[i++] = a.getId();
|
||||
}
|
||||
|
||||
for (Bones b : allBones) {
|
||||
ids[i++] = b.getId();
|
||||
}
|
||||
} else {
|
||||
ids = new int[2];
|
||||
|
||||
ids[0] = config.ashes().getId();
|
||||
ids[1] = config.bones().getId();
|
||||
}
|
||||
|
||||
return ids;
|
||||
}
|
||||
}
|
@ -31,4 +31,21 @@ public enum Bones {
|
||||
SUPERIOR_DRAGON_BONES(ItemID.SUPERIOR_DRAGON_BONES);
|
||||
|
||||
private final int id;
|
||||
|
||||
static Bones[] allBelow(Bones bones) {
|
||||
if (bones == NONE) return new Bones[0];
|
||||
|
||||
Bones[] allBelow = new Bones[bones.ordinal()];
|
||||
int i = 0;
|
||||
|
||||
for (Bones b : Bones.values()) {
|
||||
if (b == NONE) continue;
|
||||
|
||||
allBelow[i++] = b;
|
||||
|
||||
if (b == bones) break;
|
||||
}
|
||||
|
||||
return allBelow;
|
||||
}
|
||||
}
|
||||
|
@ -45,4 +45,12 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
position = 1
|
||||
)
|
||||
default Ashes ashes() { return Ashes.VILE_ASHES; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "allBelow",
|
||||
name = "Bury/scatter all below threshold",
|
||||
description = "Bury/scatter all the bones/ashes of lower value including the chosen bones/ashes.",
|
||||
position = 2
|
||||
)
|
||||
default boolean allBelow() { return true; }
|
||||
}
|
@ -2,23 +2,26 @@ package io.reisub.openosrs.autodropper;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import io.reisub.openosrs.util.Util;
|
||||
import io.reisub.openosrs.util.enums.Activity;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.events.ConfigButtonClicked;
|
||||
import net.runelite.api.events.ItemContainerChanged;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.config.Keybind;
|
||||
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.Game;
|
||||
import net.runelite.client.plugins.iutils.game.InventoryItem;
|
||||
import net.runelite.client.plugins.iutils.iUtils;
|
||||
import org.pf4j.Extension;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.List;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
@ -33,7 +36,7 @@ import java.util.concurrent.TimeUnit;
|
||||
enabledByDefault = false
|
||||
)
|
||||
@Slf4j
|
||||
public class Autodropper extends Plugin {
|
||||
public class Autodropper extends Plugin implements KeyListener {
|
||||
@SuppressWarnings("unused")
|
||||
@Inject
|
||||
private Game game;
|
||||
@ -42,6 +45,10 @@ public class Autodropper extends Plugin {
|
||||
@Inject
|
||||
private Config config;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Inject
|
||||
private KeyManager keyManager;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Provides
|
||||
Config provideConfig(ConfigManager configManager) {
|
||||
@ -56,6 +63,10 @@ public class Autodropper extends Plugin {
|
||||
protected void startUp() {
|
||||
log.info("Starting Chaos Autodropper");
|
||||
|
||||
itemNames = parseNames();
|
||||
itemIds = parseIds();
|
||||
|
||||
keyManager.registerKeyListener(this);
|
||||
executor = Executors.newSingleThreadScheduledExecutor();
|
||||
}
|
||||
|
||||
@ -63,23 +74,20 @@ public class Autodropper extends Plugin {
|
||||
protected void shutDown() {
|
||||
log.info("Stopping Chaos Autodropper");
|
||||
|
||||
keyManager.unregisterKeyListener(this);
|
||||
executor.shutdownNow();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Subscribe
|
||||
private void onItemContainerChanged(ItemContainerChanged event) {
|
||||
if (game.client().getGameState() != GameState.LOGGED_IN) return;
|
||||
if (game.client().getGameState() != GameState.LOGGED_IN || config.dropMethod() == DropMethod.NONE) return;
|
||||
|
||||
if (!config.dropWhileItemSelected() && game.client().isItemSelected() == 1) return;
|
||||
|
||||
if (itemNames == null) itemNames = parseNames();
|
||||
if (itemIds == null) itemIds = parseIds();
|
||||
|
||||
executor.schedule(() -> {
|
||||
game.inventory().withName(itemNames).drop();
|
||||
game.inventory().withId(itemIds).drop();
|
||||
}, 0, TimeUnit.MILLISECONDS);
|
||||
if (config.dropMethod() == DropMethod.ON_ADD) {
|
||||
drop();
|
||||
} else if (config.dropMethod() == DropMethod.ON_FULL_INVENTORY && game.inventory().full()) {
|
||||
drop();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@ -105,10 +113,18 @@ public class Autodropper extends Plugin {
|
||||
}
|
||||
|
||||
private String[] parseNames() {
|
||||
String[] names = config.itemNames().split(";");
|
||||
String[] itemNames = config.itemNames().split(";");
|
||||
String[] seedNames = config.seedNames().split(";");
|
||||
String[] names = new String[itemNames.length + seedNames.length];
|
||||
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
names[i] = names[i].trim();
|
||||
int i = 0;
|
||||
|
||||
for (String name : itemNames) {
|
||||
names[i++] = name.trim();
|
||||
}
|
||||
|
||||
for (String name : seedNames) {
|
||||
names[i++] = name.trim();
|
||||
}
|
||||
|
||||
return names;
|
||||
@ -126,4 +142,26 @@ public class Autodropper extends Plugin {
|
||||
|
||||
return ids;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(KeyEvent e) {}
|
||||
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (config.dropEnableHotkey() && config.dropHotkey().matches(e)) {
|
||||
drop();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent e) {}
|
||||
|
||||
private void drop() {
|
||||
if (!config.dropWhileItemSelected() && game.client().isItemSelected() == 1) return;
|
||||
|
||||
executor.schedule(() -> {
|
||||
game.inventory().withName(itemNames).drop();
|
||||
game.inventory().withId(itemIds).drop();
|
||||
}, 0, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
}
|
@ -24,9 +24,11 @@
|
||||
*/
|
||||
package io.reisub.openosrs.autodropper;
|
||||
|
||||
import net.runelite.client.config.Button;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
import io.reisub.openosrs.util.enums.Activity;
|
||||
import net.runelite.client.config.*;
|
||||
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
@ConfigGroup("chaosautodropper")
|
||||
|
||||
@ -47,14 +49,57 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
)
|
||||
default String itemIds() { return ""; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "dropMethod",
|
||||
name = "Auto drop method",
|
||||
description = "Choose the automatic drop method.",
|
||||
position = 3
|
||||
)
|
||||
default DropMethod dropMethod() { return DropMethod.NONE; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "dropEnableHotkey",
|
||||
name = "Enable hotkey",
|
||||
description = "Enable dropping on hotkey.",
|
||||
position = 4
|
||||
)
|
||||
default boolean dropEnableHotkey() { return false; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "dropHotkey",
|
||||
name = "Hotkey",
|
||||
description = "Choose the hotkey.",
|
||||
hidden = true,
|
||||
unhide = "dropEnableHotkey",
|
||||
position = 5
|
||||
)
|
||||
default Keybind dropHotkey() { return new Keybind(KeyEvent.VK_A, InputEvent.CTRL_DOWN_MASK); }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "dropWhileItemSelected",
|
||||
name = "Drop while item selected",
|
||||
description = "If enabled, this will drop items even if an item is selected, resulting in deselecting the item.",
|
||||
position = 2
|
||||
position = 6
|
||||
)
|
||||
default boolean dropWhileItemSelected() { return false; }
|
||||
|
||||
@ConfigSection(
|
||||
keyName = "seedsConfig",
|
||||
name = "Seeds configuration",
|
||||
description = "Seeds configuration",
|
||||
position = 70
|
||||
)
|
||||
String seedsConfig = "seedsConfig";
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "seedNames",
|
||||
name = "Seed names",
|
||||
description = "List of seeds to drop. This works the same as regular items but is an extra field to not clog the regular one.",
|
||||
position = 71
|
||||
)
|
||||
default String seedNames() { return "Potato seed; Onion seed; Cabbage seed; Tomato seed; Sweetcorn seed; Marigold seed; Rosemary seed; Nasturtium seed; Woad seed; Redberry seed; Cadavaberry seed; Dwellberry seed; Acorn; Apple tree seed; Banana tree seed"; }
|
||||
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "reloadButton",
|
||||
name = "Reload configuration",
|
||||
|
@ -0,0 +1,7 @@
|
||||
package io.reisub.openosrs.autodropper;
|
||||
|
||||
public enum DropMethod {
|
||||
NONE,
|
||||
ON_ADD,
|
||||
ON_FULL_INVENTORY;
|
||||
}
|
@ -30,10 +30,10 @@ import java.util.List;
|
||||
enabledByDefault = false
|
||||
)
|
||||
@Slf4j
|
||||
public class BasePlugin extends iScript {
|
||||
public class BasePlugin extends CScript {
|
||||
@Provides
|
||||
Config provideConfig(ConfigManager configManager) {
|
||||
return configManager.getConfig(BaseConfig.class);
|
||||
return configManager.getConfig(Config.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -10,12 +10,15 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.input.KeyListener;
|
||||
import net.runelite.client.plugins.PluginDependency;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.iutils.iUtils;
|
||||
import net.runelite.client.plugins.iutils.scene.Position;
|
||||
import org.pf4j.Extension;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.HashMap;
|
||||
@ -30,7 +33,10 @@ import java.util.Map;
|
||||
enabledByDefault = false
|
||||
)
|
||||
@Slf4j
|
||||
public class Birdhouse extends CScript {
|
||||
public class Birdhouse extends CScript implements KeyListener {
|
||||
@Inject
|
||||
private Config config;
|
||||
|
||||
@Provides
|
||||
Config provideConfig(ConfigManager configManager) {
|
||||
return configManager.getConfig(Config.class);
|
||||
@ -87,17 +93,34 @@ public class Birdhouse extends CScript {
|
||||
@SuppressWarnings("unused")
|
||||
@Subscribe
|
||||
private void onGameTick(GameTick event) {
|
||||
if (isLoggedIn()
|
||||
&& game.localPlayer().position().regionID() == 14908) {
|
||||
if (!active && game.localPlayer().position().distanceTo(hillHousePosition) < 10 && game.inventory().withNamePart("logs").count() == 4) {
|
||||
execute();
|
||||
} else if (active && game.inventory().all().isEmpty() && !bank.isOpen() && game.localPlayer().position().distanceTo(islandPosition) < 10) {
|
||||
execute();
|
||||
}
|
||||
}
|
||||
// if (isLoggedIn()
|
||||
// && game.localPlayer().position().regionID() == 14908) {
|
||||
// if (!active && game.localPlayer().position().distanceTo(hillHousePosition) < 10 && game.inventory().withNamePart("logs").count() == 4) {
|
||||
// execute();
|
||||
// } else if (active && game.inventory().all().isEmpty() && !bank.isOpen() && game.localPlayer().position().distanceTo(islandPosition) < 10) {
|
||||
// execute();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
public boolean hasRecentlyBeenEmptied(BirdhouseSpace space) {
|
||||
return Duration.between(getBirdhouseTimers().get(space), Instant.now()).getSeconds() < 2000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(KeyEvent e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (config.birdhouseHotkey().matches(e)) {
|
||||
execute();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent e) {
|
||||
|
||||
}
|
||||
}
|
@ -1,10 +1,11 @@
|
||||
package io.reisub.openosrs.birdhouse;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.ItemID;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum BirdhouseType {
|
||||
|
@ -27,15 +27,29 @@ package io.reisub.openosrs.birdhouse;
|
||||
import net.runelite.client.config.Button;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
import net.runelite.client.config.Keybind;
|
||||
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
@ConfigGroup("chaosbirdhouse")
|
||||
|
||||
public interface Config extends net.runelite.client.config.Config {
|
||||
@ConfigItem(
|
||||
keyName = "birdhouseHotkey",
|
||||
name = "Hotkey",
|
||||
description = "Press this key to start a birdhouse run.",
|
||||
position = 0
|
||||
)
|
||||
default Keybind birdhouseHotkey() {
|
||||
return new Keybind(KeyEvent.VK_F12, InputEvent.CTRL_DOWN_MASK);
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "farmSeaweed",
|
||||
name = "Farm seaweed",
|
||||
description = "Harvest and plant seaweed after a birdhouse run.",
|
||||
position = 0
|
||||
position = 1
|
||||
)
|
||||
default boolean farmSeaweed() { return true; }
|
||||
|
||||
|
@ -42,7 +42,9 @@ public class BankSpores extends Task {
|
||||
bank.depositInventory();
|
||||
game.tick();
|
||||
|
||||
bank.withdraw(ItemID.SEAWEED_SPORE, 2, false);
|
||||
bank.withdraw(ItemID.SEAWEED_SPORE, 1, false);
|
||||
game.sleepDelay();
|
||||
bank.withdraw(ItemID.SEAWEED_SPORE, 1, false);
|
||||
game.tick();
|
||||
|
||||
bank.withdraw(ItemID.FISHBOWL_HELMET, 1, false);
|
||||
@ -51,6 +53,9 @@ public class BankSpores extends Task {
|
||||
bank.withdraw(ItemID.DIVING_APPARATUS, 1, false);
|
||||
game.tick();
|
||||
|
||||
bank.withdraw(ItemID.FLIPPERS, 1, false);
|
||||
game.tick();
|
||||
|
||||
bank.close();
|
||||
game.waitUntil(() -> !bank.isOpen(), 5);
|
||||
|
||||
@ -59,6 +64,9 @@ public class BankSpores extends Task {
|
||||
|
||||
game.inventory().withId(ItemID.DIVING_APPARATUS).findFirst().ifPresent((apparatus) -> apparatus.interact("Wear"));
|
||||
game.tick();
|
||||
|
||||
game.inventory().withId(ItemID.FLIPPERS).findFirst().ifPresent((flippers) -> flippers.interact("Wear"));
|
||||
game.tick();
|
||||
iObject rowboat = game.objects().withName("Rowboat").nearest();
|
||||
if (rowboat == null) return;
|
||||
|
||||
|
@ -7,7 +7,6 @@ import io.reisub.openosrs.util.Task;
|
||||
import net.runelite.client.plugins.iutils.game.iObject;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
|
||||
public class EmptyBirdhouse extends Task {
|
||||
|
@ -23,7 +23,7 @@ public class GetTools extends Task {
|
||||
if (leprechaun == null) return;
|
||||
|
||||
leprechaun.interact("Exchange");
|
||||
game.waitUntil(() -> game.widget(125, 0) != null, 30);
|
||||
game.waitUntil(() -> game.widget(125, 0) != null && !game.widget(125, 0).hidden(), 30);
|
||||
game.tick();
|
||||
|
||||
iWidget dibber = game.widget(125, 9);
|
||||
|
52
bosshelper/bosshelper.gradle.kts
Normal file
52
bosshelper/bosshelper.gradle.kts
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
version = "1.0.0"
|
||||
|
||||
project.extra["PluginName"] = "Chaos Bosshelper" // This is the name that is used in the external plugin manager panel
|
||||
project.extra["PluginDescription"] = "Doesn't actually help bosses, it helps you against them!" // This is the description that is used in the external plugin manager panel
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":util"))
|
||||
}
|
||||
|
||||
tasks {
|
||||
jar {
|
||||
manifest {
|
||||
attributes(mapOf(
|
||||
"Plugin-Version" to project.version,
|
||||
"Plugin-Id" to nameToId(project.extra["PluginName"] as String),
|
||||
"Plugin-Provider" to project.extra["PluginProvider"],
|
||||
"Plugin-Description" to project.extra["PluginDescription"],
|
||||
"Plugin-Dependencies" to
|
||||
arrayOf(
|
||||
nameToId("Chaos Util"),
|
||||
nameToId("iUtils")
|
||||
).joinToString(),
|
||||
"Plugin-License" to project.extra["PluginLicense"]
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package io.reisub.openosrs.bosshelper;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
|
||||
import io.reisub.openosrs.util.CScript;
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import io.reisub.openosrs.util.Util;
|
||||
import io.reisub.openosrs.util.tasks.Eat;
|
||||
import io.reisub.openosrs.util.tasks.KittenTask;
|
||||
import io.reisub.openosrs.util.tasks.Run;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.ConfigButtonClicked;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.PluginDependency;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.iutils.iUtils;
|
||||
import net.runelite.client.plugins.iutils.scripts.iScript;
|
||||
import org.pf4j.Extension;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Extension
|
||||
@PluginDependency(Util.class)
|
||||
@PluginDependency(iUtils.class)
|
||||
@PluginDescriptor(
|
||||
name = "Chaos Bosshelper",
|
||||
description = "Doesn't actually help bosses, it helps you against them!",
|
||||
enabledByDefault = false
|
||||
)
|
||||
@Slf4j
|
||||
public class Bosshelper extends CScript {
|
||||
@Provides
|
||||
Config provideConfig(ConfigManager configManager) {
|
||||
return configManager.getConfig(Config.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
||||
Run runTask = injector.getInstance(Run.class);
|
||||
runTask.setInterval(70, 95);
|
||||
tasks.add(runTask);
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Andrew EP | ElPinche256 <https://github.com/ElPinche256>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package io.reisub.openosrs.bosshelper;
|
||||
|
||||
import net.runelite.client.config.Button;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup("chaosbosshelper")
|
||||
|
||||
public interface Config extends net.runelite.client.config.Config {
|
||||
@ConfigItem(
|
||||
keyName = "startButton",
|
||||
name = "Start/Stop",
|
||||
description = "Start the script",
|
||||
position = 100
|
||||
)
|
||||
default Button startButton() {
|
||||
return new Button();
|
||||
}
|
||||
}
|
@ -24,9 +24,11 @@
|
||||
*/
|
||||
package io.reisub.openosrs.consume;
|
||||
|
||||
import net.runelite.client.config.*;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
import net.runelite.client.config.ConfigSection;
|
||||
|
||||
@ConfigGroup("ChaosConsumeConfig")
|
||||
@ConfigGroup("chaosconsume")
|
||||
|
||||
public interface Config extends net.runelite.client.config.Config {
|
||||
@ConfigSection(
|
||||
@ -384,4 +386,45 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
default boolean magicWarnings() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigSection(
|
||||
keyName = "specialConfig",
|
||||
name = "Weapon Special Configuration",
|
||||
description = "Configure weapon specials",
|
||||
position = 40
|
||||
)
|
||||
String specialConfig = "specialConfig";
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "useSpecial",
|
||||
name = "Use special",
|
||||
description = "Use weapon special",
|
||||
section = "specialConfig",
|
||||
position = 41
|
||||
)
|
||||
default boolean useSpecial() { return false; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "specialWeapon",
|
||||
name = "Weapon",
|
||||
description = "What weapon to use the special of. Leaving this empty will use the currently equipped weapon.",
|
||||
section = "specialConfig",
|
||||
hidden = true,
|
||||
unhide = "useSpecial",
|
||||
position = 42
|
||||
)
|
||||
default String specialWeapon() { return ""; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "specialCost",
|
||||
name = "Special cost",
|
||||
description = "Cost of the special attack.",
|
||||
section = "specialConfig",
|
||||
hidden = true,
|
||||
unhide = "useSpecial",
|
||||
position = 43
|
||||
)
|
||||
default int specialCost() { return 100; }
|
||||
|
||||
|
||||
}
|
@ -4,11 +4,10 @@ import com.google.inject.Provides;
|
||||
import io.reisub.openosrs.util.Calculations;
|
||||
import io.reisub.openosrs.util.Util;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.api.VarPlayer;
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.events.*;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
@ -17,11 +16,16 @@ import net.runelite.client.plugins.PluginDependency;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
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 org.pf4j.Extension;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Extension
|
||||
@PluginDependency(Util.class)
|
||||
@ -33,18 +37,21 @@ import java.util.Set;
|
||||
)
|
||||
@Slf4j
|
||||
public class Consume extends Plugin {
|
||||
@Inject
|
||||
@SuppressWarnings("unused")
|
||||
@Inject
|
||||
private Game game;
|
||||
|
||||
@Inject
|
||||
@SuppressWarnings("unused")
|
||||
@Inject
|
||||
private Config config;
|
||||
|
||||
@Inject
|
||||
@SuppressWarnings("unused")
|
||||
@Inject
|
||||
private Calculations calc;
|
||||
|
||||
@Inject
|
||||
private Bank bank;
|
||||
|
||||
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,
|
||||
@ -83,6 +90,7 @@ public class Consume extends Plugin {
|
||||
ItemID.DIVINE_MAGIC_POTION1, ItemID.DIVINE_MAGIC_POTION2, ItemID.DIVINE_MAGIC_POTION3, ItemID.DIVINE_MAGIC_POTION4,
|
||||
ItemID.DIVINE_BATTLEMAGE_POTION1, ItemID.DIVINE_BATTLEMAGE_POTION2, ItemID.DIVINE_BATTLEMAGE_POTION3, ItemID.DIVINE_BATTLEMAGE_POTION4);
|
||||
|
||||
private ScheduledExecutorService executor;
|
||||
private long lastAte;
|
||||
private long lastPot;
|
||||
private int timeout;
|
||||
@ -104,9 +112,10 @@ public class Consume extends Plugin {
|
||||
private long lastRanged;
|
||||
private boolean shouldDrinkMagic;
|
||||
private long lastMagic;
|
||||
private boolean shouldUseSpecial;
|
||||
|
||||
@Provides
|
||||
@SuppressWarnings("unused")
|
||||
@Provides
|
||||
Config provideConfig(ConfigManager configManager) {
|
||||
return configManager.getConfig(Config.class);
|
||||
}
|
||||
@ -114,25 +123,120 @@ public class Consume extends Plugin {
|
||||
@Override
|
||||
protected void startUp() {
|
||||
log.info("Starting Chaos Consume");
|
||||
|
||||
generateNewEatThreshold();
|
||||
generateNewPrayerThreshold();
|
||||
|
||||
executor = Executors.newSingleThreadScheduledExecutor();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() {
|
||||
log.info("Stopping Chaos Consume");
|
||||
|
||||
executor.shutdownNow();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@SuppressWarnings("unused")
|
||||
@Subscribe
|
||||
private void onGameTick(GameTick event) {
|
||||
if (game.client() == null || game.localPlayer() == null || game.client().getGameState() != GameState.LOGGED_IN) return;
|
||||
if (game.client() == null || game.localPlayer() == null || game.client().getGameState() != GameState.LOGGED_IN || bank.isOpen()) return;
|
||||
|
||||
if (timeout > 0) {
|
||||
timeout--;
|
||||
return;
|
||||
}
|
||||
|
||||
if (eatThreshold == 0) generateNewEatThreshold();
|
||||
if (prayerThreshold == 0) generateNewPrayerThreshold();
|
||||
executor.schedule(this::tick, calc.random(50, 80), TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Subscribe
|
||||
private void onVarbitChanged(VarbitChanged event) {
|
||||
if (game.client().getGameState() != GameState.LOGGED_IN) return;
|
||||
|
||||
if (config.drinkAntiPoison()
|
||||
&& event.getIndex() == VarPlayer.POISON.getId()
|
||||
&& game.client().getVarpValue(VarPlayer.POISON.getId()) > 0) {
|
||||
shouldDrinkAntiPoison = true;
|
||||
}
|
||||
|
||||
if (config.useSpecial()
|
||||
&& event.getIndex() == VarPlayer.SPECIAL_ATTACK_PERCENT.getId()
|
||||
&& game.client().getVarpValue(VarPlayer.SPECIAL_ATTACK_PERCENT.getId()) > config.specialCost()) {
|
||||
shouldUseSpecial = true;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Subscribe
|
||||
private void onChatMessage(ChatMessage event) {
|
||||
if (game.client().getGameState() != GameState.LOGGED_IN) return;
|
||||
|
||||
String BURN_MESSAGE = ("You're horribly burnt by the dragon fire!");
|
||||
String BURN_EXPIRE = ("antifire potion is about to expire.");
|
||||
|
||||
String message = event.getMessage();
|
||||
|
||||
if (config.drinkAntiFire() && (message.contains(BURN_MESSAGE) || message.contains(BURN_EXPIRE))) {
|
||||
shouldDrinkAntiFire = true;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Subscribe
|
||||
private void onStatChanged(StatChanged event) {
|
||||
if (game.client().getGameState() != GameState.LOGGED_IN || timeout > 0) return;
|
||||
|
||||
Skill skill = event.getSkill();
|
||||
int level = event.getBoostedLevel();
|
||||
|
||||
checkSkill(skill, level);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Subscribe
|
||||
private void onGameStateChanged(GameStateChanged event) {
|
||||
if (event.getGameState() == GameState.LOGGED_IN) {
|
||||
timeout = 5;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Subscribe
|
||||
private void onConfigChanged(ConfigChanged event) {
|
||||
if (!event.getGroup().equals("chaosconsume")) return;
|
||||
|
||||
switch (event.getKey()) {
|
||||
case "minEatHP":
|
||||
case "maxEatHP":
|
||||
generateNewEatThreshold();
|
||||
break;
|
||||
case "minPrayerPoints":
|
||||
case "maxPrayerPoints":
|
||||
generateNewPrayerThreshold();
|
||||
case "drinkPrayer":
|
||||
checkSkill(Skill.PRAYER);
|
||||
break;
|
||||
case "strengthLevel":
|
||||
checkSkill(Skill.STRENGTH);
|
||||
break;
|
||||
case "attackLevel":
|
||||
checkSkill(Skill.ATTACK);
|
||||
break;
|
||||
case "defenceLevel":
|
||||
checkSkill(Skill.DEFENCE);
|
||||
break;
|
||||
case "rangedLevel":
|
||||
checkSkill(Skill.RANGED);
|
||||
break;
|
||||
case "magicLevel":
|
||||
checkSkill(Skill.MAGIC);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void tick() {
|
||||
|
||||
int hp = game.modifiedLevel(Skill.HITPOINTS);
|
||||
|
||||
@ -160,6 +264,19 @@ public class Consume extends Plugin {
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldUseSpecial && game.client().getVarpValue(VarPlayer.SPECIAL_ATTACK_ENABLED.getId()) == 0) {
|
||||
shouldUseSpecial = false;
|
||||
|
||||
if (game.client().getVar(Varbits.PVP_SPEC_ORB) == 0) {
|
||||
iWidget special = game.widget(WidgetInfo.MINIMAP_SPEC_CLICKBOX);
|
||||
if (special == null) return;
|
||||
|
||||
special.interact(0);
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldDrinkAntiPoison && canPot()) {
|
||||
if (!drinkPotion(ANTI_POISON_IDS) && config.antiPoisonWarnings()) {
|
||||
game.utils.sendGameMessage("Poisoned but you don't have anti-poison!");
|
||||
@ -240,84 +357,6 @@ public class Consume extends Plugin {
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@SuppressWarnings("unused")
|
||||
private void onVarbitChanged(VarbitChanged event) {
|
||||
if (game.client().getGameState() != GameState.LOGGED_IN) return;
|
||||
|
||||
if (config.drinkAntiPoison()
|
||||
&& event.getIndex() == VarPlayer.POISON.getId()
|
||||
&& game.client().getVarpValue(VarPlayer.POISON.getId()) > 0) {
|
||||
shouldDrinkAntiPoison = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@SuppressWarnings("unused")
|
||||
private void onChatMessage(ChatMessage event) {
|
||||
if (game.client().getGameState() != GameState.LOGGED_IN) return;
|
||||
|
||||
String BURN_MESSAGE = ("You're horribly burnt by the dragon fire!");
|
||||
String BURN_EXPIRE = ("antifire potion is about to expire.");
|
||||
|
||||
String message = event.getMessage();
|
||||
|
||||
if (config.drinkAntiFire() && (message.contains(BURN_MESSAGE) || message.contains(BURN_EXPIRE))) {
|
||||
shouldDrinkAntiFire = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@SuppressWarnings("unused")
|
||||
private void onStatChanged(StatChanged event) {
|
||||
if (game.client().getGameState() != GameState.LOGGED_IN || timeout > 0) return;
|
||||
|
||||
Skill skill = event.getSkill();
|
||||
int level = event.getBoostedLevel();
|
||||
|
||||
checkSkill(skill, level);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@SuppressWarnings("unused")
|
||||
private void onGameStateChanged(GameStateChanged event) {
|
||||
if (event.getGameState() == GameState.LOGGED_IN) {
|
||||
timeout = 5;
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@SuppressWarnings("unused")
|
||||
private void onConfigChanged(ConfigChanged event) {
|
||||
switch (event.getKey()) {
|
||||
case "minEatHP":
|
||||
case "maxEatHP":
|
||||
generateNewEatThreshold();
|
||||
break;
|
||||
case "minPrayerPoints":
|
||||
case "maxPrayerPoints":
|
||||
generateNewPrayerThreshold();
|
||||
case "drinkPrayer":
|
||||
checkSkill(Skill.PRAYER);
|
||||
break;
|
||||
case "strengthLevel":
|
||||
checkSkill(Skill.STRENGTH);
|
||||
break;
|
||||
case "attackLevel":
|
||||
checkSkill(Skill.ATTACK);
|
||||
break;
|
||||
case "defenceLevel":
|
||||
checkSkill(Skill.DEFENCE);
|
||||
break;
|
||||
case "rangedLevel":
|
||||
checkSkill(Skill.RANGED);
|
||||
break;
|
||||
case "magicLevel":
|
||||
checkSkill(Skill.MAGIC);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void generateNewEatThreshold() {
|
||||
eatThreshold = calc.random(config.minEatHP(), config.maxEatHP() + 1);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
version = "0.0.1"
|
||||
version = "1.0.0"
|
||||
|
||||
project.extra["PluginName"] = "Chaos Cooker" // This is the name that is used in the external plugin manager panel
|
||||
project.extra["PluginDescription"] = "Cooks better than Gordon Ramsay" // This is the description that is used in the external plugin manager panel
|
||||
|
@ -1,6 +0,0 @@
|
||||
package io.reisub.openosrs.cooker;
|
||||
|
||||
public enum Activity {
|
||||
IDLE,
|
||||
COOKING;
|
||||
}
|
@ -28,7 +28,7 @@ import net.runelite.client.config.Button;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup("ChaosCookerConfig")
|
||||
@ConfigGroup("chaoscooker")
|
||||
|
||||
public interface Config extends net.runelite.client.config.Config {
|
||||
@ConfigItem(
|
||||
|
@ -3,34 +3,23 @@ package io.reisub.openosrs.cooker;
|
||||
import com.google.inject.Provides;
|
||||
import io.reisub.openosrs.cooker.tasks.Cook;
|
||||
import io.reisub.openosrs.cooker.tasks.HandleBank;
|
||||
import io.reisub.openosrs.cooker.tasks.SkipLevel;
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import io.reisub.openosrs.util.CScript;
|
||||
import io.reisub.openosrs.util.Util;
|
||||
import io.reisub.openosrs.util.enums.Activity;
|
||||
import io.reisub.openosrs.util.tasks.Run;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.AnimationID;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.events.AnimationChanged;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.ConfigButtonClicked;
|
||||
import net.runelite.api.events.ItemContainerChanged;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.PluginDependency;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.iutils.iUtils;
|
||||
import net.runelite.client.plugins.iutils.scripts.iScript;
|
||||
import org.pf4j.Extension;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static net.runelite.api.AnimationID.IDLE;
|
||||
|
||||
@Extension
|
||||
@PluginDependency(Util.class)
|
||||
@ -41,14 +30,7 @@ import static net.runelite.api.AnimationID.IDLE;
|
||||
enabledByDefault = false
|
||||
)
|
||||
@Slf4j
|
||||
public class Cooker extends iScript {
|
||||
private List<Task> tasks;
|
||||
|
||||
@Getter
|
||||
private Activity currentActivity;
|
||||
|
||||
private Instant lastActionTime;
|
||||
|
||||
public class Cooker extends CScript {
|
||||
@Inject
|
||||
private Config config;
|
||||
|
||||
@ -57,50 +39,16 @@ public class Cooker extends iScript {
|
||||
return configManager.getConfig(Config.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loop() {
|
||||
for (Task t : tasks) {
|
||||
if (t.validate()) {
|
||||
log.info(t.getStatus());
|
||||
t.execute();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
checkActionTimeout();
|
||||
game.sleepDelay();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
log.info("Starting Chaos Cooker");
|
||||
super.onStart();
|
||||
|
||||
Run runTask = injector.getInstance(Run.class);
|
||||
runTask.setInterval(70, 95);
|
||||
|
||||
tasks = new ArrayList<>();
|
||||
tasks.add(runTask);
|
||||
tasks.add(injector.getInstance(SkipLevel.class));
|
||||
tasks.add(injector.getInstance(HandleBank.class));
|
||||
tasks.add(injector.getInstance(Cook.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
log.info("Stopping Chaos Cooker");
|
||||
if (tasks != null) {
|
||||
tasks.clear();
|
||||
}
|
||||
|
||||
setActivity(Activity.IDLE);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Subscribe
|
||||
private void onConfigButtonPressed(ConfigButtonClicked configButtonClicked) {
|
||||
if (configButtonClicked.getKey().equals("startButton")) {
|
||||
execute();
|
||||
}
|
||||
addTask(HandleBank.class);
|
||||
addTask(Cook.class);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@ -124,36 +72,4 @@ public class Cooker extends iScript {
|
||||
setActivity(Activity.IDLE);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Subscribe
|
||||
private void onChatMessage(ChatMessage chatMessage) {
|
||||
if (chatMessage.getType() == ChatMessageType.GAMEMESSAGE) {
|
||||
if (chatMessage.getMessage().startsWith("Congratulations, you've just advanced your")) {
|
||||
setActivity(Activity.IDLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setActivity(Activity action) {
|
||||
currentActivity = action;
|
||||
|
||||
if (action != Activity.IDLE) {
|
||||
lastActionTime = Instant.now();
|
||||
}
|
||||
}
|
||||
|
||||
private void checkActionTimeout() {
|
||||
if (currentActivity == Activity.IDLE) return;
|
||||
|
||||
int animId = game.localPlayer().animation();
|
||||
if (animId != IDLE || lastActionTime == null) return;
|
||||
|
||||
Duration timeout = Duration.ofSeconds(3);
|
||||
Duration sinceAction = Duration.between(lastActionTime, Instant.now());
|
||||
|
||||
if (sinceAction.compareTo(timeout) >= 0) {
|
||||
setActivity(Activity.IDLE);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
package io.reisub.openosrs.cooker.tasks;
|
||||
|
||||
import io.reisub.openosrs.cooker.Activity;
|
||||
import io.reisub.openosrs.cooker.Config;
|
||||
import io.reisub.openosrs.cooker.Cooker;
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import io.reisub.openosrs.util.enums.Activity;
|
||||
import net.runelite.client.plugins.iutils.game.InventoryItem;
|
||||
import net.runelite.client.plugins.iutils.game.iObject;
|
||||
import net.runelite.client.plugins.iutils.ui.Chatbox;
|
||||
|
@ -1,22 +0,0 @@
|
||||
package io.reisub.openosrs.cooker.tasks;
|
||||
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import net.runelite.client.plugins.iutils.ui.Chatbox;
|
||||
|
||||
public class SkipLevel extends Task {
|
||||
@Override
|
||||
public String getStatus() {
|
||||
return "Skipping level chatbox";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validate() {
|
||||
return chatbox.chatState() == Chatbox.ChatState.LEVEL_UP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
chatbox.continueChats();
|
||||
game.tick();
|
||||
}
|
||||
}
|
52
fighter/fighter.gradle.kts
Normal file
52
fighter/fighter.gradle.kts
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
version = "1.0.0"
|
||||
|
||||
project.extra["PluginName"] = "Chaos Fighter" // This is the name that is used in the external plugin manager panel
|
||||
project.extra["PluginDescription"] = "Wham! Bam! Thank you Ma'am!" // This is the description that is used in the external plugin manager panel
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":util"))
|
||||
}
|
||||
|
||||
tasks {
|
||||
jar {
|
||||
manifest {
|
||||
attributes(mapOf(
|
||||
"Plugin-Version" to project.version,
|
||||
"Plugin-Id" to nameToId(project.extra["PluginName"] as String),
|
||||
"Plugin-Provider" to project.extra["PluginProvider"],
|
||||
"Plugin-Description" to project.extra["PluginDescription"],
|
||||
"Plugin-Dependencies" to
|
||||
arrayOf(
|
||||
nameToId("Chaos Util"),
|
||||
nameToId("iUtils")
|
||||
).joinToString(),
|
||||
"Plugin-License" to project.extra["PluginLicense"]
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
114
fighter/src/main/java/io/reisub/openosrs/fighter/Config.java
Normal file
114
fighter/src/main/java/io/reisub/openosrs/fighter/Config.java
Normal file
@ -0,0 +1,114 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Andrew EP | ElPinche256 <https://github.com/ElPinche256>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package io.reisub.openosrs.fighter;
|
||||
|
||||
import net.runelite.client.config.*;
|
||||
|
||||
@ConfigGroup("chaosfighter")
|
||||
|
||||
public interface Config extends net.runelite.client.config.Config {
|
||||
@ConfigSection(
|
||||
keyName = "targetConfiguration",
|
||||
name = "Target Configuration",
|
||||
description = "Configure target to fight",
|
||||
position = 0
|
||||
)
|
||||
String targetConfiguration = "targetConfiguration";
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "targetNames",
|
||||
name = "Target names",
|
||||
description = "The names of your targets, separated with a semicolon.",
|
||||
section = "targetConfiguration",
|
||||
position = 1
|
||||
)
|
||||
default String targetNames() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "targetIds",
|
||||
name = "Target IDs",
|
||||
description = "The IDs of your targets, separated with a semicolon.",
|
||||
section = "targetConfiguration",
|
||||
position = 2
|
||||
)
|
||||
default String targetIds() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Range(
|
||||
min = 1,
|
||||
max = 64
|
||||
)
|
||||
@ConfigItem(
|
||||
keyName = "searchRadius",
|
||||
name = "Search radius",
|
||||
description = "Search radius in which to search the target NPC.",
|
||||
section = "targetConfiguration",
|
||||
position = 3
|
||||
)
|
||||
default int searchRadius() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "usePathfinding",
|
||||
name = "Use pathfinding",
|
||||
description = "Use pathfinding to find nearest target. This is a lot more expensive CPU-wise but is recommended when fighting in an area with obstacles.",
|
||||
section = "targetConfiguration",
|
||||
position = 4
|
||||
)
|
||||
default boolean usePathfinding() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Range(
|
||||
min = 1,
|
||||
max = 64
|
||||
)
|
||||
@ConfigItem(
|
||||
keyName = "pathfindingSearchRadius",
|
||||
name = "Pathfinding search radius",
|
||||
description = "Search radius in which to search the target NPC using pathfinding. Be careful, setting this too high will freeze the game. If no NPC is found within the pathfinding radius it will fall back to the non-pathfinding radius.",
|
||||
section = "targetConfiguration",
|
||||
hidden = true,
|
||||
unhide = "usePathfinding",
|
||||
position = 5
|
||||
)
|
||||
default int pathfindingSearchRadius() {
|
||||
return 8;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "startButton",
|
||||
name = "Start/Stop",
|
||||
description = "Start the script",
|
||||
position = 100
|
||||
)
|
||||
default Button startButton() {
|
||||
return new Button();
|
||||
}
|
||||
}
|
116
fighter/src/main/java/io/reisub/openosrs/fighter/Fighter.java
Normal file
116
fighter/src/main/java/io/reisub/openosrs/fighter/Fighter.java
Normal file
@ -0,0 +1,116 @@
|
||||
package io.reisub.openosrs.fighter;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import io.reisub.openosrs.util.CScript;
|
||||
import io.reisub.openosrs.util.Util;
|
||||
import io.reisub.openosrs.util.tasks.Run;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.events.ActorDeath;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.plugins.PluginDependency;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.iutils.game.iNPC;
|
||||
import net.runelite.client.plugins.iutils.iUtils;
|
||||
import org.pf4j.Extension;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@Extension
|
||||
@PluginDependency(Util.class)
|
||||
@PluginDependency(iUtils.class)
|
||||
@PluginDescriptor(
|
||||
name = "Chaos Fighter",
|
||||
description = "Wham! Bam! Thank you Ma'am!",
|
||||
enabledByDefault = false
|
||||
)
|
||||
@Slf4j
|
||||
public class Fighter extends CScript {
|
||||
@Inject
|
||||
@Getter
|
||||
private Config config;
|
||||
|
||||
@Provides
|
||||
Config provideConfig(ConfigManager configManager) {
|
||||
return configManager.getConfig(Config.class);
|
||||
}
|
||||
|
||||
@Getter
|
||||
private String[] targetNames;
|
||||
|
||||
@Getter
|
||||
private int[] targetIds;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private iNPC currentTarget;
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
||||
parseTargets();
|
||||
|
||||
Run runTask = injector.getInstance(Run.class);
|
||||
runTask.setInterval(70, 95);
|
||||
tasks.add(runTask);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Subscribe
|
||||
private void onConfigChanged(ConfigChanged event) {
|
||||
if (!event.getGroup().equals("chaosfighter")) return;
|
||||
|
||||
if (event.getKey().equals("targetNames") || event.getKey().equals("targetIds")) {
|
||||
parseTargets();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Subscribe
|
||||
private void onActorDeath(ActorDeath event) {
|
||||
if (!(event.getActor() instanceof NPC)) return;
|
||||
|
||||
NPC actor = (NPC) event.getActor();
|
||||
|
||||
if (actor.getIndex() == currentTarget.index()) {
|
||||
log.info("Our target died");
|
||||
currentTarget = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void parseTargets() {
|
||||
if (!config.targetIds().equals("")) {
|
||||
String[] rawTargetIds = config.targetIds().split(";");
|
||||
targetIds = new int[rawTargetIds.length];
|
||||
int i = 0;
|
||||
|
||||
for (String id : rawTargetIds) {
|
||||
try {
|
||||
targetIds[i++] = Integer.parseInt(id.trim());
|
||||
} catch (NumberFormatException e) {
|
||||
log.error("Error parsing target ID: " + id.trim());
|
||||
targetIds[i-1] = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
targetIds = new int[0];
|
||||
}
|
||||
|
||||
if (!config.targetNames().equals("")) {
|
||||
String[] rawTargetNames = config.targetNames().split(";");
|
||||
targetNames = new String[rawTargetNames.length];
|
||||
int i = 0;
|
||||
|
||||
for (String name : rawTargetNames) {
|
||||
targetNames[i++] = name.trim();
|
||||
}
|
||||
} else {
|
||||
targetNames = new String[0];
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package io.reisub.openosrs.fighter.tasks;
|
||||
|
||||
import io.reisub.openosrs.fighter.Fighter;
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import io.reisub.openosrs.util.enums.Activity;
|
||||
import net.runelite.client.plugins.iutils.actor.NpcStream;
|
||||
import net.runelite.client.plugins.iutils.game.iNPC;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class Fight extends Task {
|
||||
@Inject
|
||||
private Fighter plugin;
|
||||
|
||||
@Override
|
||||
public String getStatus() {
|
||||
return "Fighting";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validate() {
|
||||
if (plugin.getCurrentActivity() != Activity.IDLE) return false;
|
||||
|
||||
NpcStream idStream = game.npcs().withId(plugin.getTargetIds()).withoutTarget();
|
||||
NpcStream nameStream = game.npcs().withName(plugin.getTargetNames()).withoutTarget();
|
||||
|
||||
NpcStream targetStream = (NpcStream) Stream.concat(idStream, nameStream);
|
||||
|
||||
if (plugin.getConfig().usePathfinding()) {
|
||||
plugin.setCurrentTarget(targetStream.within(plugin.getConfig().pathfindingSearchRadius()).nearestPath());
|
||||
}
|
||||
|
||||
if (plugin.getCurrentActivity() == null) {
|
||||
plugin.setCurrentTarget(targetStream.within(plugin.getConfig().searchRadius()).nearest());
|
||||
}
|
||||
|
||||
return plugin.getCurrentTarget() != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
if (plugin.getCurrentTarget() == null) return;
|
||||
|
||||
plugin.getCurrentTarget().interact(0);
|
||||
game.waitUntil(() -> game.localPlayer().target() != null && game.localPlayer().target().name().equals(plugin.getCurrentTarget().name()), 15);
|
||||
}
|
||||
}
|
@ -23,7 +23,7 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
version = "0.0.1"
|
||||
version = "1.0.0"
|
||||
|
||||
project.extra["PluginName"] = "Chaos Fisher" // This is the name that is used in the external plugin manager panel
|
||||
project.extra["PluginDescription"] = "Frantically fishes fish" // This is the description that is used in the external plugin manager panel
|
||||
|
@ -25,13 +25,12 @@
|
||||
package io.reisub.openosrs.fisher;
|
||||
|
||||
import net.runelite.client.config.Button;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup("ChaosFisherConfig")
|
||||
@ConfigGroup("chaosfisher")
|
||||
|
||||
public interface FisherConfig extends Config {
|
||||
public interface Config extends net.runelite.client.config.Config {
|
||||
@ConfigItem(
|
||||
keyName = "startButton",
|
||||
name = "Start/Stop",
|
37
fisher/src/main/java/io/reisub/openosrs/fisher/Fisher.java
Normal file
37
fisher/src/main/java/io/reisub/openosrs/fisher/Fisher.java
Normal file
@ -0,0 +1,37 @@
|
||||
package io.reisub.openosrs.fisher;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import io.reisub.openosrs.fisher.tasks.Drop;
|
||||
import io.reisub.openosrs.fisher.tasks.Fish;
|
||||
import io.reisub.openosrs.util.CScript;
|
||||
import io.reisub.openosrs.util.Util;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.plugins.PluginDependency;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.iutils.iUtils;
|
||||
import org.pf4j.Extension;
|
||||
|
||||
@Extension
|
||||
@PluginDependency(Util.class)
|
||||
@PluginDependency(iUtils.class)
|
||||
@PluginDescriptor(
|
||||
name = "Chaos Fisher",
|
||||
description = "Frantically fishes fish",
|
||||
enabledByDefault = false
|
||||
)
|
||||
@Slf4j
|
||||
public class Fisher extends CScript {
|
||||
@Provides
|
||||
Config provideConfig(ConfigManager configManager) {
|
||||
return configManager.getConfig(Config.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
||||
addTask(Drop.class);
|
||||
addTask(Fish.class);
|
||||
}
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
package io.reisub.openosrs.fisher;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import io.reisub.openosrs.fisher.tasks.Drop;
|
||||
import io.reisub.openosrs.fisher.tasks.Fish;
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import io.reisub.openosrs.util.Util;
|
||||
import io.reisub.openosrs.util.tasks.KittenTask;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.ConfigButtonClicked;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.PluginDependency;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.iutils.iUtils;
|
||||
import net.runelite.client.plugins.iutils.scripts.iScript;
|
||||
import org.pf4j.Extension;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Extension
|
||||
@PluginDependency(Util.class)
|
||||
@PluginDependency(iUtils.class)
|
||||
@PluginDescriptor(
|
||||
name = "Chaos Fisher",
|
||||
description = "Frantically fishes fish",
|
||||
enabledByDefault = false
|
||||
)
|
||||
@Slf4j
|
||||
public class FisherPlugin extends iScript {
|
||||
private List<Task> tasks;
|
||||
|
||||
private KittenTask kittenTask;
|
||||
|
||||
@Provides
|
||||
FisherConfig provideConfig(ConfigManager configManager) {
|
||||
return configManager.getConfig(FisherConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loop() {
|
||||
for (Task t : tasks) {
|
||||
if (t.validate()) {
|
||||
log.info(t.getStatus());
|
||||
t.execute();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
game.sleepDelay();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
log.info("Starting Chaos Fisher");
|
||||
|
||||
kittenTask = KittenTask.getInstance(injector);
|
||||
|
||||
tasks = new ArrayList<>();
|
||||
tasks.add(kittenTask);
|
||||
tasks.add(injector.getInstance(Drop.class));
|
||||
tasks.add(injector.getInstance(Fish.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
log.info("Stopping Chaos Fisher");
|
||||
if (tasks != null) {
|
||||
tasks.clear();
|
||||
}
|
||||
|
||||
KittenTask.handleKitten = false;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onConfigButtonPressed(ConfigButtonClicked configButtonClicked) {
|
||||
if (configButtonClicked.getKey().equals("startButton")) {
|
||||
execute();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onChatMessage(ChatMessage chatMessage) {
|
||||
if (kittenTask != null) {
|
||||
kittenTask.onChatMessage(chatMessage);
|
||||
}
|
||||
}
|
||||
}
|
@ -3,14 +3,8 @@ package io.reisub.openosrs.fisher.tasks;
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import net.runelite.client.plugins.iutils.game.iNPC;
|
||||
import net.runelite.client.plugins.iutils.scene.Position;
|
||||
import net.runelite.client.plugins.iutils.ui.Bank;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class DoBank extends Task {
|
||||
@Inject
|
||||
public Bank bank;
|
||||
|
||||
public class HandleBank extends Task {
|
||||
@Override
|
||||
public String getStatus() {
|
||||
return "Banking";
|
@ -4,9 +4,9 @@ import com.google.inject.Provides;
|
||||
import io.reisub.openosrs.glassblower.tasks.Blow;
|
||||
import io.reisub.openosrs.glassblower.tasks.HandleBank;
|
||||
import io.reisub.openosrs.glassblower.tasks.PickupSeed;
|
||||
import io.reisub.openosrs.util.enums.Activity;
|
||||
import io.reisub.openosrs.util.CScript;
|
||||
import io.reisub.openosrs.util.Util;
|
||||
import io.reisub.openosrs.util.enums.Activity;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.AnimationID;
|
||||
import net.runelite.api.GameState;
|
||||
|
@ -2,8 +2,8 @@ package io.reisub.openosrs.glassblower.tasks;
|
||||
|
||||
import io.reisub.openosrs.glassblower.Config;
|
||||
import io.reisub.openosrs.glassblower.Glassblower;
|
||||
import io.reisub.openosrs.util.enums.Activity;
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import io.reisub.openosrs.util.enums.Activity;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.client.plugins.iutils.game.InventoryItem;
|
||||
import net.runelite.client.plugins.iutils.game.iObject;
|
||||
@ -47,6 +47,8 @@ public class Blow extends Task {
|
||||
game.tick();
|
||||
}
|
||||
|
||||
if (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();
|
||||
if (pipe == null || moltenGlass == null) return;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.reisub.openosrs.glassblower.tasks;
|
||||
|
||||
import io.reisub.openosrs.glassblower.Glassblower;
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.client.plugins.iutils.game.iGroundItem;
|
||||
@ -23,6 +24,7 @@ public class PickupSeed extends Task {
|
||||
int quantity = game.inventory().withId(ItemID.SEAWEED_SPORE).quantity();
|
||||
|
||||
item.interact("Take");
|
||||
game.waitUntil(() -> game.inventory().withId(ItemID.SEAWEED_SPORE).quantity() > quantity, 30);
|
||||
game.waitUntil(() -> game.inventory().withId(ItemID.SEAWEED_SPORE).quantity() > quantity
|
||||
|| (game.localPlayer() != null && game.localPlayer().position().regionID() == Glassblower.FOSSIL_ISLAND_SMALL_ISLAND_REGION), 30);
|
||||
}
|
||||
}
|
||||
|
52
herblore/herblore.gradle.kts
Normal file
52
herblore/herblore.gradle.kts
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
version = "1.0.0"
|
||||
|
||||
project.extra["PluginName"] = "Chaos Herblore" // This is the name that is used in the external plugin manager panel
|
||||
project.extra["PluginDescription"] = "You put the lime in the coconut, you drank them both up" // This is the description that is used in the external plugin manager panel
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":util"))
|
||||
}
|
||||
|
||||
tasks {
|
||||
jar {
|
||||
manifest {
|
||||
attributes(mapOf(
|
||||
"Plugin-Version" to project.version,
|
||||
"Plugin-Id" to nameToId(project.extra["PluginName"] as String),
|
||||
"Plugin-Provider" to project.extra["PluginProvider"],
|
||||
"Plugin-Description" to project.extra["PluginDescription"],
|
||||
"Plugin-Dependencies" to
|
||||
arrayOf(
|
||||
nameToId("Chaos Util"),
|
||||
nameToId("iUtils")
|
||||
).joinToString(),
|
||||
"Plugin-License" to project.extra["PluginLicense"]
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Andrew EP | ElPinche256 <https://github.com/ElPinche256>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package io.reisub.openosrs.herblore;
|
||||
|
||||
import net.runelite.client.config.Button;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup("chaosherblore")
|
||||
|
||||
public interface Config extends net.runelite.client.config.Config {
|
||||
@ConfigItem(
|
||||
keyName = "herbloreTask",
|
||||
name = "Task",
|
||||
description = "Select what to do.",
|
||||
position = 0
|
||||
)
|
||||
default HerbloreTask herbloreTask() { return HerbloreTask.CLEAN_HERBS; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "quantity",
|
||||
name = "Quantity",
|
||||
description = "Choose how many herbs to clean or potions to make. 0 is unlimited and will work until you're out of materials.",
|
||||
position = 1
|
||||
)
|
||||
default int quantity() { return 0; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "herbType",
|
||||
name = "Herb type",
|
||||
description = "Select which herbs to clean or make unfinished potions with.",
|
||||
position = 2
|
||||
)
|
||||
default Herb herbType() { return Herb.ALL; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "makePotion",
|
||||
name = "Potion",
|
||||
description = "Select which potions to make.",
|
||||
position = 3
|
||||
)
|
||||
default Potion makePotion() { return Potion.SUPER_STRENGTH; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "startButton",
|
||||
name = "Start/Stop",
|
||||
description = "Start the script",
|
||||
position = 100
|
||||
)
|
||||
default Button startButton() {
|
||||
return new Button();
|
||||
}
|
||||
}
|
53
herblore/src/main/java/io/reisub/openosrs/herblore/Herb.java
Normal file
53
herblore/src/main/java/io/reisub/openosrs/herblore/Herb.java
Normal file
@ -0,0 +1,53 @@
|
||||
package io.reisub.openosrs.herblore;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.ItemID;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum Herb {
|
||||
ALL(-1, -1, -1),
|
||||
GUAM_LEAF(ItemID.GRIMY_GUAM_LEAF, ItemID.GUAM_LEAF, ItemID.GUAM_POTION_UNF),
|
||||
MARRENTILL(ItemID.GRIMY_MARRENTILL, ItemID.MARRENTILL, ItemID.MARRENTILL_POTION_UNF),
|
||||
TARROMIN(ItemID.GRIMY_TARROMIN, ItemID.TARROMIN, ItemID.TARROMIN_POTION_UNF),
|
||||
HARRALANDER(ItemID.GRIMY_HARRALANDER, ItemID.HARRALANDER, ItemID.HARRALANDER_POTION_UNF),
|
||||
RANARR_WEED(ItemID.GRIMY_RANARR_WEED, ItemID.RANARR_WEED, ItemID.RANARR_POTION_UNF),
|
||||
TOADFLAX(ItemID.GRIMY_TOADFLAX, ItemID.TOADFLAX, ItemID.TOADFLAX_POTION_UNF),
|
||||
IRIT_LEAF(ItemID.GRIMY_IRIT_LEAF, ItemID.IRIT_LEAF, ItemID.IRIT_POTION_UNF),
|
||||
AVANTOE(ItemID.GRIMY_AVANTOE, ItemID.AVANTOE, ItemID.AVANTOE_POTION_UNF),
|
||||
KWUARM(ItemID.GRIMY_KWUARM, ItemID.KWUARM, ItemID.KWUARM_POTION_UNF),
|
||||
SNAPDRAGON(ItemID.GRIMY_SNAPDRAGON, ItemID.SNAPDRAGON, ItemID.SNAPDRAGON_POTION_UNF),
|
||||
CADANTINE(ItemID.GRIMY_CADANTINE, ItemID.CADANTINE, ItemID.CADANTINE_POTION_UNF),
|
||||
LANTADYME(ItemID.GRIMY_LANTADYME, ItemID.LANTADYME, ItemID.LANTADYME_POTION_UNF),
|
||||
DWARF_WEED(ItemID.GRIMY_DWARF_WEED, ItemID.DWARF_WEED, ItemID.DWARF_WEED_POTION_UNF),
|
||||
TORSTOL(ItemID.GRIMY_TORSTOL, ItemID.TORSTOL, ItemID.TORSTOL_POTION_UNF);
|
||||
|
||||
private final int grimyId;
|
||||
private final int cleanId;
|
||||
private final int unfinishedId;
|
||||
|
||||
public static int[] getAllGrimyIds() {
|
||||
final int[] ids = new int[Herb.values().length-1];
|
||||
int i = 0;
|
||||
|
||||
for (Herb herb : Herb.values()) {
|
||||
if (herb == Herb.ALL) continue;
|
||||
ids[i++] = herb.getGrimyId();
|
||||
}
|
||||
|
||||
return ids;
|
||||
}
|
||||
|
||||
public static int[] getAllCleanIds() {
|
||||
final int[] ids = new int[Herb.values().length-1];
|
||||
int i = 0;
|
||||
|
||||
for (Herb herb : Herb.values()) {
|
||||
if (herb == Herb.ALL) continue;
|
||||
ids[i++] = herb.getCleanId();
|
||||
}
|
||||
|
||||
return ids;
|
||||
}
|
||||
}
|
149
herblore/src/main/java/io/reisub/openosrs/herblore/Herblore.java
Normal file
149
herblore/src/main/java/io/reisub/openosrs/herblore/Herblore.java
Normal file
@ -0,0 +1,149 @@
|
||||
package io.reisub.openosrs.herblore;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import io.reisub.openosrs.herblore.tasks.Clean;
|
||||
import io.reisub.openosrs.herblore.tasks.HandleBank;
|
||||
import io.reisub.openosrs.herblore.tasks.MakePotion;
|
||||
import io.reisub.openosrs.herblore.tasks.MakeUnfinished;
|
||||
import io.reisub.openosrs.util.CScript;
|
||||
import io.reisub.openosrs.util.Util;
|
||||
import io.reisub.openosrs.util.enums.Activity;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.events.ItemContainerChanged;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.PluginDependency;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.iutils.iUtils;
|
||||
import org.pf4j.Extension;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@Extension
|
||||
@PluginDependency(Util.class)
|
||||
@PluginDependency(iUtils.class)
|
||||
@PluginDescriptor(
|
||||
name = "Chaos Herblore",
|
||||
description = "You put the lime in the coconut, you drank them both up",
|
||||
enabledByDefault = false
|
||||
)
|
||||
@Slf4j
|
||||
public class Herblore extends CScript {
|
||||
@Inject
|
||||
private Config config;
|
||||
|
||||
@Provides
|
||||
Config provideConfig(ConfigManager configManager) {
|
||||
return configManager.getConfig(Config.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
||||
idleCheckInventoryChange = true;
|
||||
|
||||
addTask(Clean.class);
|
||||
addTask(MakeUnfinished.class);
|
||||
addTask(MakePotion.class);
|
||||
addTask(HandleBank.class);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Subscribe
|
||||
private void onItemContainerChanged(ItemContainerChanged event) {
|
||||
if (!isLoggedIn() || event.getItemContainer() != game.client().getItemContainer(InventoryID.INVENTORY)) return;
|
||||
|
||||
int grimyHerbs = (int) game.inventory().withId(getGrimyHerbIds()).count();
|
||||
int cleanHerbs = (int) game.inventory().withId(getCleanHerbIds()).count();
|
||||
int bases = (int) game.inventory().withId(getBaseIds()).count();
|
||||
|
||||
if (grimyHerbs == 0 && currentActivity == Activity.CLEANING_HERBS) {
|
||||
setActivity(Activity.IDLE);
|
||||
} else if (cleanHerbs == 0 && currentActivity == Activity.CREATING_UNFINISHED_POTIONS) {
|
||||
setActivity(Activity.IDLE);
|
||||
} else if (bases == 0 && currentActivity == Activity.CREATING_POTIONS) {
|
||||
setActivity(Activity.IDLE);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean shouldClean() {
|
||||
HerbloreTask task = config.herbloreTask();
|
||||
|
||||
return task == HerbloreTask.CLEAN_HERBS
|
||||
|| task == HerbloreTask.CLEAN_HERBS_AND_MAKE_UNFINISHED
|
||||
|| task == HerbloreTask.CLEAN_HERBS_AND_MAKE_UNFINISHED_AND_MAKE_POTION;
|
||||
}
|
||||
|
||||
public boolean shouldMakeUnfinished() {
|
||||
HerbloreTask task = config.herbloreTask();
|
||||
|
||||
return task == HerbloreTask.MAKE_UNFINISHED
|
||||
|| task == HerbloreTask.CLEAN_HERBS_AND_MAKE_UNFINISHED
|
||||
|| task == HerbloreTask.MAKE_UNFINISHED_AND_MAKE_POTION
|
||||
|| task == HerbloreTask.CLEAN_HERBS_AND_MAKE_UNFINISHED_AND_MAKE_POTION;
|
||||
}
|
||||
|
||||
public boolean shouldMakePotion() {
|
||||
HerbloreTask task = config.herbloreTask();
|
||||
|
||||
return task == HerbloreTask.MAKE_POTION
|
||||
|| task == HerbloreTask.MAKE_UNFINISHED_AND_MAKE_POTION
|
||||
|| task == HerbloreTask.CLEAN_HERBS_AND_MAKE_UNFINISHED_AND_MAKE_POTION;
|
||||
}
|
||||
|
||||
public Herb getHerb() {
|
||||
Herb herb;
|
||||
|
||||
if (shouldMakePotion()) {
|
||||
herb = config.makePotion().getHerb();
|
||||
} else {
|
||||
herb = config.herbType();
|
||||
}
|
||||
|
||||
return herb;
|
||||
}
|
||||
|
||||
public int[] getGrimyHerbIds() {
|
||||
Herb herb = getHerb();
|
||||
|
||||
if (herb == null) {
|
||||
return new int[]{};
|
||||
} else if (herb == Herb.ALL) {
|
||||
return Herb.getAllGrimyIds();
|
||||
} else {
|
||||
return new int[]{ herb.getGrimyId() };
|
||||
}
|
||||
}
|
||||
|
||||
public int[] getCleanHerbIds() {
|
||||
Herb herb = getHerb();
|
||||
|
||||
if (herb == null) {
|
||||
return new int[]{};
|
||||
} else if (herb == Herb.ALL) {
|
||||
return Herb.getAllCleanIds();
|
||||
} else {
|
||||
return new int[]{ herb.getCleanId() };
|
||||
}
|
||||
}
|
||||
|
||||
public int[] getBaseIds() {
|
||||
Potion potion = config.makePotion();
|
||||
|
||||
if (potion.getHerb() == null || potion.getSecondaryId() == -1) {
|
||||
return new int[]{ potion.getPotionBaseId() };
|
||||
} else {
|
||||
return new int[]{ potion.getHerb().getUnfinishedId() };
|
||||
}
|
||||
}
|
||||
|
||||
public int[] getSecondaryIds() {
|
||||
if (config.makePotion().getSecondaryId() == -1) {
|
||||
return new int[]{ config.makePotion().getHerb().getCleanId() };
|
||||
} else {
|
||||
return new int[]{ config.makePotion().getSecondaryId() };
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package io.reisub.openosrs.herblore;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum HerbloreTask {
|
||||
CLEAN_HERBS,
|
||||
MAKE_UNFINISHED,
|
||||
MAKE_POTION,
|
||||
CLEAN_HERBS_AND_MAKE_UNFINISHED,
|
||||
MAKE_UNFINISHED_AND_MAKE_POTION,
|
||||
CLEAN_HERBS_AND_MAKE_UNFINISHED_AND_MAKE_POTION;
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package io.reisub.openosrs.herblore;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.ItemID;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum Potion {
|
||||
ATTACK_POTION(ItemID.VIAL_OF_WATER, Herb.GUAM_LEAF, ItemID.EYE_OF_NEWT),
|
||||
ANTIPOISON(ItemID.VIAL_OF_WATER, Herb.MARRENTILL, ItemID.UNICORN_HORN_DUST),
|
||||
STRENGTH_POTION(ItemID.VIAL_OF_WATER, Herb.TARROMIN, ItemID.LIMPWURT_ROOT),
|
||||
COMPOST_POTION(ItemID.VIAL_OF_WATER, Herb.HARRALANDER, ItemID.VOLCANIC_ASH),
|
||||
RESTORE_POTION(ItemID.VIAL_OF_WATER, Herb.HARRALANDER, ItemID.RED_SPIDERS_EGGS),
|
||||
ENERGY_POTION(ItemID.VIAL_OF_WATER, Herb.HARRALANDER, ItemID.CHOCOLATE_DUST),
|
||||
DEFENCE_POTION(ItemID.VIAL_OF_WATER, Herb.RANARR_WEED, ItemID.WHITE_BERRIES),
|
||||
AGILITY_POTION(ItemID.VIAL_OF_WATER, Herb.TOADFLAX, ItemID.TOADS_LEGS),
|
||||
COMBAT_POTION(ItemID.VIAL_OF_WATER, Herb.HARRALANDER, ItemID.GOAT_HORN_DUST),
|
||||
PRAYER_POTION(ItemID.VIAL_OF_WATER, Herb.RANARR_WEED, ItemID.SNAPE_GRASS),
|
||||
SUPER_ATTACK(ItemID.VIAL_OF_WATER, Herb.IRIT_LEAF, ItemID.EYE_OF_NEWT),
|
||||
SUPERANTIPOISON(ItemID.VIAL_OF_WATER, Herb.IRIT_LEAF, ItemID.UNICORN_HORN_DUST),
|
||||
FISHING_POTION(ItemID.VIAL_OF_WATER, Herb.AVANTOE, ItemID.SNAPE_GRASS),
|
||||
SUPER_ENERGY(ItemID.VIAL_OF_WATER, Herb.AVANTOE, ItemID.MORT_MYRE_FUNGUS),
|
||||
HUNTER_POTION(ItemID.VIAL_OF_WATER, Herb.AVANTOE, ItemID.KEBBIT_TEETH_DUST),
|
||||
SUPER_STRENGTH(ItemID.VIAL_OF_WATER, Herb.KWUARM, ItemID.LIMPWURT_ROOT),
|
||||
WEAPON_POISON(ItemID.VIAL_OF_WATER, Herb.KWUARM, ItemID.DRAGON_SCALE_DUST),
|
||||
SUPER_RESTORE(ItemID.VIAL_OF_WATER, Herb.SNAPDRAGON, ItemID.RED_SPIDERS_EGGS),
|
||||
SUPER_DEFENCE(ItemID.VIAL_OF_WATER, Herb.CADANTINE, ItemID.WHITE_BERRIES),
|
||||
ANTIDOTE_PLUS(ItemID.COCONUT_MILK, Herb.TOADFLAX, ItemID.YEW_ROOTS),
|
||||
ANTIFIRE_POTION(ItemID.VIAL_OF_WATER, Herb.LANTADYME, ItemID.DRAGON_SCALE_DUST),
|
||||
DIVINE_SUPER_ATTACK_POTION(ItemID.SUPER_ATTACK4, null, ItemID.CRYSTAL_DUST),
|
||||
DIVINE_SUPER_DEFENCE_POTION(ItemID.SUPER_DEFENCE4, null, ItemID.CRYSTAL_DUST),
|
||||
DIVINE_SUPER_STRENGTH_POTION(ItemID.SUPER_STRENGTH4, null, ItemID.CRYSTAL_DUST),
|
||||
RANGING_POTION(ItemID.VIAL_OF_WATER, Herb.DWARF_WEED, ItemID.WINE_OF_ZAMORAK),
|
||||
DIVINE_RANGING_POTION(ItemID.RANGING_POTION4, null, ItemID.CRYSTAL_DUST),
|
||||
MAGIC_POTION(ItemID.VIAL_OF_WATER, Herb.LANTADYME, ItemID.POTATO_CACTUS),
|
||||
STAMINA_POTION(ItemID.SUPER_ENERGY4, null, ItemID.AMYLASE_CRYSTAL),
|
||||
ZAMORAK_BREW(ItemID.VIAL_OF_WATER, Herb.TORSTOL, ItemID.JANGERBERRIES),
|
||||
DIVINE_MAGIC_POTION(ItemID.MAGIC_POTION4, null, ItemID.CRYSTAL_DUST),
|
||||
ANTIDOTE_PLUS_PLUS(ItemID.COCONUT_MILK, Herb.IRIT_LEAF, ItemID.MAGIC_ROOTS),
|
||||
BASTION_POTION(ItemID.VIAL_OF_BLOOD, Herb.CADANTINE, ItemID.WINE_OF_ZAMORAK),
|
||||
BATTLEMAGE_POTION(ItemID.VIAL_OF_BLOOD, Herb.CADANTINE, ItemID.POTATO_CACTUS),
|
||||
SARADOMIN_BREW(ItemID.VIAL_OF_WATER, Herb.TOADFLAX, ItemID.CRUSHED_NEST),
|
||||
EXTENDED_ANTIFIRE(ItemID.ANTIFIRE_POTION4, null, ItemID.LAVA_SCALE_SHARD),
|
||||
ANCIENT_BREW(ItemID.VIAL_OF_WATER, Herb.DWARF_WEED, ItemID.NIHIL_DUST),
|
||||
DIVINE_BASTION_POTION(ItemID.BASTION_POTION4, null, ItemID.CRYSTAL_DUST),
|
||||
DIVINE_BATTLEMAGE_POTION(ItemID.BATTLEMAGE_POTION4, null, ItemID.CRYSTAL_DUST),
|
||||
ANTI_VENOM(ItemID.ANTIDOTE4_5952, null, ItemID.ZULRAHS_SCALES),
|
||||
//SUPER_COMBAT_POTION(),
|
||||
SUPER_ANTIFIRE_POTION(ItemID.ANTIFIRE_POTION4, null, ItemID.CRUSHED_SUPERIOR_DRAGON_BONES),
|
||||
ANTI_VENOM_PLUS(ItemID.ANTIVENOM4, Herb.TORSTOL, -1),
|
||||
DIVINE_SUPER_COMBAT_POTION(ItemID.SUPER_COMBAT_POTION4, null, ItemID.CRYSTAL_DUST),
|
||||
EXTENDED_SUPER_ANTIFIRE(ItemID.SUPER_ANTIFIRE_POTION4, null, ItemID.LAVA_SCALE_SHARD);
|
||||
|
||||
private final int potionBaseId;
|
||||
private final Herb herb;
|
||||
private final int secondaryId;
|
||||
|
||||
public int getQuantity() {
|
||||
if (herb == null || secondaryId == -1) {
|
||||
return 14;
|
||||
} else {
|
||||
return 9;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package io.reisub.openosrs.herblore.tasks;
|
||||
|
||||
import io.reisub.openosrs.herblore.Herblore;
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import io.reisub.openosrs.util.enums.Activity;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class Clean extends Task {
|
||||
@Inject
|
||||
private Herblore plugin;
|
||||
|
||||
@Override
|
||||
public String getStatus() {
|
||||
return "Cleaning herbs";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validate() {
|
||||
return plugin.shouldClean()
|
||||
&& plugin.getCurrentActivity() == Activity.IDLE
|
||||
&& game.inventory().withId(plugin.getGrimyHerbIds()).exists();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
plugin.setActivity(Activity.CLEANING_HERBS);
|
||||
|
||||
game.inventory().withId(plugin.getGrimyHerbIds()).forEach((herb) -> herb.interact("Clean"));
|
||||
game.tick();
|
||||
}
|
||||
}
|
@ -0,0 +1,156 @@
|
||||
package io.reisub.openosrs.herblore.tasks;
|
||||
|
||||
import io.reisub.openosrs.herblore.Config;
|
||||
import io.reisub.openosrs.herblore.Herblore;
|
||||
import io.reisub.openosrs.herblore.Potion;
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import io.reisub.openosrs.util.enums.Activity;
|
||||
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 {
|
||||
@Inject
|
||||
private Herblore plugin;
|
||||
|
||||
@Inject
|
||||
private Config config;
|
||||
|
||||
private Instant lastBanking = Instant.EPOCH;
|
||||
|
||||
@Override
|
||||
public String getStatus() {
|
||||
return "Banking";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validate() {
|
||||
return plugin.getCurrentActivity() == Activity.IDLE
|
||||
& Duration.between(lastBanking, Instant.now()).getSeconds() > 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
if (!bank.isOpen()) {
|
||||
iObject bankObj = game.objects().withName("Bank chest", "Bank booth", "Bank Chest-wreck").nearest();
|
||||
if (bankObj == null) return;
|
||||
|
||||
if (bankObj.actions().contains("Bank")) {
|
||||
bankObj.interact("Bank");
|
||||
} else {
|
||||
bankObj.interact(0);
|
||||
}
|
||||
|
||||
game.waitUntil(() -> bank.isOpen(), 15);
|
||||
}
|
||||
|
||||
if (game.inventory().all().size() > 0) {
|
||||
bank.depositInventory();
|
||||
game.sleepDelay();
|
||||
}
|
||||
|
||||
if (plugin.shouldClean() && plugin.shouldMakeUnfinished() && plugin.shouldMakePotion()) {
|
||||
int quantity = withdraw(new int[]{config.makePotion().getPotionBaseId()}, 9);
|
||||
if (quantity == 0) {
|
||||
plugin.stop("Out of potion bases, stopping plugin.");
|
||||
}
|
||||
|
||||
quantity = withdraw(plugin.getGrimyHerbIds(), 9);
|
||||
|
||||
if (quantity < 9) {
|
||||
quantity = withdraw(plugin.getCleanHerbIds(), 9);
|
||||
}
|
||||
|
||||
if (quantity == 0) {
|
||||
plugin.stop("Out of herbs, stopping plugin.");
|
||||
}
|
||||
|
||||
quantity = withdraw(plugin.getSecondaryIds(), 9);
|
||||
if (quantity == 0) {
|
||||
plugin.stop("Out of secondaries, stopping plugin.");
|
||||
}
|
||||
} else if (plugin.shouldClean() && plugin.shouldMakeUnfinished()) {
|
||||
if (bank.quantity(ItemID.VIAL_OF_WATER) == 0) {
|
||||
plugin.stop("Out of vials, stopping plugin.");
|
||||
}
|
||||
|
||||
bank.withdraw(ItemID.VIAL_OF_WATER, 14, false);
|
||||
game.sleepDelay();
|
||||
|
||||
int quantity = withdraw(plugin.getGrimyHerbIds(), 14);
|
||||
|
||||
if (quantity < 14) {
|
||||
quantity = withdraw(plugin.getCleanHerbIds(), 14);
|
||||
}
|
||||
|
||||
if (quantity == 0) {
|
||||
plugin.stop("Out of herbs, stopping plugin.");
|
||||
}
|
||||
} else if (plugin.shouldClean()) {
|
||||
int quantity = withdraw(plugin.getGrimyHerbIds(), 28);
|
||||
|
||||
if (quantity == 0) {
|
||||
plugin.stop("Out of herbs, stopping plugin.");
|
||||
}
|
||||
} else if (plugin.shouldMakeUnfinished() && plugin.shouldMakePotion()) {
|
||||
int quantity = withdraw(new int[]{config.makePotion().getPotionBaseId()}, 9);
|
||||
if (quantity == 0) {
|
||||
plugin.stop("Out of potion bases, stopping plugin.");
|
||||
}
|
||||
|
||||
quantity = withdraw(plugin.getCleanHerbIds(), 9);
|
||||
if (quantity == 0) {
|
||||
plugin.stop("Out of clean herbs, stopping plugin.");
|
||||
}
|
||||
|
||||
quantity = withdraw(plugin.getSecondaryIds(), 9);
|
||||
if (quantity == 0) {
|
||||
plugin.stop("Out of secondaries, stopping plugin.");
|
||||
}
|
||||
} else if (plugin.shouldMakeUnfinished()) {
|
||||
if (bank.quantity(ItemID.VIAL_OF_WATER) == 0) {
|
||||
plugin.stop("Out of vials, stopping plugin.");
|
||||
}
|
||||
|
||||
bank.withdraw(ItemID.VIAL_OF_WATER, 14, false);
|
||||
game.sleepDelay();
|
||||
|
||||
int quantity = withdraw(plugin.getCleanHerbIds(), 14);
|
||||
|
||||
if (quantity == 0) {
|
||||
plugin.stop("Out of clean herbs, stopping plugin.");
|
||||
}
|
||||
} else if (plugin.shouldMakePotion()) {
|
||||
int quantity = withdraw(plugin.getBaseIds(), 14);
|
||||
if (quantity == 0) {
|
||||
plugin.stop("Out of potion bases, stopping plugin.");
|
||||
}
|
||||
|
||||
quantity = withdraw(plugin.getSecondaryIds(), 14);
|
||||
if (quantity == 0) {
|
||||
plugin.stop("Out of secondaries, stopping plugin.");
|
||||
}
|
||||
}
|
||||
|
||||
bank.close();
|
||||
game.waitUntil(() -> !bank.isOpen(), 5);
|
||||
lastBanking = Instant.now();
|
||||
}
|
||||
|
||||
private int withdraw(int[] ids, int quantity) {
|
||||
int available = 0;
|
||||
|
||||
for (int id : ids) {
|
||||
available += bank.quantity(id);
|
||||
bank.withdraw(id, quantity, false);
|
||||
game.sleepDelay();
|
||||
|
||||
if (available >= quantity) break;
|
||||
}
|
||||
|
||||
return available;
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package io.reisub.openosrs.herblore.tasks;
|
||||
|
||||
import io.reisub.openosrs.herblore.Herblore;
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import io.reisub.openosrs.util.enums.Activity;
|
||||
import net.runelite.client.plugins.iutils.game.InventoryItem;
|
||||
import net.runelite.client.plugins.iutils.ui.Chatbox;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.List;
|
||||
|
||||
public class MakePotion extends Task {
|
||||
@Inject
|
||||
private Herblore plugin;
|
||||
|
||||
@Override
|
||||
public String getStatus() {
|
||||
return "Making potions";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validate() {
|
||||
return plugin.shouldMakePotion()
|
||||
&& plugin.getCurrentActivity() == Activity.IDLE
|
||||
&& game.inventory().withId(plugin.getSecondaryIds()).exists()
|
||||
&& game.inventory().withId(plugin.getBaseIds()).exists();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
plugin.setActivity(Activity.CREATING_POTIONS);
|
||||
|
||||
List<InventoryItem> secondaries = game.inventory().withId(plugin.getSecondaryIds()).all();
|
||||
List<InventoryItem> bases = game.inventory().withId(plugin.getBaseIds()).all();
|
||||
|
||||
if (secondaries.size() == 0 || bases.size() == 0) return;
|
||||
|
||||
int quantity = Math.min(secondaries.size(), bases.size());
|
||||
|
||||
secondaries.get(0).useOn(bases.get(0));
|
||||
game.waitUntil(() -> chatbox.chatState() == Chatbox.ChatState.MAKE, 5);
|
||||
|
||||
chatbox.make(0, quantity);
|
||||
game.tick();
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package io.reisub.openosrs.herblore.tasks;
|
||||
|
||||
import io.reisub.openosrs.herblore.Herblore;
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import io.reisub.openosrs.util.enums.Activity;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.client.plugins.iutils.game.InventoryItem;
|
||||
import net.runelite.client.plugins.iutils.ui.Chatbox;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.List;
|
||||
|
||||
public class MakeUnfinished extends Task {
|
||||
@Inject
|
||||
private Herblore plugin;
|
||||
|
||||
@Override
|
||||
public String getStatus() {
|
||||
return "Making unfinished potions";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validate() {
|
||||
return plugin.shouldMakeUnfinished()
|
||||
&& plugin.getCurrentActivity() == Activity.IDLE
|
||||
&& game.inventory().withId(plugin.getCleanHerbIds()).exists()
|
||||
&& game.inventory().withId(ItemID.VIAL_OF_WATER, ItemID.VIAL_OF_BLOOD, ItemID.COCONUT_MILK).exists();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
plugin.setActivity(Activity.CREATING_UNFINISHED_POTIONS);
|
||||
|
||||
List<InventoryItem> herbs = game.inventory().withId(plugin.getCleanHerbIds()).all();
|
||||
List<InventoryItem> bases = game.inventory().withId(ItemID.VIAL_OF_WATER, ItemID.VIAL_OF_BLOOD, ItemID.COCONUT_MILK).all();
|
||||
|
||||
if (herbs.size() == 0 || bases.size() == 0) return;
|
||||
|
||||
int quantity = Math.min(herbs.size(), bases.size());
|
||||
|
||||
herbs.get(0).useOn(bases.get(0));
|
||||
game.waitUntil(() -> chatbox.chatState() == Chatbox.ChatState.MAKE, 5);
|
||||
|
||||
chatbox.make(0, quantity);
|
||||
game.tick();
|
||||
}
|
||||
}
|
@ -24,13 +24,50 @@
|
||||
*/
|
||||
package io.reisub.openosrs.masterthiever;
|
||||
|
||||
import io.reisub.openosrs.util.enums.Food;
|
||||
import net.runelite.client.config.Button;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup("ChaosMasterThieverConfig")
|
||||
@ConfigGroup("chaosmasterthiever")
|
||||
|
||||
public interface Config extends net.runelite.client.config.Config {
|
||||
@ConfigItem(
|
||||
keyName = "minEatHP",
|
||||
name = "Minimum Eat HP",
|
||||
description = "Minimum HP to eat or bank at.",
|
||||
position = 0
|
||||
)
|
||||
default int minEatHP() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "maxEatHP",
|
||||
name = "Maximum Eat HP",
|
||||
description = "Highest HP to potentially eat or bank at.",
|
||||
position = 1
|
||||
)
|
||||
default int maxEatHP() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "food",
|
||||
name = "Food",
|
||||
description = "Choose what food to eat.",
|
||||
position = 2
|
||||
)
|
||||
default Food food() { return Food.SALMON; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "healAtBank",
|
||||
name = "Heal at bank",
|
||||
description = "Heal at bank and don't take food with us when thieving.",
|
||||
position = 3
|
||||
)
|
||||
default boolean healAtBank() { return true; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "startButton",
|
||||
name = "Start/Stop",
|
||||
|
@ -1,96 +1,81 @@
|
||||
package io.reisub.openosrs.masterthiever;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
|
||||
import io.reisub.openosrs.masterthiever.tasks.HandleBank;
|
||||
import io.reisub.openosrs.masterthiever.tasks.Steal;
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import io.reisub.openosrs.util.CScript;
|
||||
import io.reisub.openosrs.util.Util;
|
||||
import io.reisub.openosrs.util.enums.Activity;
|
||||
import io.reisub.openosrs.util.tasks.Eat;
|
||||
import io.reisub.openosrs.util.tasks.KittenTask;
|
||||
import io.reisub.openosrs.util.tasks.Run;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.ConfigButtonClicked;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.api.events.AnimationChanged;
|
||||
import net.runelite.api.events.ItemContainerChanged;
|
||||
import net.runelite.api.events.StatChanged;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.PluginDependency;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.iutils.iUtils;
|
||||
import net.runelite.client.plugins.iutils.scripts.iScript;
|
||||
import org.pf4j.Extension;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.inject.Inject;
|
||||
|
||||
@Extension
|
||||
@PluginDependency(Util.class)
|
||||
@PluginDependency(iUtils.class)
|
||||
@PluginDescriptor(
|
||||
name = "Chaos Master Thiever",
|
||||
description = "Steals seeds from master farmers.",
|
||||
description = "Cor blimey mate, what are ye doing in me pockets?",
|
||||
enabledByDefault = false
|
||||
)
|
||||
@Slf4j
|
||||
public class MasterThiever extends iScript {
|
||||
private List<Task> tasks;
|
||||
private KittenTask kittenTask;
|
||||
public class MasterThiever extends CScript {
|
||||
@Inject
|
||||
private Config config;
|
||||
|
||||
private Eat eatTask;
|
||||
|
||||
@Provides
|
||||
Config provideConfig(ConfigManager configManager) {
|
||||
return configManager.getConfig(Config.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loop() {
|
||||
for (Task t : tasks) {
|
||||
if (t.validate()) {
|
||||
log.info(t.getStatus());
|
||||
t.execute();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
game.sleepDelay();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
log.info("Starting Chaos Master Thiever");
|
||||
super.onStart();
|
||||
|
||||
Eat eatTask = injector.getInstance(Eat.class);
|
||||
eatTask.setInterval(14, 24);
|
||||
eatTask = injector.getInstance(Eat.class);
|
||||
eatTask.setInterval(config.minEatHP(), config.maxEatHP());
|
||||
|
||||
kittenTask = KittenTask.getInstance(injector);
|
||||
|
||||
tasks = new ArrayList<>();
|
||||
tasks.add(eatTask);
|
||||
tasks.add(kittenTask);
|
||||
tasks.add(injector.getInstance(HandleBank.class));
|
||||
tasks.add(injector.getInstance(Steal.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
log.info("Stopping Chaos Master Thiever");
|
||||
if (tasks != null) {
|
||||
tasks.clear();
|
||||
}
|
||||
|
||||
KittenTask.handleKitten = false;
|
||||
addTask(HandleBank.class);
|
||||
addTask(Steal.class);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onConfigButtonPressed(ConfigButtonClicked configButtonClicked) {
|
||||
if (configButtonClicked.getKey().equals("startButton")) {
|
||||
execute();
|
||||
private void onAnimationChanged(AnimationChanged event) {
|
||||
Actor actor = event.getActor();
|
||||
if (actor == null || actor.getName() == null) return;
|
||||
|
||||
if (!actor.getName().equals(game.localPlayer().name())) return;
|
||||
|
||||
switch (game.localPlayer().animation()) {
|
||||
case 388:
|
||||
setActivity(Activity.IDLE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onChatMessage(ChatMessage chatMessage) {
|
||||
if (kittenTask != null) {
|
||||
kittenTask.onChatMessage(chatMessage);
|
||||
private void onStatChanged(StatChanged event) {
|
||||
if (event.getSkill() == Skill.THIEVING) {
|
||||
setActivity(Activity.IDLE);
|
||||
}
|
||||
}
|
||||
|
||||
public int getEatThreshold() {
|
||||
return eatTask.getThreshold();
|
||||
}
|
||||
}
|
@ -1,15 +1,23 @@
|
||||
package io.reisub.openosrs.masterthiever.tasks;
|
||||
|
||||
import io.reisub.openosrs.masterthiever.Config;
|
||||
import io.reisub.openosrs.masterthiever.MasterThiever;
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.client.plugins.iutils.api.Interactable;
|
||||
import net.runelite.client.plugins.iutils.game.iNPC;
|
||||
import net.runelite.client.plugins.iutils.game.iObject;
|
||||
import net.runelite.client.plugins.iutils.scene.Position;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class HandleBank extends Task {
|
||||
@Inject
|
||||
private MasterThiever plugin;
|
||||
|
||||
@Inject
|
||||
private Config config;
|
||||
|
||||
@Override
|
||||
public String getStatus() {
|
||||
return "Banking";
|
||||
@ -19,21 +27,22 @@ public class HandleBank extends Task {
|
||||
public boolean validate() {
|
||||
return game.client().getLocalPlayer().getModelHeight() != 1000
|
||||
&& (game.inventory().full()
|
||||
|| (!game.inventory().withAction("Eat").exists() && game.modifiedLevel(Skill.HITPOINTS) <= 35));
|
||||
|| (!game.inventory().withAction("Eat").exists() && game.modifiedLevel(Skill.HITPOINTS) <= plugin.getEatThreshold()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
game.tick();
|
||||
if (!bank.isOpen()) {
|
||||
Interactable bankObj;
|
||||
if (calc.random(0, 1) == 0) {
|
||||
bankObj = game.objects().filter(obj -> obj.name().equals("Bank booth") && obj.position().equals(new Position(3091, 3245, 0))).first();
|
||||
} else {
|
||||
bankObj = game.npcs().filter(npc -> npc.name().equals("Banker") && npc.position().equals(new Position(3090, 3245, 0))).first();
|
||||
iObject bankObj = game.objects().withAction("Bank").withPosition(new Position(3091, 3245, 0)).first();
|
||||
if (bankObj == null) {
|
||||
bankObj = game.objects().withName("Bank chest", "Bank booth", "Bank Chest-wreck").withAction("Bank").nearest();
|
||||
}
|
||||
|
||||
if (bankObj == null) return;
|
||||
if (bankObj == null) {
|
||||
walking.walkTo(new Position(3090, 3248, 0).areaWithin(2));
|
||||
return;
|
||||
}
|
||||
|
||||
bankObj.interact("Bank");
|
||||
game.waitUntil(() -> bank.isOpen(), 15);
|
||||
@ -42,12 +51,21 @@ public class HandleBank extends Task {
|
||||
bank.depositInventory();
|
||||
game.tick();
|
||||
|
||||
int quantity = 5 + (game.baseLevel(Skill.HITPOINTS) - game.modifiedLevel(Skill.HITPOINTS)) / 9;
|
||||
int missingHp = game.baseLevel(Skill.HITPOINTS) - game.modifiedLevel(Skill.HITPOINTS);
|
||||
|
||||
int quantity = config.healAtBank() ? missingHp / config.food().getHp() : 5 + (missingHp / config.food().getHp());
|
||||
|
||||
bank.withdraw(ItemID.SALMON, quantity, false);
|
||||
game.waitUntil(() -> game.inventory().withAction("Eat", "Drink").count() > 1, 6);
|
||||
|
||||
bank.close();
|
||||
game.waitUntil(() -> !bank.isOpen(), 3);
|
||||
|
||||
if (config.healAtBank()) {
|
||||
game.inventory().withId(config.food().getId()).forEach((food) -> {
|
||||
food.interact(0);
|
||||
game.tick(3);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,19 @@
|
||||
package io.reisub.openosrs.masterthiever.tasks;
|
||||
|
||||
import io.reisub.openosrs.masterthiever.MasterThiever;
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import io.reisub.openosrs.util.enums.Activity;
|
||||
import net.runelite.api.AnimationID;
|
||||
import net.runelite.api.NpcID;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.client.plugins.iutils.game.iNPC;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class Steal extends Task {
|
||||
@Inject
|
||||
private MasterThiever plugin;
|
||||
|
||||
@Override
|
||||
public String getStatus() {
|
||||
return "Pickpocketing";
|
||||
@ -14,8 +22,9 @@ public class Steal extends Task {
|
||||
@Override
|
||||
public boolean validate() {
|
||||
return !game.inventory().full()
|
||||
&& plugin.getCurrentActivity() == Activity.IDLE
|
||||
&& game.client().getLocalPlayer().getModelHeight() != 1000
|
||||
&& (game.inventory().withAction("Eat").exists() || game.modifiedLevel(Skill.HITPOINTS) > 35);
|
||||
&& (game.inventory().withAction("Eat").exists() || game.modifiedLevel(Skill.HITPOINTS) > plugin.getEatThreshold());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -24,8 +33,9 @@ public class Steal extends Task {
|
||||
|
||||
if (farmer == null) return;
|
||||
|
||||
|
||||
farmer.interact("Pickpocket");
|
||||
game.tick(calc.random(0, 2));
|
||||
game.sleepDelay();
|
||||
plugin.setActivity(Activity.THIEVING);
|
||||
game.tick();
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,10 @@ import net.runelite.client.plugins.iutils.game.iObject;
|
||||
import net.runelite.client.plugins.iutils.scene.Position;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Queue;
|
||||
|
||||
public class Mine extends Task {
|
||||
@Inject
|
||||
|
52
mtahelper/mtahelper.gradle.kts
Normal file
52
mtahelper/mtahelper.gradle.kts
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
version = "1.0.0"
|
||||
|
||||
project.extra["PluginName"] = "Chaos MTA Helper" // This is the name that is used in the external plugin manager panel
|
||||
project.extra["PluginDescription"] = "Makes Mage Training Arena slightly less terrible." // This is the description that is used in the external plugin manager panel
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":util"))
|
||||
}
|
||||
|
||||
tasks {
|
||||
jar {
|
||||
manifest {
|
||||
attributes(mapOf(
|
||||
"Plugin-Version" to project.version,
|
||||
"Plugin-Id" to nameToId(project.extra["PluginName"] as String),
|
||||
"Plugin-Provider" to project.extra["PluginProvider"],
|
||||
"Plugin-Description" to project.extra["PluginDescription"],
|
||||
"Plugin-Dependencies" to
|
||||
arrayOf(
|
||||
nameToId("Chaos Util"),
|
||||
nameToId("iUtils")
|
||||
).joinToString(),
|
||||
"Plugin-License" to project.extra["PluginLicense"]
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Andrew EP | ElPinche256 <https://github.com/ElPinche256>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package io.reisub.openosrs.mtahelper;
|
||||
|
||||
import net.runelite.client.config.Button;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
import net.runelite.client.config.Keybind;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
@ConfigGroup("chaosmtahelper")
|
||||
|
||||
public interface Config extends net.runelite.client.config.Config {
|
||||
@ConfigItem(
|
||||
keyName = "spellHotkey",
|
||||
name = "Spell hotkey",
|
||||
description = "Use this hotkey to cast telegrab or bones to bananas depending on the minigame.",
|
||||
position = 0
|
||||
)
|
||||
default Keybind spellHotkey() {
|
||||
return new Keybind(KeyEvent.VK_Q, 0);
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "enableTelegrabHotkey",
|
||||
name = "Enable telegrab hotkey",
|
||||
description = "Enable the hotkey for telegrabs.",
|
||||
position = 1
|
||||
)
|
||||
default boolean enableTelegrabHotkey() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "enableBonesHotkey",
|
||||
name = "Enable B2B hotkey",
|
||||
description = "Enable the hotkey for bones to bananas.",
|
||||
position = 2
|
||||
)
|
||||
default boolean enableBonesHotkey() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "startButton",
|
||||
name = "Start/Stop",
|
||||
description = "Start the script",
|
||||
position = 100
|
||||
)
|
||||
default Button startButton() {
|
||||
return new Button();
|
||||
}
|
||||
}
|
@ -0,0 +1,144 @@
|
||||
package io.reisub.openosrs.mtahelper;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
|
||||
import io.reisub.openosrs.mtahelper.tasks.*;
|
||||
import io.reisub.openosrs.util.CScript;
|
||||
import io.reisub.openosrs.util.Util;
|
||||
import io.reisub.openosrs.util.tasks.Run;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.coords.Direction;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.events.*;
|
||||
import net.runelite.api.widgets.WidgetID;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.input.KeyListener;
|
||||
import net.runelite.client.input.KeyManager;
|
||||
import net.runelite.client.plugins.PluginDependency;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.iutils.iUtils;
|
||||
import net.runelite.client.plugins.mta.telekinetic.Maze;
|
||||
import org.pf4j.Extension;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.awt.*;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
|
||||
@Extension
|
||||
@PluginDependency(Util.class)
|
||||
@PluginDependency(iUtils.class)
|
||||
@PluginDescriptor(
|
||||
name = "Chaos MTA Helper",
|
||||
description = "Makes Mage Training Arena slightly less terrible.",
|
||||
enabledByDefault = false
|
||||
)
|
||||
@Slf4j
|
||||
public class MTAHelper extends CScript implements KeyListener {
|
||||
@Inject
|
||||
private Config config;
|
||||
|
||||
@Inject
|
||||
private KeyManager keyManager;
|
||||
|
||||
private Instant lastAction = Instant.EPOCH;
|
||||
|
||||
@Provides
|
||||
Config provideConfig(ConfigManager configManager) {
|
||||
return configManager.getConfig(Config.class);
|
||||
}
|
||||
|
||||
public static final int MTA_REGION = 13462;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean castTelekineticGrab;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean castBonesToBananas;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private long lastHighAlchemy;
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
|
||||
keyManager.registerKeyListener(this);
|
||||
|
||||
Run runTask = injector.getInstance(Run.class);
|
||||
runTask.setInterval(70, 95);
|
||||
tasks.add(runTask);
|
||||
|
||||
addTask(CastTelekineticGrab.class);
|
||||
addTask(CastEnchant.class);
|
||||
addTask(CastHighAlch.class);
|
||||
addTask(EatPeach.class);
|
||||
addTask(CastBonesToBananas.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
keyManager.unregisterKeyListener(this);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Subscribe
|
||||
private void onGameTick(GameTick event) {
|
||||
if (!isLoggedIn()) return;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Subscribe
|
||||
private void onItemContainerChanged(ItemContainerChanged event) {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Subscribe
|
||||
private void onStatChanged(StatChanged event) {
|
||||
if (event.getSkill() == Skill.MAGIC) {
|
||||
lastHighAlchemy = game.ticks();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(KeyEvent e) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (Duration.between(lastAction, Instant.now()).getSeconds() < 2) return;
|
||||
lastAction = Instant.now();
|
||||
|
||||
if (config.enableTelegrabHotkey()
|
||||
&& config.spellHotkey().matches(e)
|
||||
&& game.widget(WidgetID.MTA_TELEKINETIC_GROUP_ID, 0) != null) {
|
||||
castTelekineticGrab = true;
|
||||
} else if (config.enableBonesHotkey()
|
||||
&& config.spellHotkey().matches(e)
|
||||
&& game.widget(WidgetID.MTA_GRAVEYARD_GROUP_ID, 0) != null) {
|
||||
castBonesToBananas = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent e) {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package io.reisub.openosrs.mtahelper.tasks;
|
||||
|
||||
import io.reisub.openosrs.mtahelper.MTAHelper;
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import net.runelite.client.plugins.iutils.api.Spells;
|
||||
import net.runelite.client.plugins.iutils.game.iObject;
|
||||
import net.runelite.client.plugins.iutils.game.iWidget;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class CastBonesToBananas extends Task {
|
||||
@Inject
|
||||
private MTAHelper plugin;
|
||||
|
||||
@Override
|
||||
public String getStatus() {
|
||||
return "Casting bones to bananas and depositing";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validate() {
|
||||
return plugin.isCastBonesToBananas();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
iObject foodChute = game.objects().withName("Food chute").nearest();
|
||||
if (foodChute == null) return;
|
||||
|
||||
foodChute.interact("Deposit");
|
||||
game.sleepDelay();
|
||||
game.sleepDelay();
|
||||
|
||||
iWidget spellWidget = game.widget(Spells.BONES_TO_BANANAS.getInfo());
|
||||
if (spellWidget == null) return;
|
||||
|
||||
spellWidget.interact("Cast");
|
||||
|
||||
plugin.setCastBonesToBananas(false);
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package io.reisub.openosrs.mtahelper.tasks;
|
||||
|
||||
import io.reisub.openosrs.mtahelper.MTAHelper;
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import net.runelite.client.plugins.iutils.api.Spells;
|
||||
import net.runelite.client.plugins.iutils.game.InventoryItem;
|
||||
import net.runelite.client.plugins.iutils.game.iWidget;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.Set;
|
||||
|
||||
public class CastEnchant extends Task {
|
||||
@Inject
|
||||
private MTAHelper plugin;
|
||||
|
||||
private final String[] enchantItems = new String[]{
|
||||
"Pentamid",
|
||||
"Cube",
|
||||
"Cylinder",
|
||||
"Icosahedron",
|
||||
"Dragonstone"
|
||||
};
|
||||
|
||||
private long last = 0;
|
||||
|
||||
@Override
|
||||
public String getStatus() {
|
||||
return "Casting enchant spell";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validate() {
|
||||
return plugin.isInRegion(MTAHelper.MTA_REGION)
|
||||
&& game.localPlayer().position().z == 0
|
||||
&& game.inventory().withName(enchantItems).exists()
|
||||
&& game.ticks() > last + 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
InventoryItem item = game.inventory().withName(enchantItems).first();
|
||||
if (item == null) return;
|
||||
|
||||
iWidget spellWidget = game.widget(Spells.LVL5_ENCHANT.getInfo());
|
||||
if (spellWidget == null) return;
|
||||
|
||||
spellWidget.useOn(item);
|
||||
|
||||
last = game.ticks();
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package io.reisub.openosrs.mtahelper.tasks;
|
||||
|
||||
import io.reisub.openosrs.mtahelper.MTAHelper;
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import net.runelite.api.widgets.WidgetID;
|
||||
import net.runelite.client.plugins.iutils.api.Spells;
|
||||
import net.runelite.client.plugins.iutils.game.InventoryItem;
|
||||
import net.runelite.client.plugins.iutils.game.iWidget;
|
||||
import net.runelite.client.plugins.mta.alchemy.AlchemyItem;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class CastHighAlch extends Task {
|
||||
@Inject
|
||||
private MTAHelper plugin;
|
||||
|
||||
private long last;
|
||||
private AlchemyItem best = null;
|
||||
|
||||
@Override
|
||||
public String getStatus() {
|
||||
return "Casting high alchemy";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validate() {
|
||||
best = getBest();
|
||||
|
||||
return plugin.isInRegion(MTAHelper.MTA_REGION)
|
||||
&& game.localPlayer().position().z == 2
|
||||
&& game.ticks() >= plugin.getLastHighAlchemy() + 5
|
||||
&& best != null
|
||||
&& (!game.inventory().withName("Coins").exists() || (game.inventory().withName("Coins").exists() && game.inventory().withName("Coins").quantity() < 10000))
|
||||
&& game.inventory().withId(best.getId()).exists();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
InventoryItem item = game.inventory().withId(best.getId()).first();
|
||||
if (item == null) return;
|
||||
|
||||
iWidget spellWidget = game.widget(Spells.HIGH_LEVEL_ALCHEMY.getInfo());
|
||||
if (spellWidget == null) return;
|
||||
|
||||
spellWidget.useOn(item);
|
||||
|
||||
plugin.setLastHighAlchemy(game.ticks());
|
||||
}
|
||||
|
||||
private AlchemyItem getBest() {
|
||||
for (int i = 0; i < 5; i++) { // 12
|
||||
iWidget textWidget = game.widget(WidgetID.MTA_ALCHEMY_GROUP_ID, 7 + i);
|
||||
if (textWidget == null) return null;
|
||||
|
||||
String item = textWidget.text();
|
||||
iWidget pointsWidget = game.widget(WidgetID.MTA_ALCHEMY_GROUP_ID, 12 + i);
|
||||
int points = Integer.parseInt(pointsWidget.text());
|
||||
|
||||
if (points == 30) {
|
||||
return AlchemyItem.find(item);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package io.reisub.openosrs.mtahelper.tasks;
|
||||
|
||||
import io.reisub.openosrs.mtahelper.MTAHelper;
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import net.runelite.client.plugins.iutils.api.Spells;
|
||||
import net.runelite.client.plugins.iutils.game.iNPC;
|
||||
import net.runelite.client.plugins.iutils.game.iWidget;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class CastTelekineticGrab extends Task {
|
||||
@Inject
|
||||
private MTAHelper plugin;
|
||||
|
||||
@Override
|
||||
public String getStatus() {
|
||||
return "Casting telekinetic grab";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validate() {
|
||||
return plugin.isCastTelekineticGrab();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
plugin.setCastTelekineticGrab(false);
|
||||
|
||||
iNPC mazeGuardian = game.npcs().withName("<col=ff9040>Maze Guardian</col>").first();
|
||||
if (mazeGuardian == null) return;
|
||||
|
||||
iWidget spellWidget = game.widget(Spells.TELEKINETIC_GRAB.getInfo());
|
||||
if (spellWidget == null) return;
|
||||
|
||||
spellWidget.useOn(mazeGuardian);
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package io.reisub.openosrs.mtahelper.tasks;
|
||||
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.client.plugins.iutils.game.InventoryItem;
|
||||
|
||||
public class EatPeach extends Task {
|
||||
private long last;
|
||||
|
||||
@Override
|
||||
public String getStatus() {
|
||||
return "Eating a peach";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validate() {
|
||||
int missingHp = game.baseLevel(Skill.HITPOINTS) - game.modifiedLevel(Skill.HITPOINTS);
|
||||
|
||||
return game.inventory().withName("Peach").exists()
|
||||
&& missingHp >= 8
|
||||
&& game.ticks() >= last + 3;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
InventoryItem peach = game.inventory().withName("Peach").first();
|
||||
if (peach == null) return;
|
||||
|
||||
peach.interact("Eat");
|
||||
game.tick();
|
||||
|
||||
last = game.ticks();
|
||||
}
|
||||
}
|
@ -26,7 +26,7 @@
|
||||
version = "1.1.0"
|
||||
|
||||
project.extra["PluginName"] = "Chaos Prayer Flicking" // This is the name that is used in the external plugin manager panel
|
||||
project.extra["PluginDescription"] = "Flicks prayer" // This is the description that is used in the external plugin manager panel
|
||||
project.extra["PluginDescription"] = "Infinite power!" // This is the description that is used in the external plugin manager panel
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":util"))
|
||||
|
@ -28,19 +28,20 @@ import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
import net.runelite.client.config.Keybind;
|
||||
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
@ConfigGroup("ChaosPrayerflickConfig")
|
||||
@ConfigGroup("chaosprayerflicking")
|
||||
|
||||
public interface Config extends net.runelite.client.config.Config {
|
||||
@ConfigItem(
|
||||
keyName = "hotkey",
|
||||
keyName = "prayerFlickHotkey",
|
||||
name = "Flick hotkey",
|
||||
description = "When you press this key prayer flicking will start",
|
||||
position = 0
|
||||
)
|
||||
default Keybind hotkey() {
|
||||
return new Keybind(KeyEvent.VK_BACK_SLASH, 0);
|
||||
default Keybind prayerFlickHotkey() {
|
||||
return new Keybind(KeyEvent.VK_BACK_QUOTE, 0);
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
@ -60,7 +61,7 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
position = 20
|
||||
)
|
||||
default Keybind hotkeyMelee() {
|
||||
return new Keybind(KeyEvent.VK_1, 0);
|
||||
return new Keybind(KeyEvent.VK_1, InputEvent.CTRL_DOWN_MASK);
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
@ -70,7 +71,7 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
position = 21
|
||||
)
|
||||
default Keybind hotkeyMissiles() {
|
||||
return new Keybind(KeyEvent.VK_2, 0);
|
||||
return new Keybind(KeyEvent.VK_2, InputEvent.CTRL_DOWN_MASK);
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
@ -80,7 +81,7 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
position = 22
|
||||
)
|
||||
default Keybind hotkeyMagic() {
|
||||
return new Keybind(KeyEvent.VK_3, 0);
|
||||
return new Keybind(KeyEvent.VK_3, InputEvent.CTRL_DOWN_MASK);
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
@ -90,4 +91,76 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
position = 23
|
||||
)
|
||||
default boolean openInventory() { return true; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "allowToggleOff",
|
||||
name = "Allow toggling off",
|
||||
description = "Will allow turning the protect prayer off when pressing the hotkey for the current one.",
|
||||
position = 24
|
||||
)
|
||||
default boolean allowToggleOff() { return true; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "jadPrayerFlick",
|
||||
name = "Jad Auto Prayer Flick",
|
||||
description = "Automatically swap prayers against Jad.",
|
||||
position = 30
|
||||
)
|
||||
default boolean jadPrayerFlick() { return true; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "hesporiPrayerFlick",
|
||||
name = "Hespori Auto Prayer Flick",
|
||||
description = "Automatically swap prayers against Hespori.",
|
||||
position = 31
|
||||
)
|
||||
default boolean hesporiPrayerFlick() { return true; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showDebugOptions",
|
||||
name = "Show debug options",
|
||||
description = "Show debug options. Probably shouldn't touch these.",
|
||||
position = 90
|
||||
)
|
||||
default boolean showDebugOptions() { return false; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "onDelayMin",
|
||||
name = "On delay minimum",
|
||||
description = "Minimum wait time for toggling on quickprayers.",
|
||||
hidden = true,
|
||||
unhide = "showDebugOptions",
|
||||
position = 91
|
||||
)
|
||||
default int onDelayMin() { return 5; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "onDelayMax",
|
||||
name = "On delay maximum",
|
||||
description = "Maximum wait time for toggling on quickprayers.",
|
||||
hidden = true,
|
||||
unhide = "showDebugOptions",
|
||||
position = 92
|
||||
)
|
||||
default int onDelayMax() { return 10; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "offDelayMin",
|
||||
name = "Off delay minimum",
|
||||
description = "Minimum wait time for toggling off quickprayers.",
|
||||
hidden = true,
|
||||
unhide = "showDebugOptions",
|
||||
position = 93
|
||||
)
|
||||
default int offDelayMin() { return 70; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "offDelayMax",
|
||||
name = "Off delay maximum",
|
||||
description = "Maximum wait time for toggling off quickprayers.",
|
||||
hidden = true,
|
||||
unhide = "showDebugOptions",
|
||||
position = 94
|
||||
)
|
||||
default int offDelayMax() { return 80; }
|
||||
}
|
@ -4,11 +4,10 @@ import com.google.inject.Provides;
|
||||
import io.reisub.openosrs.util.Calculations;
|
||||
import io.reisub.openosrs.util.Util;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.MenuAction;
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.events.AnimationChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.events.VarbitChanged;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
@ -34,7 +33,7 @@ import java.util.concurrent.TimeUnit;
|
||||
@PluginDependency(iUtils.class)
|
||||
@PluginDescriptor(
|
||||
name = "Chaos Prayer Flicking",
|
||||
description = "",
|
||||
description = "Infinite power!",
|
||||
enabledByDefault = false
|
||||
)
|
||||
@Slf4j
|
||||
@ -62,10 +61,16 @@ public class Prayerflick extends Plugin implements KeyListener {
|
||||
return configManager.getConfig(Config.class);
|
||||
}
|
||||
|
||||
private final int JALTOK_JAD_MAGE_ATTACK = 7592;
|
||||
private final int JALTOK_JAD_RANGE_ATTACK = 7593;
|
||||
private final int HESPORI_MAGE_ATTACK = 8223;
|
||||
private final int HESPORI_RANGE_ATTACK = 8224;
|
||||
|
||||
private ScheduledExecutorService executor;
|
||||
private boolean toggleFlicking;
|
||||
private boolean firstFlick;
|
||||
private boolean toggledOff;
|
||||
private volatile ProtectFrom currently;
|
||||
|
||||
@Override
|
||||
protected void startUp() {
|
||||
@ -94,19 +99,51 @@ public class Prayerflick extends Plugin implements KeyListener {
|
||||
boolean active = quickPrayers.actions().get(0).equals("Deactivate");
|
||||
|
||||
if (!active && !firstFlick) {
|
||||
toggle(calc.random(1, 15), quickPrayers);
|
||||
toggle(calc.random(config.onDelayMin(), config.onDelayMax()), quickPrayers);
|
||||
return;
|
||||
}
|
||||
|
||||
toggle(calc.random(1, 9), quickPrayers);
|
||||
toggle(calc.random(90, 100), quickPrayers);
|
||||
toggle(calc.random(config.onDelayMin(), config.offDelayMax()), quickPrayers);
|
||||
toggle(calc.random(config.offDelayMin(), config.offDelayMax()), quickPrayers);
|
||||
|
||||
if (firstFlick) {
|
||||
firstFlick = false;
|
||||
}
|
||||
} else if (!toggleFlicking && toggledOff && config.deactivateAfterStopping()) {
|
||||
toggledOff = false;
|
||||
toggle(calc.random(90, 110), quickPrayers);
|
||||
toggle(calc.random(config.offDelayMin() + 10, config.offDelayMax() + 10), quickPrayers);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onAnimationChanged(AnimationChanged event) {
|
||||
Actor actor = event.getActor();
|
||||
if (actor == null) return;
|
||||
|
||||
if (config.jadPrayerFlick()) {
|
||||
switch (actor.getAnimation()) {
|
||||
case AnimationID.TZTOK_JAD_MAGIC_ATTACK:
|
||||
case JALTOK_JAD_MAGE_ATTACK:
|
||||
setPrayer(ProtectFrom.MAGIC, false);
|
||||
game.utils.sendGameMessage("Pray against magic!");
|
||||
break;
|
||||
case AnimationID.TZTOK_JAD_RANGE_ATTACK:
|
||||
case JALTOK_JAD_RANGE_ATTACK:
|
||||
setPrayer(ProtectFrom.MISSILES, false);
|
||||
game.utils.sendGameMessage("Pray against missiles!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (config.hesporiPrayerFlick()) {
|
||||
switch (actor.getAnimation()) {
|
||||
case HESPORI_MAGE_ATTACK:
|
||||
setPrayer(ProtectFrom.MAGIC, false);
|
||||
break;
|
||||
case HESPORI_RANGE_ATTACK:
|
||||
setPrayer(ProtectFrom.MISSILES, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,7 +158,7 @@ public class Prayerflick extends Plugin implements KeyListener {
|
||||
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e) {
|
||||
if (config.hotkey().matches(e)) {
|
||||
if (config.prayerFlickHotkey().matches(e)) {
|
||||
if (toggleFlicking) {
|
||||
toggledOff = true;
|
||||
} else {
|
||||
@ -130,18 +167,26 @@ public class Prayerflick extends Plugin implements KeyListener {
|
||||
|
||||
toggleFlicking = !toggleFlicking;
|
||||
} else if (config.hotkeyMelee().matches(e)) {
|
||||
setPrayer(14);
|
||||
setPrayer(ProtectFrom.MELEE, config.allowToggleOff());
|
||||
} else if (config.hotkeyMissiles().matches(e)) {
|
||||
setPrayer(13);
|
||||
setPrayer(ProtectFrom.MISSILES, config.allowToggleOff());
|
||||
} else if (config.hotkeyMagic().matches(e)) {
|
||||
setPrayer(12);
|
||||
setPrayer(ProtectFrom.MAGIC, config.allowToggleOff());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent e) {}
|
||||
|
||||
private void setPrayer(int childId) {
|
||||
private void setPrayer(ProtectFrom protectFrom, boolean allowToggleOff) {
|
||||
if (!allowToggleOff && protectFrom == currently) return;
|
||||
|
||||
if (currently == protectFrom) {
|
||||
currently = ProtectFrom.NONE;
|
||||
} else {
|
||||
currently = protectFrom;
|
||||
}
|
||||
|
||||
executor.schedule(() -> {
|
||||
iWidget quickPrayers = game.widget(WidgetInfo.MINIMAP_QUICK_PRAYER_ORB);
|
||||
if (quickPrayers == null) return;
|
||||
@ -152,7 +197,7 @@ public class Prayerflick extends Plugin implements KeyListener {
|
||||
return w != null && !w.hidden();
|
||||
});
|
||||
|
||||
iWidget protection = game.widget(77, 4, childId);
|
||||
iWidget protection = game.widget(77, 4, protectFrom.getChildId());
|
||||
if (protection == null) return;
|
||||
|
||||
protection.interact(0);
|
||||
|
@ -0,0 +1,15 @@
|
||||
package io.reisub.openosrs.prayerflick;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum ProtectFrom {
|
||||
NONE(0),
|
||||
MAGIC(12),
|
||||
MISSILES(13),
|
||||
MELEE(14);
|
||||
|
||||
private final int childId;
|
||||
}
|
BIN
release/agility-1.0.0.jar
Normal file
BIN
release/agility-1.0.0.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
release/bosshelper-1.0.0.jar
Normal file
BIN
release/bosshelper-1.0.0.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
release/cooker-1.0.0.jar
Normal file
BIN
release/cooker-1.0.0.jar
Normal file
Binary file not shown.
BIN
release/fighter-1.0.0.jar
Normal file
BIN
release/fighter-1.0.0.jar
Normal file
Binary file not shown.
BIN
release/fisher-1.0.0.jar
Normal file
BIN
release/fisher-1.0.0.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
release/herblore-1.0.0.jar
Normal file
BIN
release/herblore-1.0.0.jar
Normal file
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.
Binary file not shown.
Binary file not shown.
BIN
release/mtahelper-1.0.0.jar
Normal file
BIN
release/mtahelper-1.0.0.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
release/smither-1.0.0.jar
Normal file
BIN
release/smither-1.0.0.jar
Normal file
Binary file not shown.
BIN
release/superglassmake-1.0.0.jar
Normal file
BIN
release/superglassmake-1.0.0.jar
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
release/volcanicashminer-1.0.0.jar
Normal file
BIN
release/volcanicashminer-1.0.0.jar
Normal file
Binary file not shown.
Binary file not shown.
BIN
release/woodcutter-1.0.0.jar
Normal file
BIN
release/woodcutter-1.0.0.jar
Normal file
Binary file not shown.
@ -30,20 +30,27 @@ include(":autobones")
|
||||
include(":autodropper")
|
||||
include(":birdhouse")
|
||||
include(":blackjack")
|
||||
include(":bosshelper")
|
||||
include(":consume")
|
||||
include(":cooker")
|
||||
include(":fighter")
|
||||
include(":fisher")
|
||||
include(":glassblower")
|
||||
include(":herblore")
|
||||
include(":masterthiever")
|
||||
include(":miner")
|
||||
include(":mtahelper")
|
||||
include(":prayerflick")
|
||||
include(":shopper")
|
||||
include(":smelter")
|
||||
include(":smither")
|
||||
include(":superglassmake")
|
||||
include(":tempoross")
|
||||
include(":test")
|
||||
include(":util")
|
||||
include(":volcanicashminer")
|
||||
include(":wintertodt")
|
||||
include(":woodcutter")
|
||||
//include(":woodcutter")
|
||||
|
||||
for (project in rootProject.children) {
|
||||
project.apply {
|
||||
|
@ -29,7 +29,7 @@ import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
import net.runelite.client.config.ConfigSection;
|
||||
|
||||
@ConfigGroup("ChaosShopperConfig")
|
||||
@ConfigGroup("chaosshopper")
|
||||
|
||||
public interface Config extends net.runelite.client.config.Config {
|
||||
@ConfigItem(
|
||||
@ -54,6 +54,7 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
keyName = "itemOneEnabled",
|
||||
name = "Enable",
|
||||
description = "Enable the buying of this item",
|
||||
section = "itemOne",
|
||||
position = 11
|
||||
)
|
||||
default boolean itemOneEnabled() {
|
||||
@ -61,19 +62,21 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "itemOneName",
|
||||
name = "Name",
|
||||
description = "Name of the item",
|
||||
keyName = "itemOneId",
|
||||
name = "ID",
|
||||
description = "ID of the item",
|
||||
section = "itemOne",
|
||||
position = 12
|
||||
)
|
||||
default String itemOneName() {
|
||||
return "";
|
||||
default int itemOneId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "itemOneAmount",
|
||||
name = "Amount",
|
||||
description = "Amount of the item to buy",
|
||||
section = "itemOne",
|
||||
position = 13
|
||||
)
|
||||
default int itemOneAmount() {
|
||||
@ -84,6 +87,7 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
keyName = "itemOneMinInStore",
|
||||
name = "Min in store",
|
||||
description = "Amount to keep in store to prevent overpaying",
|
||||
section = "itemOne",
|
||||
position = 14
|
||||
)
|
||||
default int itemOneMinInStore() {
|
||||
@ -103,6 +107,7 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
keyName = "itemTwoEnabled",
|
||||
name = "Enable",
|
||||
description = "Enable the buying of this item",
|
||||
section = "itemTwo",
|
||||
position = 21
|
||||
)
|
||||
default boolean itemTwoEnabled() {
|
||||
@ -110,19 +115,21 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "itemTwoName",
|
||||
name = "Name",
|
||||
description = "Name of the item",
|
||||
keyName = "itemTwoId",
|
||||
name = "ID",
|
||||
description = "ID of the item",
|
||||
section = "itemTwo",
|
||||
position = 22
|
||||
)
|
||||
default String itemTwoName() {
|
||||
return "";
|
||||
default int itemTwoId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "itemTwoAmount",
|
||||
name = "Amount",
|
||||
description = "Amount of the item to buy",
|
||||
section = "itemTwo",
|
||||
position = 23
|
||||
)
|
||||
default int itemTwoAmount() {
|
||||
@ -133,6 +140,7 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
keyName = "itemTwoMinInStore",
|
||||
name = "Min in store",
|
||||
description = "Amount to keep in store to prevent overpaying",
|
||||
section = "itemTwo",
|
||||
position = 24
|
||||
)
|
||||
default int itemTwoMinInStore() {
|
||||
@ -152,6 +160,7 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
keyName = "itemThreeEnabled",
|
||||
name = "Enable",
|
||||
description = "Enable the buying of this item",
|
||||
section = "itemThree",
|
||||
position = 31
|
||||
)
|
||||
default boolean itemThreeEnabled() {
|
||||
@ -159,19 +168,21 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "itemThreeName",
|
||||
name = "Name",
|
||||
description = "Name of the item",
|
||||
keyName = "itemThreeId",
|
||||
name = "ID",
|
||||
description = "ID of the item",
|
||||
section = "itemThree",
|
||||
position = 32
|
||||
)
|
||||
default String itemThreeName() {
|
||||
return "";
|
||||
default int itemThreeId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "itemThreeAmount",
|
||||
name = "Amount",
|
||||
description = "Amount of the item to buy",
|
||||
section = "itemThree",
|
||||
position = 33
|
||||
)
|
||||
default int itemThreeAmount() {
|
||||
@ -182,6 +193,7 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
keyName = "itemThreeMinInStore",
|
||||
name = "Min in store",
|
||||
description = "Amount to keep in store to prevent overpaying",
|
||||
section = "itemThree",
|
||||
position = 34
|
||||
)
|
||||
default int itemThreeMinInStore() {
|
||||
@ -201,6 +213,7 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
keyName = "itemFourEnabled",
|
||||
name = "Enable",
|
||||
description = "Enable the buying of this item",
|
||||
section = "itemFour",
|
||||
position = 41
|
||||
)
|
||||
default boolean itemFourEnabled() {
|
||||
@ -208,19 +221,21 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "itemFourName",
|
||||
name = "Name",
|
||||
description = "Name of the item",
|
||||
keyName = "itemFourId",
|
||||
name = "ID",
|
||||
description = "ID of the item",
|
||||
section = "itemFour",
|
||||
position = 42
|
||||
)
|
||||
default String itemFourName() {
|
||||
return "";
|
||||
default int itemFourId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "itemFourAmount",
|
||||
name = "Amount",
|
||||
description = "Amount of the item to buy",
|
||||
section = "itemFour",
|
||||
position = 43
|
||||
)
|
||||
default int itemFourAmount() {
|
||||
@ -231,6 +246,7 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
keyName = "itemFourMinInStore",
|
||||
name = "Min in store",
|
||||
description = "Amount to keep in store to prevent overpaying",
|
||||
section = "itemFour",
|
||||
position = 44
|
||||
)
|
||||
default int itemFourMinInStore() {
|
||||
@ -250,6 +266,7 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
keyName = "itemFiveEnabled",
|
||||
name = "Enable",
|
||||
description = "Enable the buying of this item",
|
||||
section = "itemFive",
|
||||
position = 51
|
||||
)
|
||||
default boolean itemFiveEnabled() {
|
||||
@ -257,19 +274,21 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "itemFiveName",
|
||||
name = "Name",
|
||||
description = "Name of the item",
|
||||
keyName = "itemFiveId",
|
||||
name = "ID",
|
||||
description = "ID of the item",
|
||||
section = "itemFive",
|
||||
position = 52
|
||||
)
|
||||
default String itemFiveName() {
|
||||
return "";
|
||||
default int itemFiveId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "itemFiveAmount",
|
||||
name = "Amount",
|
||||
description = "Amount of the item to buy",
|
||||
section = "itemFive",
|
||||
position = 53
|
||||
)
|
||||
default int itemFiveAmount() {
|
||||
@ -280,6 +299,7 @@ public interface Config extends net.runelite.client.config.Config {
|
||||
keyName = "itemFiveMinInStore",
|
||||
name = "Min in store",
|
||||
description = "Amount to keep in store to prevent overpaying",
|
||||
section = "itemFive",
|
||||
position = 54
|
||||
)
|
||||
default int itemFiveMinInStore() {
|
||||
|
@ -2,15 +2,15 @@ package io.reisub.openosrs.shopper;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public class Item {
|
||||
@Getter
|
||||
private final String name;
|
||||
|
||||
@Getter
|
||||
private final int amount;
|
||||
|
||||
@Getter
|
||||
private final int id;
|
||||
private final int amountToBuy;
|
||||
private final int minInShop;
|
||||
|
||||
@Setter
|
||||
private int amountBought;
|
||||
}
|
||||
|
@ -1,21 +1,22 @@
|
||||
package io.reisub.openosrs.shopper;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import io.reisub.openosrs.shopper.tasks.*;
|
||||
import io.reisub.openosrs.util.CScript;
|
||||
import io.reisub.openosrs.util.Util;
|
||||
import io.reisub.openosrs.util.tasks.Run;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.events.ConfigButtonClicked;
|
||||
import net.runelite.api.mixins.Inject;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.PluginDependency;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.iutils.iUtils;
|
||||
import net.runelite.client.plugins.iutils.scripts.iScript;
|
||||
import org.pf4j.Extension;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -28,12 +29,10 @@ import java.util.List;
|
||||
enabledByDefault = false
|
||||
)
|
||||
@Slf4j
|
||||
public class Shopper extends iScript {
|
||||
public class Shopper extends CScript {
|
||||
@Inject
|
||||
private Config config;
|
||||
|
||||
private List<Task> tasks;
|
||||
|
||||
@Getter
|
||||
private List<Item> items;
|
||||
|
||||
@ -41,69 +40,61 @@ public class Shopper extends iScript {
|
||||
@Setter
|
||||
private boolean hop;
|
||||
|
||||
private Hop hopTask;
|
||||
|
||||
@Provides
|
||||
@SuppressWarnings("unused")
|
||||
Config provideConfig(ConfigManager configManager) {
|
||||
return configManager.getConfig(Config.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loop() {
|
||||
for (Task t : tasks) {
|
||||
if (t.validate()) {
|
||||
log.info(t.getStatus());
|
||||
t.execute();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
game.sleepDelay();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
log.info("Starting Chaos Shopper");
|
||||
super.onStart();
|
||||
|
||||
loadItems();
|
||||
|
||||
tasks = new ArrayList<>();
|
||||
}
|
||||
Run runTask = injector.getInstance(Run.class);
|
||||
runTask.setInterval(70, 95);
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
log.info("Stopping Chaos Shopper");
|
||||
if (tasks != null) {
|
||||
tasks.clear();
|
||||
}
|
||||
hopTask = injector.getInstance(Hop.class);
|
||||
|
||||
tasks.add(hopTask);
|
||||
tasks.add(runTask);
|
||||
addTask(Buy.class);
|
||||
addTask(HandleBank.class);
|
||||
addTask(CloseShop.class);
|
||||
addTask(OpenShop.class);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@SuppressWarnings("unused")
|
||||
private void onConfigButtonPressed(ConfigButtonClicked configButtonClicked) {
|
||||
if (configButtonClicked.getKey().equals("startButton")) {
|
||||
execute();
|
||||
}
|
||||
private void onGameTick(GameTick event) {
|
||||
if (!isLoggedIn()) return;
|
||||
|
||||
if (hopTask != null) hopTask.onGameTick();
|
||||
}
|
||||
|
||||
private void loadItems() {
|
||||
items = new ArrayList<>();
|
||||
|
||||
if (config.itemOneEnabled()) {
|
||||
items.add(new Item(config.itemOneName(), config.itemOneAmount(), config.itemOneMinInStore()));
|
||||
items.add(new Item(config.itemOneId(), config.itemOneAmount(), config.itemOneMinInStore(), 0));
|
||||
}
|
||||
|
||||
if (config.itemTwoEnabled()) {
|
||||
items.add(new Item(config.itemTwoName(), config.itemTwoAmount(), config.itemTwoMinInStore()));
|
||||
items.add(new Item(config.itemTwoId(), config.itemTwoAmount(), config.itemTwoMinInStore(), 0));
|
||||
}
|
||||
|
||||
if (config.itemThreeEnabled()) {
|
||||
items.add(new Item(config.itemThreeName(), config.itemThreeAmount(), config.itemThreeMinInStore()));
|
||||
items.add(new Item(config.itemThreeId(), config.itemThreeAmount(), config.itemThreeMinInStore(), 0));
|
||||
}
|
||||
|
||||
if (config.itemFourEnabled()) {
|
||||
items.add(new Item(config.itemFourName(), config.itemFourAmount(), config.itemFourMinInStore()));
|
||||
items.add(new Item(config.itemFourId(), config.itemFourAmount(), config.itemFourMinInStore(), 0));
|
||||
}
|
||||
|
||||
if (config.itemFiveEnabled()) {
|
||||
items.add(new Item(config.itemFiveName(), config.itemFiveAmount(), config.itemFiveMinInStore()));
|
||||
items.add(new Item(config.itemFiveId(), config.itemFiveAmount(), config.itemFiveMinInStore(), 0));
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user