Add bonus action tracker

This commit is contained in:
geeckon
2024-02-10 23:44:37 +02:00
parent b08dab0192
commit 64d3c5c121
4 changed files with 48 additions and 1 deletions

View File

@@ -223,11 +223,22 @@ public interface EasyGiantsFoundryConfig extends Config {
return true; return true;
} }
@ConfigItem(
keyName = "bonusActions",
name = "Bonus Actions",
description = "Toggle for Bonus actions text",
position = 5,
section = infoPanelList
)
default boolean drawBonusActions() {
return true;
}
@ConfigItem( @ConfigItem(
keyName = "shopPoints", keyName = "shopPoints",
name = "Reputation", name = "Reputation",
description = "Toggle for reputation text", description = "Toggle for reputation text",
position = 5, position = 6,
section = infoPanelList section = infoPanelList
) )
default boolean drawShopPoints() default boolean drawShopPoints()

View File

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

View File

@@ -50,6 +50,9 @@ public class EasyGiantsFoundryState
@Getter @Getter
private boolean enabled; private boolean enabled;
@Getter
private int bonusActionsReceived = 0;
private final List<Stage> stages = new ArrayList<>(); private final List<Stage> stages = new ArrayList<>();
private double heatRangeRatio = 0; private double heatRangeRatio = 0;
@@ -57,6 +60,7 @@ public class EasyGiantsFoundryState
{ {
stages.clear(); stages.clear();
heatRangeRatio = 0; heatRangeRatio = 0;
bonusActionsReceived = 0;
} }
public int getHeatAmount() public int getHeatAmount()
@@ -204,4 +208,18 @@ public class EasyGiantsFoundryState
else else
return 0; return 0;
} }
public int getBonusActionsExpected()
{
if (getStages().size() >= 6) {
return 3;
}
return 2;
}
public void addBonusActionReceived()
{
++bonusActionsReceived;
}
} }

View File

@@ -50,6 +50,16 @@ public class FoundryOverlay2D extends OverlayPanel
return ColorScheme.PROGRESS_ERROR_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 @Override
public Dimension render(Graphics2D graphics) public Dimension render(Graphics2D graphics)
{ {
@@ -96,6 +106,12 @@ public class FoundryOverlay2D extends OverlayPanel
LineComponent.builder().left("Heat left").right(heatLeft + "").rightColor(getHeatColor(actionsLeft, heatLeft)).build() 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(); // int points = plugin.getPointsTracker().getShopPoints();