quickeater: eating logic moved to gametick, added further debugging for stam pots

This commit is contained in:
illumineawake 2020-08-26 09:31:48 +10:00
parent 0e30a27081
commit a4a9d9af31
5 changed files with 37 additions and 40 deletions

View File

@ -1 +1 @@
[{"projectUrl":"https://discord.gg/9fGzEDR","provider":"illumine","name":"BotUtils","description":"Illumine - Utils required for plugins to function with added automation","id":"botutils-plugin","releases":[{"date":"2020-08-25","sha512sum":"4222FDA8F81AACA118FAACB761AE1A5FF2BE8368612FF9DDC408E5AA3C6ECB89893636B9804671195FD1AA8AC74E350A1FB23D21287D99DD9CE10AE8E1B9A8B0","version":"3.5.2","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/botutils-3.5.2.jar?raw=true","requires":"0.0.1"}]}, {"projectUrl":"https://discord.gg/9fGzEDR","provider":"illumine","name":"Combination Runecrafter Plugin","description":"Illumine - Combination Runecrafting plugin","id":"combinationrunecrafterplugin-plugin","releases":[{"date":"2020-08-25","sha512sum":"03C830A9CB83A3A5D6AE4334EB1FE4ADB14EFD72B496690EEC38DACE04DD339BF775624A47209E0B3AB80D122F88DF21845705E4F13A0952FE3B6D9CF614CE8B","version":"1.7.0","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/combinationrunecrafter-1.7.0.jar?raw=true","requires":"0.0.1"}]}, {"projectUrl":"https://discord.gg/9fGzEDR","provider":"illumine","name":"Magic Splasher","description":"Illumine automated magic splasher","id":"magicsplasher-plugin","releases":[{"date":"2020-08-25","sha512sum":"F278D80AE38F4ADF8380E09BE21106E91A168165516E2B10965FFADECDADAB55002B2CF175A39EB2474D199C7E1963C94802FA9C25846FD653859DF13F52E8A0","version":"2.5.1","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/magicsplasher-2.5.1.jar?raw=true","requires":"0.0.1"}]}, {"projectUrl":"https://discord.gg/9fGzEDR","provider":"illumine","name":"Powerfighter Plugin","description":"Illumine - Powerfighter plugin","id":"powerfighterplugin-plugin","releases":[{"date":"2020-08-25","sha512sum":"1EC777BE768DB9E0A81C8C7D33970FDE846BCE184ABF95D9987A203D745E5DCC1CFF2068299A9D38E9C954F9A0D9306DBB15EA59D4A1A81CF1E81B820F08C986","version":"1.3.0","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/powerfighter-1.3.0.jar?raw=true","requires":"0.0.1"}]}, {"projectUrl":"https://discord.gg/9fGzEDR","provider":"illumine","name":"Power Skiller","description":"Illumine auto power skiller plugin","id":"powerskiller-plugin","releases":[{"date":"2020-08-25","sha512sum":"3BDF23FD85F56895063C3ED65AAF615711F0D3806E2EFB92DA78F3E511351C94877D5CC5E037AEDE7A26B16E36E9A0967D948F0A26372BB9632A7FCEA2A69D3F","version":"4.1.1","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/powerskiller-4.1.1.jar?raw=true","requires":"0.0.1"}]}, {"projectUrl":"https://discord.gg/9fGzEDR","provider":"illumine","name":"Quick Eater","description":"Illumine - auto eat food below configured HP","id":"quickeater-plugin","releases":[{"date":"2020-08-25","sha512sum":"136178D1E0674A76013FE40C0E428F73EAA8223FB4B637A5DE524E15085AEDD884DA95E0FF2EEA2B8D84498254789B60F34157DDC7148D520D0E5EC92CC5FAFD","version":"2.7.1","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/quickeater-2.7.1.jar?raw=true","requires":"0.0.1"}]}, {"projectUrl":"https://discord.gg/9fGzEDR","provider":"illumine","name":"Rooftop Agility","description":"Illumine automated rooftop agility plugin","id":"rooftopagility-plugin","releases":[{"date":"2020-08-25","sha512sum":"C3A97CF51DDD5BF837EB410F5936AF1686E2F9757EBAAE2351B81DEB5187BDF1E71E5825D14A157361A280BD0A370874BFAF88AE11011FB45CB2DEF47FE80009","version":"3.7.0","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/rooftopagility-3.7.0.jar?raw=true","requires":"0.0.1"}]}]
[{"projectUrl":"https://discord.gg/9fGzEDR","provider":"illumine","name":"BotUtils","description":"Illumine - Utils required for plugins to function with added automation","id":"botutils-plugin","releases":[{"date":"2020-08-26","sha512sum":"4222FDA8F81AACA118FAACB761AE1A5FF2BE8368612FF9DDC408E5AA3C6ECB89893636B9804671195FD1AA8AC74E350A1FB23D21287D99DD9CE10AE8E1B9A8B0","version":"3.5.2","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/botutils-3.5.2.jar?raw=true","requires":"0.0.1"}]}, {"projectUrl":"https://discord.gg/9fGzEDR","provider":"illumine","name":"Combination Runecrafter Plugin","description":"Illumine - Combination Runecrafting plugin","id":"combinationrunecrafterplugin-plugin","releases":[{"date":"2020-08-26","sha512sum":"03C830A9CB83A3A5D6AE4334EB1FE4ADB14EFD72B496690EEC38DACE04DD339BF775624A47209E0B3AB80D122F88DF21845705E4F13A0952FE3B6D9CF614CE8B","version":"1.7.0","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/combinationrunecrafter-1.7.0.jar?raw=true","requires":"0.0.1"}]}, {"projectUrl":"https://discord.gg/9fGzEDR","provider":"illumine","name":"Magic Splasher","description":"Illumine automated magic splasher","id":"magicsplasher-plugin","releases":[{"date":"2020-08-26","sha512sum":"F278D80AE38F4ADF8380E09BE21106E91A168165516E2B10965FFADECDADAB55002B2CF175A39EB2474D199C7E1963C94802FA9C25846FD653859DF13F52E8A0","version":"2.5.1","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/magicsplasher-2.5.1.jar?raw=true","requires":"0.0.1"}]}, {"projectUrl":"https://discord.gg/9fGzEDR","provider":"illumine","name":"Powerfighter Plugin","description":"Illumine - Powerfighter plugin","id":"powerfighterplugin-plugin","releases":[{"date":"2020-08-26","sha512sum":"1EC777BE768DB9E0A81C8C7D33970FDE846BCE184ABF95D9987A203D745E5DCC1CFF2068299A9D38E9C954F9A0D9306DBB15EA59D4A1A81CF1E81B820F08C986","version":"1.3.0","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/powerfighter-1.3.0.jar?raw=true","requires":"0.0.1"}]}, {"projectUrl":"https://discord.gg/9fGzEDR","provider":"illumine","name":"Power Skiller","description":"Illumine auto power skiller plugin","id":"powerskiller-plugin","releases":[{"date":"2020-08-26","sha512sum":"3BDF23FD85F56895063C3ED65AAF615711F0D3806E2EFB92DA78F3E511351C94877D5CC5E037AEDE7A26B16E36E9A0967D948F0A26372BB9632A7FCEA2A69D3F","version":"4.1.1","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/powerskiller-4.1.1.jar?raw=true","requires":"0.0.1"}]}, {"projectUrl":"https://discord.gg/9fGzEDR","provider":"illumine","name":"Quick Eater","description":"Illumine - auto eat food below configured HP","id":"quickeater-plugin","releases":[{"date":"2020-08-26","sha512sum":"95F6E7369B6B52F2B05B154ABD842F9833436C002B8599964F2089F8DCE8F05E891BAF54B70A0C1C927479DA95DC552B182FBE860FB3C6F0AB72915A40808398","version":"2.8.0","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/quickeater-2.8.0.jar?raw=true","requires":"0.0.1"}]}, {"projectUrl":"https://discord.gg/9fGzEDR","provider":"illumine","name":"Rooftop Agility","description":"Illumine automated rooftop agility plugin","id":"rooftopagility-plugin","releases":[{"date":"2020-08-26","sha512sum":"C3A97CF51DDD5BF837EB410F5936AF1686E2F9757EBAAE2351B81DEB5187BDF1E71E5825D14A157361A280BD0A370874BFAF88AE11011FB45CB2DEF47FE80009","version":"3.7.0","url":"https://github.com/illumineawake/illu-plugins/blob/master/release/rooftopagility-3.7.0.jar?raw=true","requires":"0.0.1"}]}]

View File

@ -23,7 +23,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
version = "2.7.1"
version = "2.8.0"
project.extra["PluginName"] = "Quick Eater"
project.extra["PluginDescription"] = "Illumine - auto eat food below configured HP"

View File

@ -42,6 +42,7 @@ import net.runelite.api.events.GameTick;
import net.runelite.api.events.HitsplatApplied;
import net.runelite.api.events.StatChanged;
import net.runelite.api.events.VarbitChanged;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.api.widgets.WidgetItem;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
@ -142,7 +143,7 @@ public class QuickEaterPlugin extends Plugin
if (item != null)
{
targetMenu = new MenuEntry("", "", item.getId(), MenuOpcode.ITEM_FIRST_OPTION.getId(), item.getIndex(),
9764864, false);
WidgetInfo.INVENTORY.getId(), false);
utils.setMenuEntry(targetMenu);
utils.delayMouseClick(item.getCanvasBounds(), utils.getRandomIntBetweenRange(25, 200));
}
@ -155,7 +156,7 @@ public class QuickEaterPlugin extends Plugin
{
if (utils.inventoryContains(POISON_SET))
{
log.info("Drinking anti-poison");
log.debug("Drinking anti-poison");
WidgetItem poisonItem = utils.getInventoryWidgetItem(POISON_SET);
useItem(poisonItem);
}
@ -173,10 +174,6 @@ public class QuickEaterPlugin extends Plugin
{
drinkTimeout--;
}
if (!config.drinkStamina())
{
return;
}
player = client.getLocalPlayer();
if (client != null && player != null && client.getGameState() == GameState.LOGGED_IN)
{
@ -185,45 +182,45 @@ public class QuickEaterPlugin extends Plugin
timeout--;
return;
}
if (drinkEnergy == 0)
if (client.getBoostedSkillLevel(Skill.HITPOINTS) <= nextEatHP)
{
drinkEnergy = utils.getRandomIntBetweenRange(config.maxDrinkEnergy() - config.randEnergy(), config.maxDrinkEnergy());
WidgetItem eatItem = utils.getInventoryItemMenu(itemManager, "Eat", 33,
IGNORE_FOOD);
if (eatItem != null)
{
useItem(eatItem);
nextEatHP = utils.getRandomIntBetweenRange(config.minEatHP(), config.maxEatHP());
log.debug("Next Eat HP: {}", nextEatHP);
return;
}
if (utils.inventoryContains(DRINK_SET))
{
WidgetItem drinkItem = utils.getInventoryWidgetItem(DRINK_SET);
useItem(drinkItem);
nextEatHP = utils.getRandomIntBetweenRange(config.minEatHP(), config.maxEatHP());
log.debug("Next Eat HP: {}", nextEatHP);
return;
}
utils.sendGameMessage("Health is below threshold but we're out of food");
}
if (client.getEnergy() < drinkEnergy)
if (config.drinkStamina() && drinkTimeout == 0)
{
utils.drinkStamPot();
drinkEnergy = utils.getRandomIntBetweenRange(config.maxDrinkEnergy() - config.randEnergy(), config.maxDrinkEnergy());
if (drinkEnergy == 0)
{
drinkEnergy = utils.getRandomIntBetweenRange(config.maxDrinkEnergy() - config.randEnergy(), config.maxDrinkEnergy());
log.debug("Max drink energy: {}, Rand drink value: {}, Next drink energy: {}",config.maxDrinkEnergy(), config.randEnergy(), drinkEnergy);
}
if (client.getEnergy() < drinkEnergy)
{
utils.drinkStamPot();
drinkEnergy = utils.getRandomIntBetweenRange(config.maxDrinkEnergy() - config.randEnergy(), config.maxDrinkEnergy());
log.debug("Max drink energy: {}, Rand drink value: {}, Next drink energy: {}",config.maxDrinkEnergy(), config.randEnergy(), drinkEnergy);
drinkTimeout = 2;
}
}
}
}
@Subscribe
private void onHitsplatApplied(HitsplatApplied event)
{
if (event.getActor() != client.getLocalPlayer() || client.getBoostedSkillLevel(Skill.HITPOINTS) > nextEatHP)
{
return;
}
WidgetItem eatItem = utils.getInventoryItemMenu(itemManager, "Eat", 33,
IGNORE_FOOD);
if (eatItem != null)
{
useItem(eatItem);
nextEatHP = utils.getRandomIntBetweenRange(config.minEatHP(), config.maxEatHP());
log.debug("Next Eat HP: {}", nextEatHP);
return;
}
if (utils.inventoryContains(DRINK_SET))
{
WidgetItem drinkItem = utils.getInventoryWidgetItem(DRINK_SET);
useItem(drinkItem);
nextEatHP = utils.getRandomIntBetweenRange(config.minEatHP(), config.maxEatHP());
log.debug("Next Eat HP: {}", nextEatHP);
return;
}
utils.sendGameMessage("Health is below threshold but we're out of food");
}
@Subscribe
protected void onGameStateChanged(GameStateChanged event)
{

Binary file not shown.

Binary file not shown.