stored preform stage added & heat/cool prediction state machine filters only gameobject actions

previously, when preform is stored in storage, plugin assumes it's time to talk to kovac for new commision.

previously, any menu action will interupt and stop the heat/cooling statemachine state.
This commit is contained in:
Louis Hong
2024-11-09 01:28:17 -08:00
parent 547c2b40f0
commit dd73d961c0
4 changed files with 87 additions and 33 deletions

View File

@@ -23,6 +23,8 @@ public class EasyGiantsFoundryClientIDs
// 3 -
protected static final int VARBIT_GAME_STAGE = 13914;
protected static final int VARBIT_PREFORM_STORED = 13947;
protected static final int WIDGET_HEAT_PARENT = 49414153;
protected static final int WIDGET_LOW_HEAT_PARENT = 49414163;
protected static final int WIDGET_MED_HEAT_PARENT = 49414164;

View File

@@ -247,6 +247,18 @@ public interface EasyGiantsFoundryConfig extends Config
return true;
}
@ConfigItem(
keyName = "storageHighlight",
name = "Highlight Preform Storage",
description = "Highlight Storage when it contains a preform.",
position = 10,
section = highlightList
)
default boolean highlightStorage()
{
return true;
}
@ConfigSection(
name = "Info Panel",
description = "Settings for the Info Panel overlay",

View File

@@ -17,6 +17,7 @@ import net.runelite.api.GameState;
import net.runelite.api.InventoryID;
import net.runelite.api.Item;
import net.runelite.api.ItemContainer;
import net.runelite.api.MenuAction;
import net.runelite.api.Skill;
import net.runelite.api.events.GameObjectDespawned;
import net.runelite.api.events.GameObjectSpawned;
@@ -58,6 +59,7 @@ public class EasyGiantsFoundryPlugin extends Plugin
private static final int CRUCIBLE = 44776;
private static final int MOULD_JIG = 44777;
private static final int STORAGE = 44778;
private static final int KOVAC_NPC = 11472;
@@ -156,10 +158,47 @@ public class EasyGiantsFoundryPlugin extends Plugin
case CRUCIBLE:
overlay3d.crucible = gameObject;
break;
case STORAGE:
overlay3d.storage = gameObject;
break;
}
}
@Subscribe
public void onGameObjectDespawned(GameObjectDespawned event)
{
GameObject gameObject = event.getGameObject();
switch (gameObject.getId())
{
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;
case MOULD_JIG:
overlay3d.mouldJig = null;
break;
case CRUCIBLE:
overlay3d.crucible = null;
break;
case STORAGE:
overlay3d.storage = null;
break;
}
}
@Subscribe
public void onGameStateChanged(GameStateChanged event)
{
@@ -202,36 +241,6 @@ public class EasyGiantsFoundryPlugin extends Plugin
}
}
@Subscribe
public void onGameObjectDespawned(GameObjectDespawned event)
{
GameObject gameObject = event.getGameObject();
switch (gameObject.getId())
{
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;
case MOULD_JIG:
overlay3d.mouldJig = null;
break;
case CRUCIBLE:
overlay3d.crucible = null;
break;
}
}
@Subscribe
public void onNpcSpawned(NpcSpawned event)
@@ -271,6 +280,16 @@ public class EasyGiantsFoundryPlugin extends Plugin
@Subscribe
public void onMenuOptionClicked(MenuOptionClicked event)
{
if (!(event.getMenuAction() == MenuAction.GAME_OBJECT_FIRST_OPTION
|| event.getMenuAction() == MenuAction.GAME_OBJECT_SECOND_OPTION
|| event.getMenuAction() == MenuAction.GAME_OBJECT_THIRD_OPTION
|| event.getMenuAction() == MenuAction.GAME_OBJECT_FOURTH_OPTION
|| event.getMenuAction() == MenuAction.GAME_OBJECT_FIFTH_OPTION))
{
return;
}
if (!state.isEnabled()) return;
if (event.getMenuTarget().contains("Crucible "))

View File

@@ -1,7 +1,6 @@
package com.toofifty.easygiantsfoundry;
import static com.toofifty.easygiantsfoundry.EasyGiantsFoundryClientIDs.VARBIT_GAME_STAGE;
import static com.toofifty.easygiantsfoundry.EasyGiantsFoundryClientIDs.WIDGET_PROGRESS_PARENT;
import static com.toofifty.easygiantsfoundry.EasyGiantsFoundryClientIDs.*;
import static com.toofifty.easygiantsfoundry.EasyGiantsFoundryHelper.getHeatColor;
import static com.toofifty.easygiantsfoundry.MouldHelper.SWORD_TYPE_1_VARBIT;
import static com.toofifty.easygiantsfoundry.MouldHelper.SWORD_TYPE_2_VARBIT;
@@ -42,6 +41,7 @@ public class FoundryOverlay3D extends Overlay
GameObject waterfall;
GameObject mouldJig;
GameObject crucible;
GameObject storage;
NPC kovac;
private final Client client;
@@ -111,6 +111,15 @@ public class FoundryOverlay3D extends Overlay
drawKovacIfHandIn(graphics);
}
if (client.getVarbitValue(VARBIT_PREFORM_STORED) == 1)
{
if (config.highlightStorage())
{
drawStorage(graphics);
}
return null;
}
if (state.getCurrentStage() == null)
{
if (config.highlightMould())
@@ -127,7 +136,6 @@ public class FoundryOverlay3D extends Overlay
drawPreformScoreIfPoured(graphics);
}
return null;
}
@@ -486,6 +494,19 @@ public class FoundryOverlay3D extends Overlay
}
}
private void drawStorage(Graphics2D graphics)
{
Shape shape = storage.getConvexHull();
if (shape != null)
{
Color color = config.generalHighlight();
graphics.setColor(color);
graphics.draw(shape);
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20));
graphics.fill(shape);
}
}
private void drawKovacIfHandIn(Graphics2D graphics)
{
Widget handInWidget = client.getWidget(HAND_IN_WIDGET);