Skip to content

Commit

Permalink
add antivenom + antifire to upkeep
Browse files Browse the repository at this point in the history
  • Loading branch information
Ethan-Vann committed Aug 12, 2023
1 parent c00e0de commit 660be4e
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 30 deletions.
28 changes: 20 additions & 8 deletions src/main/java/com/example/UpkeepPlugin/UpkeepPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.Skill;
import net.runelite.api.VarPlayer;
import net.runelite.api.Varbits;
import net.runelite.api.events.GameTick;
import net.runelite.api.widgets.Widget;
import net.runelite.client.config.ConfigManager;
Expand Down Expand Up @@ -81,14 +83,12 @@ public void onGameTick(GameTick event) throws NoSuchFieldException, ClassNotFoun
if (strength < config.StrengthLowAmount()) {
handleAction(config.StrengthActions());
}
// if (client.getVarbitValue(102) == 0 && !config.AntiPoisonActions().trim().isEmpty())
// {
// handleAction(config.AntiPoisonActions());
// }
// if (client.getVarbitValue(Varbits.ANTIFIRE) == 0 && client.getVarbitValue(Varbits.SUPER_ANTIFIRE) == 0 && !config.AntiFireActions().trim().isEmpty())
// {
// handleAction(config.AntiFireActions());
// }
if (config.AntiFireToggle()) {
handleAntiFire();
}
if (config.AntiVenomToggle()) {
handleAntiVenom();
}
}

public void handleAction(String actionParam) {
Expand All @@ -111,4 +111,16 @@ public void handleAction(String actionParam) {
}
}
}

public void handleAntiFire() {
if (client.getVarbitValue(Varbits.ANTIFIRE) == 0 && client.getVarbitValue(Varbits.SUPER_ANTIFIRE) == 0) {
handleAction(config.AntiFireActions());
}
}

public void handleAntiVenom() {
if (client.getVarpValue(VarPlayer.POISON) > 0) {
handleAction(config.AntiPoisonActions());
}
}
}
61 changes: 39 additions & 22 deletions src/main/java/com/example/UpkeepPlugin/UpkeepPluginConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,26 +113,43 @@ default int StrengthLowAmount() {
default String StrengthActions() {
return "";
}
//
// @ConfigItem(
// keyName = "AntiFireActions",
// name = "AntiFire Actions",
// description = "List of item actions to use when not antifired",
// position = 200
// )
// default String AntiFireActions()
// {
// return "";
// }
//
// @ConfigItem(
// keyName = "AntiPoisonActions",
// name = "AntiPoison Actions",
// description = "List of item actions to use when not antipoisoned/antivenomed",
// position = 201
// )
// default String AntiPoisonActions()
// {
// return "";
// }

@ConfigItem(
keyName = "AntiFireToggle",
name = "AntiFire Toggle",
description = "",
position = 200
)
default boolean AntiFireToggle() {
return false;
}

@ConfigItem(
keyName = "AntiFireActions",
name = "AntiFire Actions",
description = "List of item actions to use when not anti-fired",
position = 201
)
default String AntiFireActions() {
return "";
}

@ConfigItem(
keyName = "AntiVenomToggle",
name = "AntiVenom Toggle",
description = "",
position = 202
)
default boolean AntiVenomToggle() {
return false;
}
@ConfigItem(
keyName = "AntiVenomActions",
name = "AntiVenom Actions",
description = "List of item actions to use when infliced with venom/poison",
position = 203
)
default String AntiPoisonActions() {
return "";
}
}

0 comments on commit 660be4e

Please sign in to comment.