Add relevant tool highlighting feature
This commit is contained in:
@@ -8,9 +8,15 @@ Helpful overlays for the Giant's Foundry minigame
|
|||||||
- Shows number of actions required to move to the next stage
|
- Shows number of actions required to move to the next stage
|
||||||
- Shows number of actions before gaining/losing too much heat
|
- Shows number of actions before gaining/losing too much heat
|
||||||
- Shows best moulds to use
|
- Shows best moulds to use
|
||||||
|
- Highlights relevant tool with status colors
|
||||||
|
* Red = Wrong temperature
|
||||||
|
* Green = Right temperature
|
||||||
|
* Orange = one action or temperature change remaining
|
||||||
|
* Cyan = Click tool again for bonus progress
|
||||||
|
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
- [Patrick](https://github.com/pwatts6060 "Patrick's github")
|
- [Patrick](https://github.com/pwatts6060 "Patrick's github")
|
||||||
* Best moulds interface feature
|
* Best moulds interface feature
|
||||||
|
* Highlight relevant tools with status colors
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public class EasyGiantsFoundryHelper
|
|||||||
{
|
{
|
||||||
Heat heatStage = state.getCurrentHeat();
|
Heat heatStage = state.getCurrentHeat();
|
||||||
Stage stage = state.getCurrentStage();
|
Stage stage = state.getCurrentStage();
|
||||||
if (heatStage.getColor() != stage.getColor())
|
if (heatStage != stage.getHeat())
|
||||||
{
|
{
|
||||||
// not the right heat to start with
|
// not the right heat to start with
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.toofifty.easygiantsfoundry;
|
package com.toofifty.easygiantsfoundry;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.runelite.api.GameObject;
|
||||||
import net.runelite.api.InventoryID;
|
import net.runelite.api.InventoryID;
|
||||||
import net.runelite.api.events.GameObjectDespawned;
|
import net.runelite.api.events.GameObjectDespawned;
|
||||||
import net.runelite.api.events.GameObjectSpawned;
|
import net.runelite.api.events.GameObjectSpawned;
|
||||||
@@ -20,7 +21,11 @@ import javax.inject.Inject;
|
|||||||
)
|
)
|
||||||
public class EasyGiantsFoundryPlugin extends Plugin
|
public class EasyGiantsFoundryPlugin extends Plugin
|
||||||
{
|
{
|
||||||
|
private static final int TRIP_HAMMER = 44619;
|
||||||
|
private static final int GRINDSTONE = 44620;
|
||||||
private static final int POLISHING_WHEEL = 44621;
|
private static final int POLISHING_WHEEL = 44621;
|
||||||
|
private static final int LAVA_POOL = 44631;
|
||||||
|
private static final int WATERFALL = 44632;
|
||||||
private static final int PREFORM = 27010;
|
private static final int PREFORM = 27010;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@@ -33,7 +38,10 @@ public class EasyGiantsFoundryPlugin extends Plugin
|
|||||||
private OverlayManager overlayManager;
|
private OverlayManager overlayManager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private EasyGiantsFoundryOverlay overlay;
|
private FoundryOverlay2D overlay2d;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private FoundryOverlay3D overlay3d;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private MouldHelper mouldHelper;
|
private MouldHelper mouldHelper;
|
||||||
@@ -41,30 +49,64 @@ public class EasyGiantsFoundryPlugin extends Plugin
|
|||||||
@Override
|
@Override
|
||||||
protected void startUp()
|
protected void startUp()
|
||||||
{
|
{
|
||||||
overlayManager.add(overlay);
|
overlayManager.add(overlay2d);
|
||||||
|
overlayManager.add(overlay3d);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void shutDown()
|
protected void shutDown()
|
||||||
{
|
{
|
||||||
overlayManager.remove(overlay);
|
overlayManager.remove(overlay2d);
|
||||||
|
overlayManager.remove(overlay3d);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onGameObjectSpawned(GameObjectSpawned event)
|
public void onGameObjectSpawned(GameObjectSpawned event)
|
||||||
{
|
{
|
||||||
if (event.getGameObject().getId() == POLISHING_WHEEL)
|
GameObject gameObject = event.getGameObject();
|
||||||
|
switch (gameObject.getId())
|
||||||
{
|
{
|
||||||
state.setEnabled(true);
|
case POLISHING_WHEEL:
|
||||||
|
state.setEnabled(true);
|
||||||
|
overlay3d.polishingWheel = gameObject;
|
||||||
|
break;
|
||||||
|
case GRINDSTONE:
|
||||||
|
overlay3d.grindstone = gameObject;
|
||||||
|
break;
|
||||||
|
case LAVA_POOL:
|
||||||
|
overlay3d.lavaPool = gameObject;
|
||||||
|
break;
|
||||||
|
case WATERFALL:
|
||||||
|
overlay3d.waterfall = gameObject;
|
||||||
|
break;
|
||||||
|
case TRIP_HAMMER:
|
||||||
|
overlay3d.tripHammer = gameObject;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onGameObjectDespawned(GameObjectDespawned event)
|
public void onGameObjectDespawned(GameObjectDespawned event)
|
||||||
{
|
{
|
||||||
if (event.getGameObject().getId() == POLISHING_WHEEL)
|
GameObject gameObject = event.getGameObject();
|
||||||
|
switch (gameObject.getId())
|
||||||
{
|
{
|
||||||
state.setEnabled(false);
|
case POLISHING_WHEEL:
|
||||||
|
state.setEnabled(false);
|
||||||
|
overlay3d.polishingWheel = null;
|
||||||
|
break;
|
||||||
|
case GRINDSTONE:
|
||||||
|
overlay3d.grindstone = null;
|
||||||
|
break;
|
||||||
|
case LAVA_POOL:
|
||||||
|
overlay3d.lavaPool = null;
|
||||||
|
break;
|
||||||
|
case WATERFALL:
|
||||||
|
overlay3d.waterfall = null;
|
||||||
|
break;
|
||||||
|
case TRIP_HAMMER:
|
||||||
|
overlay3d.tripHammer = null;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,18 +2,22 @@ package com.toofifty.easygiantsfoundry;
|
|||||||
|
|
||||||
import com.toofifty.easygiantsfoundry.enums.Heat;
|
import com.toofifty.easygiantsfoundry.enums.Heat;
|
||||||
import com.toofifty.easygiantsfoundry.enums.Stage;
|
import com.toofifty.easygiantsfoundry.enums.Stage;
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Dimension;
|
import java.awt.*;
|
||||||
import java.awt.Graphics2D;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.GameObject;
|
||||||
|
import net.runelite.api.Point;
|
||||||
import net.runelite.client.ui.ColorScheme;
|
import net.runelite.client.ui.ColorScheme;
|
||||||
|
import net.runelite.client.ui.components.ProgressBar;
|
||||||
import net.runelite.client.ui.overlay.OverlayPanel;
|
import net.runelite.client.ui.overlay.OverlayPanel;
|
||||||
import net.runelite.client.ui.overlay.components.LineComponent;
|
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||||
import net.runelite.client.ui.overlay.components.TitleComponent;
|
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class EasyGiantsFoundryOverlay extends OverlayPanel
|
public class FoundryOverlay2D extends OverlayPanel
|
||||||
{
|
{
|
||||||
@Inject
|
@Inject
|
||||||
private EasyGiantsFoundryState state;
|
private EasyGiantsFoundryState state;
|
||||||
@@ -52,7 +56,7 @@ public class EasyGiantsFoundryOverlay extends OverlayPanel
|
|||||||
LineComponent.builder().left("Heat").right(heat.getName() + " (" + state.getHeatAmount() / 10 + "%)").rightColor(heat.getColor()).build()
|
LineComponent.builder().left("Heat").right(heat.getName() + " (" + state.getHeatAmount() / 10 + "%)").rightColor(heat.getColor()).build()
|
||||||
);
|
);
|
||||||
panelComponent.getChildren().add(
|
panelComponent.getChildren().add(
|
||||||
LineComponent.builder().left("Stage").right(stage.getName() + " (" + state.getProgressAmount() / 10 + "%)").rightColor(stage.getColor()).build()
|
LineComponent.builder().left("Stage").right(stage.getName() + " (" + state.getProgressAmount() / 10 + "%)").rightColor(stage.getHeat().getColor()).build()
|
||||||
);
|
);
|
||||||
|
|
||||||
int actionsLeft = helper.getActionsLeftInStage();
|
int actionsLeft = helper.getActionsLeftInStage();
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
package com.toofifty.easygiantsfoundry;
|
||||||
|
|
||||||
|
import com.toofifty.easygiantsfoundry.enums.Heat;
|
||||||
|
import com.toofifty.easygiantsfoundry.enums.Stage;
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.GameObject;
|
||||||
|
import net.runelite.api.Point;
|
||||||
|
import net.runelite.api.widgets.Widget;
|
||||||
|
import net.runelite.client.ui.ColorScheme;
|
||||||
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
public class FoundryOverlay3D extends Overlay {
|
||||||
|
|
||||||
|
private static final int BONUS_COLOR = 0xfcd703;
|
||||||
|
private static final int BONUS_WIDGET = 49414148;
|
||||||
|
|
||||||
|
GameObject tripHammer;
|
||||||
|
GameObject grindstone;
|
||||||
|
GameObject polishingWheel;
|
||||||
|
GameObject lavaPool;
|
||||||
|
GameObject waterfall;
|
||||||
|
|
||||||
|
private final Client client;
|
||||||
|
private final EasyGiantsFoundryState state;
|
||||||
|
private final EasyGiantsFoundryHelper helper;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private FoundryOverlay3D(Client client, EasyGiantsFoundryState state, EasyGiantsFoundryHelper helper)
|
||||||
|
{
|
||||||
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
|
this.client = client;
|
||||||
|
this.state = state;
|
||||||
|
this.helper = helper;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Color getObjectColor(Stage stage, Heat heat) {
|
||||||
|
if (stage.getHeat() != heat)
|
||||||
|
{
|
||||||
|
return ColorScheme.PROGRESS_ERROR_COLOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget bonusWidget = client.getWidget(BONUS_WIDGET);
|
||||||
|
if (bonusWidget != null
|
||||||
|
&& bonusWidget.getChildren() != null
|
||||||
|
&& bonusWidget.getChildren().length != 0
|
||||||
|
&& bonusWidget.getChild(0).getTextColor() == BONUS_COLOR) {
|
||||||
|
return Color.CYAN;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int actionsLeft = helper.getActionsLeftInStage();
|
||||||
|
int heatLeft = helper.getActionsForHeatLevel();
|
||||||
|
if (actionsLeft <= 1 || heatLeft <= 1)
|
||||||
|
{
|
||||||
|
return ColorScheme.PROGRESS_INPROGRESS_COLOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ColorScheme.PROGRESS_COMPLETE_COLOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
private GameObject getStageObject(Stage stage)
|
||||||
|
{
|
||||||
|
switch (stage)
|
||||||
|
{
|
||||||
|
case TRIP_HAMMER:
|
||||||
|
return tripHammer;
|
||||||
|
case GRINDSTONE:
|
||||||
|
return grindstone;
|
||||||
|
case POLISHING_WHEEL:
|
||||||
|
return polishingWheel;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dimension render(Graphics2D graphics) {
|
||||||
|
if (!state.isEnabled() || state.getCurrentStage() == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Heat heat = state.getCurrentHeat();
|
||||||
|
Stage stage = state.getCurrentStage();
|
||||||
|
|
||||||
|
GameObject stageObject = getStageObject(stage);
|
||||||
|
if (stageObject != null)
|
||||||
|
{
|
||||||
|
Color color = getObjectColor(stage, heat);
|
||||||
|
Shape objectClickbox = stageObject.getClickbox();
|
||||||
|
if (objectClickbox != null)
|
||||||
|
{
|
||||||
|
Point mousePosition = client.getMouseCanvasPosition();
|
||||||
|
if (objectClickbox.contains(mousePosition.getX(), mousePosition.getY()))
|
||||||
|
{
|
||||||
|
graphics.setColor(color.darker());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
graphics.setColor(color);
|
||||||
|
}
|
||||||
|
graphics.draw(objectClickbox);
|
||||||
|
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20));
|
||||||
|
graphics.fill(objectClickbox);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,12 +9,12 @@ import net.runelite.client.ui.ColorScheme;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public enum Stage
|
public enum Stage
|
||||||
{
|
{
|
||||||
TRIP_HAMMER("Hammer", ColorScheme.PROGRESS_ERROR_COLOR, 20, -25),
|
TRIP_HAMMER("Hammer", Heat.HIGH, 20, -25),
|
||||||
GRINDSTONE("Grind", ColorScheme.PROGRESS_INPROGRESS_COLOR, 10, 15),
|
GRINDSTONE("Grind", Heat.MED, 10, 15),
|
||||||
POLISHING_WHEEL("Polish", ColorScheme.PROGRESS_COMPLETE_COLOR, 10, -17);
|
POLISHING_WHEEL("Polish", Heat.LOW, 10, -17);
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final Color color;
|
private final Heat heat;
|
||||||
private final int progressPerAction;
|
private final int progressPerAction;
|
||||||
private final int heatChange;
|
private final int heatChange;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user