Initial commit

This commit is contained in:
2022-01-08 19:46:18 +01:00
commit 57ba5a5858
207 changed files with 12402 additions and 0 deletions

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 Master Thiever" // This is the name that is used in the external plugin manager panel
project.extra["PluginDescription"] = "Steals seeds from master farmers" // 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"]
))
}
}
}

View File

@ -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.masterthiever;
import net.runelite.client.config.Button;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup("ChaosMasterThieverConfig")
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();
}
}

View File

@ -0,0 +1,96 @@
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.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 Master Thiever",
description = "Steals seeds from master farmers.",
enabledByDefault = false
)
@Slf4j
public class MasterThiever extends iScript {
private List<Task> tasks;
private KittenTask kittenTask;
@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");
Eat eatTask = injector.getInstance(Eat.class);
eatTask.setInterval(14, 24);
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;
}
@Subscribe
private void onConfigButtonPressed(ConfigButtonClicked configButtonClicked) {
if (configButtonClicked.getKey().equals("startButton")) {
execute();
}
}
@Subscribe
private void onChatMessage(ChatMessage chatMessage) {
if (kittenTask != null) {
kittenTask.onChatMessage(chatMessage);
}
}
}

View File

@ -0,0 +1,53 @@
package io.reisub.openosrs.masterthiever.tasks;
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.scene.Position;
import java.util.function.Predicate;
public class HandleBank extends Task {
@Override
public String getStatus() {
return "Banking";
}
@Override
public boolean validate() {
return game.client().getLocalPlayer().getModelHeight() != 1000
&& (game.inventory().full()
|| (!game.inventory().withAction("Eat").exists() && game.modifiedLevel(Skill.HITPOINTS) <= 35));
}
@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();
}
if (bankObj == null) return;
bankObj.interact("Bank");
game.waitUntil(() -> bank.isOpen(), 15);
}
bank.depositInventory();
game.tick();
int quantity = 5 + (game.baseLevel(Skill.HITPOINTS) - game.modifiedLevel(Skill.HITPOINTS)) / 9;
bank.withdraw(ItemID.SALMON, quantity, false);
game.waitUntil(() -> game.inventory().withAction("Eat", "Drink").count() > 1, 6);
bank.close();
game.waitUntil(() -> !bank.isOpen(), 3);
}
}

View File

@ -0,0 +1,31 @@
package io.reisub.openosrs.masterthiever.tasks;
import io.reisub.openosrs.util.Task;
import net.runelite.api.NpcID;
import net.runelite.api.Skill;
import net.runelite.client.plugins.iutils.game.iNPC;
public class Steal extends Task {
@Override
public String getStatus() {
return "Pickpocketing";
}
@Override
public boolean validate() {
return !game.inventory().full()
&& game.client().getLocalPlayer().getModelHeight() != 1000
&& (game.inventory().withAction("Eat").exists() || game.modifiedLevel(Skill.HITPOINTS) > 35);
}
@Override
public void execute() {
iNPC farmer = game.npcs().withId(NpcID.MASTER_FARMER, NpcID.MASTER_FARMER_5731).nearest();
if (farmer == null) return;
farmer.interact("Pickpocket");
game.tick(calc.random(0, 2));
game.sleepDelay();
}
}