Initial commit
This commit is contained in:
52
autobones/autobones.gradle.kts
Normal file
52
autobones/autobones.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 Autobones" // This is the name that is used in the external plugin manager panel
|
||||
project.extra["PluginDescription"] = "Buries ashes and scatters bones, or something like that." // 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,17 @@
|
||||
package io.reisub.openosrs.autobones;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.ItemID;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum Ashes {
|
||||
FIENDISH_ASHES(ItemID.FIENDISH_ASHES),
|
||||
VILE_ASHES(ItemID.VILE_ASHES),
|
||||
MALICIOUS_ASHES(ItemID.MALICIOUS_ASHES),
|
||||
ABYSSAL_ASHES(ItemID.ABYSSAL_ASHES),
|
||||
INFERNAL_ASHES(ItemID.INFERNAL_ASHES);
|
||||
|
||||
private final int id;
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package io.reisub.openosrs.autobones;
|
||||
|
||||
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;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
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;
|
||||
|
||||
@Extension
|
||||
@PluginDependency(Util.class)
|
||||
@PluginDependency(iUtils.class)
|
||||
@PluginDescriptor(
|
||||
name = "Chaos Autobones",
|
||||
description = "Buries ashes and scatters bones, or something like that.",
|
||||
enabledByDefault = false
|
||||
)
|
||||
@Slf4j
|
||||
public class Autobones extends Plugin {
|
||||
@SuppressWarnings("unused")
|
||||
@Inject
|
||||
private Game game;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Inject
|
||||
private Config config;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Provides
|
||||
Config provideConfig(ConfigManager configManager) {
|
||||
return configManager.getConfig(Config.class);
|
||||
}
|
||||
|
||||
private ScheduledExecutorService executor;
|
||||
|
||||
@Override
|
||||
protected void startUp() {
|
||||
log.info("Starting Chaos Autobones");
|
||||
|
||||
executor = Executors.newSingleThreadScheduledExecutor();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() {
|
||||
log.info("Stopping Chaos Autobones");
|
||||
|
||||
executor.shutdownNow();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Subscribe
|
||||
private void onItemContainerChanged(ItemContainerChanged event) {
|
||||
if (game.client().getGameState() != GameState.LOGGED_IN) return;
|
||||
|
||||
if (config.bones().getId() == -1 && config.ashes().getId() == -1) return;
|
||||
|
||||
executor.schedule(() -> {
|
||||
game.inventory().withId(config.bones().getId(), config.ashes().getId()).first().interact(0);
|
||||
}, 0, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package io.reisub.openosrs.autobones;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.ItemID;
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum Bones {
|
||||
NONE(-1),
|
||||
BONES(ItemID.BONES),
|
||||
WOLF_BONES(ItemID.WOLF_BONES),
|
||||
BURNT_BONES(ItemID.BURNT_BONES),
|
||||
MONKEY_BONES(ItemID.MONKEY_BONES),
|
||||
BAT_BONES(ItemID.BAT_BONES),
|
||||
BIG_BONES(ItemID.BIG_BONES),
|
||||
JOGRE_BONES(ItemID.JOGRE_BONES),
|
||||
ZOGRE_BONES(ItemID.ZOGRE_BONES),
|
||||
SHAIKAHAN_BONES(ItemID.SHAIKAHAN_BONES),
|
||||
BABYDRAGON_BONES(ItemID.BABYDRAGON_BONES),
|
||||
WYRM_BONES(ItemID.WYRM_BONES),
|
||||
WYVERN_BONES(ItemID.WYVERN_BONES),
|
||||
DRAGON_BONES(ItemID.DRAGON_BONES),
|
||||
DRAKE_BONES(ItemID.DRAKE_BONES),
|
||||
FAYRG_BONES(ItemID.FAYRG_BONES),
|
||||
LAVA_DRAGON_BONES(ItemID.LAVA_DRAGON_BONES),
|
||||
RAURG_BONES(ItemID.RAURG_BONES),
|
||||
HYDRA_BONES(ItemID.HYDRA),
|
||||
DAGANNOTH_BONES(ItemID.DAGANNOTH_BONES),
|
||||
OURG_BONES(ItemID.OURG_BONES),
|
||||
SUPERIOR_DRAGON_BONES(ItemID.SUPERIOR_DRAGON_BONES);
|
||||
|
||||
private final int id;
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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.autobones;
|
||||
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup("chaosautobones")
|
||||
|
||||
public interface Config extends net.runelite.client.config.Config {
|
||||
@ConfigItem(
|
||||
keyName = "bones",
|
||||
name = "Bones",
|
||||
description = "Choose which bones to auto-bury.",
|
||||
position = 0
|
||||
)
|
||||
default Bones bones() { return Bones.BIG_BONES; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "ashes",
|
||||
name = "Ashes",
|
||||
description = "Choose which ashes to auto-bury.",
|
||||
position = 1
|
||||
)
|
||||
default Ashes ashes() { return Ashes.VILE_ASHES; }
|
||||
}
|
Reference in New Issue
Block a user