Add various new scripts
This commit is contained in:
@ -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.volcanicashminer;
|
||||
|
||||
import net.runelite.client.config.Button;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup("chaosvolcanicashminer")
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package io.reisub.openosrs.volcanicashminer;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
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 io.reisub.openosrs.volcanicashminer.tasks.Drop;
|
||||
import io.reisub.openosrs.volcanicashminer.tasks.Mine;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.AnimationID;
|
||||
import net.runelite.api.GameObject;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.events.AnimationChanged;
|
||||
import net.runelite.api.events.GameObjectDespawned;
|
||||
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;
|
||||
|
||||
@Extension
|
||||
@PluginDependency(Util.class)
|
||||
@PluginDependency(iUtils.class)
|
||||
@PluginDescriptor(
|
||||
name = "Chaos Volcanic Ash Miner",
|
||||
description = "Mines volcanic ash.",
|
||||
enabledByDefault = false
|
||||
)
|
||||
@Slf4j
|
||||
public class VolcanicAshMiner 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);
|
||||
addTask(Drop.class);
|
||||
addTask(Mine.class);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Subscribe
|
||||
private void onAnimationChanged(AnimationChanged event) {
|
||||
if (game.client().getGameState() != GameState.LOGGED_IN) return;
|
||||
if (event.getActor() == null || event.getActor().getName() == null) return;
|
||||
|
||||
if (!event.getActor().getName().equals(game.localPlayer().name())) return;
|
||||
|
||||
switch (game.localPlayer().animation()) {
|
||||
case AnimationID.MINING_BRONZE_PICKAXE:
|
||||
case AnimationID.MINING_IRON_PICKAXE:
|
||||
case AnimationID.MINING_STEEL_PICKAXE:
|
||||
case AnimationID.MINING_BLACK_PICKAXE:
|
||||
case AnimationID.MINING_MITHRIL_PICKAXE:
|
||||
case AnimationID.MINING_ADAMANT_PICKAXE:
|
||||
case AnimationID.MINING_RUNE_PICKAXE:
|
||||
case AnimationID.MINING_GILDED_PICKAXE:
|
||||
case AnimationID.MINING_DRAGON_PICKAXE:
|
||||
case AnimationID.MINING_DRAGON_PICKAXE_UPGRADED:
|
||||
case AnimationID.MINING_INFERNAL_PICKAXE:
|
||||
case AnimationID.MINING_CRYSTAL_PICKAXE:
|
||||
setActivity(Activity.MINING);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Subscribe
|
||||
private void onGameObjectDespawned(GameObjectDespawned event) {
|
||||
if (game.client().getGameState() != GameState.LOGGED_IN) return;
|
||||
GameObject object = event.getGameObject();
|
||||
|
||||
if (object.getName().equals("Ash pile") && game.client().getLocalPlayer().getWorldLocation().distanceTo(object.getWorldLocation()) < 3) {
|
||||
setActivity(Activity.IDLE);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Subscribe
|
||||
private void onItemContainerChanged(ItemContainerChanged event) {
|
||||
if (game.client().getGameState() != GameState.LOGGED_IN) return;
|
||||
|
||||
if (game.inventory().withName("Soda ash").exists()) {
|
||||
setActivity(Activity.IDLE);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package io.reisub.openosrs.volcanicashminer.tasks;
|
||||
|
||||
import io.reisub.openosrs.util.Task;
|
||||
|
||||
public class Drop extends Task {
|
||||
@Override
|
||||
public String getStatus() {
|
||||
return "Dropping soda ash";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validate() {
|
||||
return game.inventory().withName("Soda ash").exists();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
game.inventory().withName("Soda ash").drop();
|
||||
game.tick();
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package io.reisub.openosrs.volcanicashminer.tasks;
|
||||
|
||||
import io.reisub.openosrs.util.Task;
|
||||
import io.reisub.openosrs.util.enums.Activity;
|
||||
import io.reisub.openosrs.volcanicashminer.VolcanicAshMiner;
|
||||
import net.runelite.client.plugins.iutils.game.iObject;
|
||||
import net.runelite.client.plugins.iutils.scene.Position;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class Mine extends Task {
|
||||
@Inject
|
||||
private VolcanicAshMiner plugin;
|
||||
|
||||
private final Position[] ASH_PILE_POSITIONS = new Position[]{
|
||||
new Position(3794, 3773, 0),
|
||||
new Position(3789, 3769, 0),
|
||||
new Position(3781, 3774, 0)
|
||||
};
|
||||
|
||||
@Override
|
||||
public String getStatus() {
|
||||
return "Mining";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validate() {
|
||||
iObject ashPile = game.objects().withPosition(ASH_PILE_POSITIONS).withName("Ash pile").nearest();
|
||||
|
||||
return plugin.getCurrentActivity() == Activity.IDLE
|
||||
&& game.localPlayer().isIdle()
|
||||
&& ashPile != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
iObject ashPile = game.objects().withPosition(ASH_PILE_POSITIONS).withName("Ash pile").nearest();
|
||||
|
||||
ashPile.interact("Mine");
|
||||
game.waitUntil(() -> game.localPlayer().animation() != -1, 15);
|
||||
}
|
||||
}
|
52
volcanicashminer/volcanicashminer.gradle.kts
Normal file
52
volcanicashminer/volcanicashminer.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 Volcanic Ash Miner" // This is the name that is used in the external plugin manager panel
|
||||
project.extra["PluginDescription"] = "Mines volcanic ash" // 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"]
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user