Skip to content

Commit

Permalink
Fixed mispelling of thieving in AutoThiever plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
ben93riggs committed Aug 21, 2020
1 parent 4f02416 commit c4d0fcc
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

version = "0.6.0"

project.extra["PluginName"] = "Auto Theiver"
project.extra["PluginDescription"] = "Automatically theives from npcs"
project.extra["PluginName"] = "Auto Thiever"
project.extra["PluginDescription"] = "Automatically thieves from npcs"

tasks {
jar {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package net.runelite.client.plugins.autotheiver;
package net.runelite.client.plugins.autothiever;

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("autotheiver")
public interface AutoTheiverConfig extends Config
@ConfigGroup("autothiever")
public interface AutoThieverConfig extends Config
{
@ConfigItem(
keyName = "hpCheckStyle",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.runelite.client.plugins.autotheiver;
package net.runelite.client.plugins.autothiever;

import com.google.inject.Provides;
import java.awt.Dimension;
Expand All @@ -14,6 +14,7 @@
import javax.inject.Inject;
import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
import net.runelite.api.GameObject;
import net.runelite.api.ItemID;
import net.runelite.api.MenuEntry;
import net.runelite.api.MenuOpcode;
Expand All @@ -24,6 +25,7 @@
import net.runelite.api.events.ConfigButtonClicked;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.queries.GameObjectQuery;
import net.runelite.api.queries.NPCQuery;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
Expand All @@ -38,66 +40,62 @@

@Extension
@PluginDescriptor(
name = "Auto Theiver",
description = "Automatically theives npcs",
tags = {"auto", "theiver", "theiving", "skill", "skilling"},
name = "Auto Thiever",
description = "Automatically thieves npcs",
tags = {"auto", "thiever", "thieving", "skill", "skilling"},
enabledByDefault = false,
type = PluginType.SKILLING
)
public class AutoTheiverPlugin extends Plugin
public class AutoThieverPlugin extends Plugin
{
@Inject
private Client client;

@Inject
private AutoTheiverConfig config;
private AutoThieverConfig config;

@Inject
private ItemManager itemManager;

private MenuEntry entry;
private int entryTimeout;

private Random r = new Random();

private int nextOpenPouchCount;
private boolean emptyPouches = false;

private boolean pluginStarted = false;
private int tickDelay = 0;
private int frameDelay = 0;

private BlockingQueue<Runnable> queue = new ArrayBlockingQueue<>(1);
private ThreadPoolExecutor executor = new ThreadPoolExecutor(1, 1, 25, TimeUnit.SECONDS, queue,
new ThreadPoolExecutor.DiscardPolicy());

@Provides
AutoTheiverConfig provideConfig(final ConfigManager configManager)
AutoThieverConfig provideConfig(final ConfigManager configManager)
{
return configManager.getConfig(AutoTheiverConfig.class);
return configManager.getConfig(AutoThieverConfig.class);
}

@Override
protected void startUp() throws Exception
{
nextOpenPouchCount = getRandom(1, 28);
}

@Override
protected void shutDown() throws Exception
{
executor.shutdownNow();
}

@Subscribe
public void onConfigButtonClicked(ConfigButtonClicked event)
{
if (!event.getGroup().equals("autotheiver"))
if (!event.getGroup().equals("autothiever"))
{
return;
}

if (event.getKey().equals("startButton"))
{
pluginStarted = true;
nextOpenPouchCount = getRandom(1, 28);
}
else if (event.getKey().equals("stopButton"))
{
Expand All @@ -123,6 +121,7 @@ else if (message.startsWith("You fail to pick") || message.startsWith("You fail
else if (message.startsWith("You open all of the pouches"))
{
emptyPouches = false;
nextOpenPouchCount = getRandom(1, 28);
}
}
else if (event.getType() == ChatMessageType.GAMEMESSAGE)
Expand Down Expand Up @@ -151,6 +150,8 @@ public void onGameTick(GameTick event)
return;
}

handleRandomPouchOpening();

if (emptyPouches)
{
openPouches();
Expand All @@ -173,6 +174,25 @@ public void onGameTick(GameTick event)
tickDelay = 1;
}

public void handleRandomPouchOpening()
{
WidgetItem item = getInventoryItem(ItemID.COIN_POUCH, ItemID.COIN_POUCH_22522, ItemID.COIN_POUCH_22523, ItemID.COIN_POUCH_22524,
ItemID.COIN_POUCH_22525, ItemID.COIN_POUCH_22526, ItemID.COIN_POUCH_22527, ItemID.COIN_POUCH_22528,
ItemID.COIN_POUCH_22529, ItemID.COIN_POUCH_22530, ItemID.COIN_POUCH_22531, ItemID.COIN_POUCH_22532,
ItemID.COIN_POUCH_22533, ItemID.COIN_POUCH_22534, ItemID.COIN_POUCH_22535, ItemID.COIN_POUCH_22536,
ItemID.COIN_POUCH_22537, ItemID.COIN_POUCH_22538);

if (item == null)
{
return;
}

if (item.getQuantity() >= nextOpenPouchCount)
{
emptyPouches = true;
}
}

public void openPouches()
{
WidgetItem item = getInventoryItem(ItemID.COIN_POUCH, ItemID.COIN_POUCH_22522, ItemID.COIN_POUCH_22523, ItemID.COIN_POUCH_22524,
Expand Down Expand Up @@ -248,7 +268,6 @@ public void onMenuOptionClicked(MenuOptionClicked event)
}

entry = null;
entryTimeout = 0;
}

public void click()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.runelite.client.plugins.autotheiver;
package net.runelite.client.plugins.autothiever;

public enum HealthCheckStyle
{
Expand Down

0 comments on commit c4d0fcc

Please sign in to comment.