Add various new scripts

This commit is contained in:
2022-01-19 12:35:11 +01:00
parent fb86f97efa
commit 78786709eb
84 changed files with 2674 additions and 76 deletions

View File

@ -0,0 +1,53 @@
/*
* 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.superglassmake;
import net.runelite.client.config.Button;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup("chaossuperglassmake")
public interface Config extends net.runelite.client.config.Config {
@ConfigItem(
keyName = "pickupGlass",
name = "Pickup glass",
description = "Pickup any glass spilling out of the inventory.",
position = 0
)
default boolean pickupGlass() {
return true;
}
@ConfigItem(
keyName = "startButton",
name = "Start/Stop",
description = "Start the script",
position = 100
)
default Button startButton() {
return new Button();
}
}

View File

@ -0,0 +1,44 @@
package io.reisub.openosrs.superglassmake;
import com.google.inject.Provides;
import io.reisub.openosrs.superglassmake.tasks.CastSuperglassMake;
import io.reisub.openosrs.superglassmake.tasks.HandleBank;
import io.reisub.openosrs.superglassmake.tasks.PickupGlass;
import io.reisub.openosrs.util.CScript;
import io.reisub.openosrs.util.Util;
import io.reisub.openosrs.util.tasks.Run;
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 Superglass Make",
description = "A super Superglass Make caster",
enabledByDefault = false
)
@Slf4j
public class SuperglassMake 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(PickupGlass.class);
addTask(CastSuperglassMake.class);
addTask(HandleBank.class);
}
}

View File

@ -0,0 +1,31 @@
package io.reisub.openosrs.superglassmake.tasks;
import io.reisub.openosrs.util.Task;
import net.runelite.api.ItemID;
import net.runelite.client.plugins.iutils.api.Spells;
import net.runelite.client.plugins.iutils.game.iWidget;
public class CastSuperglassMake extends Task {
@Override
public String getStatus() {
return "Casting Superglass Make";
}
@Override
public boolean validate() {
return game.inventory().withId(ItemID.BUCKET_OF_SAND).exists()
&& (game.inventory().withId(ItemID.SODA_ASH).exists() || (game.inventory().withId(ItemID.GIANT_SEAWEED).exists()))
&& game.inventory().withId(ItemID.ASTRAL_RUNE).exists()
&& !bank.isOpen();
}
@Override
public void execute() {
iWidget spellWidget = game.widget(Spells.SUPERGLASS_MAKE.getInfo());
if (spellWidget == null) return;
spellWidget.interact("Cast");
game.waitUntil(() -> game.inventory().withId(ItemID.MOLTEN_GLASS).exists(), 5);
game.tick(3);
}
}

View File

@ -0,0 +1,73 @@
package io.reisub.openosrs.superglassmake.tasks;
import io.reisub.openosrs.superglassmake.SuperglassMake;
import io.reisub.openosrs.util.Task;
import net.runelite.api.ItemID;
import net.runelite.client.plugins.iutils.game.iObject;
import net.runelite.client.plugins.iutils.scene.Position;
import javax.inject.Inject;
import java.time.Duration;
import java.time.Instant;
public class HandleBank extends Task {
@Inject
private SuperglassMake plugin;
private Instant last = Instant.EPOCH;
@Override
public String getStatus() {
return "Banking";
}
@Override
public boolean validate() {
return !game.inventory().withId(ItemID.BUCKET_OF_SAND).exists();
}
@Override
public void execute() {
if (!bank.isOpen()) {
iObject bankObj = game.objects().withName("Bank chest", "Bank booth", "Bank Chest-wreck", "Bank chest").withPosition(new Position(2098, 3920, 0)).nearest();
if (bankObj == null) return;
if (bankObj.actions().contains("Bank")) {
bankObj.interact("Bank");
} else if (bankObj.actions().contains("Use")) {
bankObj.interact("Use");
} else {
bankObj.interact(0);
}
game.waitUntil(() -> bank.isOpen(), 3);
}
bank.depositExcept(false, ItemID.ASTRAL_RUNE);
game.sleepDelay();
if (bank.quantity(ItemID.BUCKET_OF_SAND) == 0 || (bank.quantity(ItemID.SODA_ASH) == 0 && bank.quantity(ItemID.GIANT_SEAWEED) == 0)) {
plugin.stop("Out of materials, stopping plugin");
}
if (bank.contains(ItemID.SODA_ASH)) {
bank.withdraw(ItemID.BUCKET_OF_SAND, 13, false);
game.sleepDelay();
bank.withdraw(ItemID.SODA_ASH, 13, false);
game.sleepDelay();
} else {
bank.withdraw(ItemID.BUCKET_OF_SAND, 18, false);
game.sleepDelay();
for (int i = 0; i < 3; i++) {
bank.withdraw(ItemID.GIANT_SEAWEED, 1, false);
game.sleepDelay();
}
}
bank.close();
game.waitUntil(() -> game.inventory().withId(ItemID.BUCKET_OF_SAND).exists(), 5);
last = Instant.now();
}
}

View File

@ -0,0 +1,39 @@
package io.reisub.openosrs.superglassmake.tasks;
import io.reisub.openosrs.superglassmake.Config;
import io.reisub.openosrs.util.Task;
import net.runelite.api.ItemID;
import net.runelite.client.plugins.iutils.game.iGroundItem;
import javax.inject.Inject;
import java.time.Duration;
import java.time.Instant;
public class PickupGlass extends Task {
@Inject
private Config config;
private Instant last = Instant.EPOCH;
@Override
public String getStatus() {
return "Picking up glass";
}
@Override
public boolean validate() {
return config.pickupGlass()
&& Duration.between(last, Instant.now()).getSeconds() > 5
&& game.groundItems().withId(ItemID.MOLTEN_GLASS).withPosition(game.localPlayer().position()).exists();
}
@Override
public void execute() {
for (iGroundItem glass : game.groundItems().withId(ItemID.MOLTEN_GLASS).withPosition(game.localPlayer().position()).all()) {
glass.interact(0);
game.sleepDelay();
}
last = Instant.now();
}
}

View 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 Superglass Make" // This is the name that is used in the external plugin manager panel
project.extra["PluginDescription"] = "A super Superglass Make caster" // 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"]
))
}
}
}