Merge pull request #33 from geeckon/master

Add bonus action tracker
This commit is contained in:
Patrick Watts
2024-09-18 11:34:24 +04:00
committed by GitHub
4 changed files with 67 additions and 4 deletions

View File

@@ -12,7 +12,6 @@ import net.runelite.client.ui.ColorScheme;
@ConfigGroup(EasyGiantsFoundryConfig.GROUP)
public interface EasyGiantsFoundryConfig extends Config
{
String GROUP = "easygiantsfoundry";
String SOUND_ID = "soundID";
String POINTS_KEY = "easygiantsfoundrypoints";
@@ -315,11 +314,23 @@ public interface EasyGiantsFoundryConfig extends Config
return true;
}
@ConfigItem(
keyName = "bonusActions",
name = "Bonus Actions",
description = "Toggle for Bonus actions text",
position = 5,
section = infoPanelList
)
default boolean drawBonusActions()
{
return true;
}
@ConfigItem(
keyName = "shopPoints",
name = "Reputation",
description = "Toggle for reputation text",
position = 5,
position = 6,
section = infoPanelList
)
default boolean drawShopPoints()
@@ -327,7 +338,6 @@ public interface EasyGiantsFoundryConfig extends Config
return false;
}
@ConfigSection(
name = "Info Overlay",
description = "Overlay Text Info On Objects",

View File

@@ -383,6 +383,8 @@ public class EasyGiantsFoundryPlugin extends Plugin
return;
}
state.addBonusActionReceived();
if (config.bonusNotification())
{
notifier.notify("Bonus - Click tool");

View File

@@ -29,6 +29,9 @@ public class EasyGiantsFoundryState
@Getter
private boolean enabled;
@Getter
private int bonusActionsReceived = 0;
@Setter
private int smithsOutfitPieces;
@@ -39,6 +42,7 @@ public class EasyGiantsFoundryState
{
stages.clear();
heatRangeRatio = 0;
bonusActionsReceived = 0;
}
public int getHeatAmount()
@@ -187,6 +191,21 @@ public class EasyGiantsFoundryState
return 0;
}
public int getBonusActionsExpected()
{
if (getStages().size() >= 6)
{
return 3;
}
return 2;
}
public void addBonusActionReceived()
{
++bonusActionsReceived;
}
public int getCrucibleCount()
{
int bronze = client.getVarbitValue(VARBIT_BRONZE_COUNT);
@@ -292,5 +311,4 @@ public class EasyGiantsFoundryState
}
public HeatActionStateMachine heatingCoolingState = new HeatActionStateMachine();
}

View File

@@ -4,12 +4,14 @@ import static com.toofifty.easygiantsfoundry.EasyGiantsFoundryHelper.getHeatColo
import com.toofifty.easygiantsfoundry.enums.Heat;
import com.toofifty.easygiantsfoundry.enums.Stage;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import javax.inject.Inject;
import javax.inject.Singleton;
import net.runelite.api.Client;
import net.runelite.client.ui.ColorScheme;
import net.runelite.client.ui.overlay.OverlayPanel;
import net.runelite.client.ui.overlay.OverlayPosition;
import net.runelite.client.ui.overlay.components.LineComponent;
@@ -38,6 +40,31 @@ public class FoundryOverlay2D extends OverlayPanel
this.setPosition(OverlayPosition.BOTTOM_LEFT);
}
private Color getHeatColor(int actions, int heat)
{
if (heat >= actions)
{
return ColorScheme.PROGRESS_COMPLETE_COLOR;
}
if (heat > 0)
{
return ColorScheme.PROGRESS_INPROGRESS_COLOR;
}
return ColorScheme.PROGRESS_ERROR_COLOR;
}
private Color getBonusActionsColor(int received, int expected)
{
if (received >= expected)
{
return ColorScheme.PROGRESS_COMPLETE_COLOR;
}
return ColorScheme.PROGRESS_INPROGRESS_COLOR;
}
@Override
public Dimension render(Graphics2D graphics)
{
@@ -85,6 +112,12 @@ public class FoundryOverlay2D extends OverlayPanel
LineComponent.builder().left("Heat left").right(heatLeft + "").rightColor(getHeatColor(actionsLeft, heatLeft)).build()
);
}
if (config.drawBonusActions())
{
panelComponent.getChildren().add(
LineComponent.builder().left("Bonus actions").right(state.getBonusActionsReceived() + "/" + state.getBonusActionsExpected()).rightColor(getBonusActionsColor(state.getBonusActionsReceived(), state.getBonusActionsExpected())).build()
);
}
}
//
// int points = plugin.getPointsTracker().getShopPoints();