@@ -29,3 +29,4 @@ Helpful overlays for the Giant's Foundry minigame
|
|||||||
- [Vanillj](https://github.com/Vanillj "Vanillj's github")
|
- [Vanillj](https://github.com/Vanillj "Vanillj's github")
|
||||||
* Added config
|
* Added config
|
||||||
* Added notifications for heat/stage changes
|
* Added notifications for heat/stage changes
|
||||||
|
* Added config for actions/heat left for notifications
|
||||||
@@ -10,7 +10,7 @@ repositories {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
def runeLiteVersion = '1.8.24.3'
|
def runeLiteVersion = '1.8.27'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly group: 'net.runelite', name:'client', version: runeLiteVersion
|
compileOnly group: 'net.runelite', name:'client', version: runeLiteVersion
|
||||||
@@ -24,7 +24,7 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = 'com.toofifty'
|
group = 'com.toofifty'
|
||||||
version = '1.0.4'
|
version = '1.0.5'
|
||||||
sourceCompatibility = '1.8'
|
sourceCompatibility = '1.8'
|
||||||
|
|
||||||
tasks.withType(JavaCompile) {
|
tasks.withType(JavaCompile) {
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import net.runelite.client.config.ConfigSection;
|
|||||||
public interface EasyGiantsFoundryConfig extends Config {
|
public interface EasyGiantsFoundryConfig extends Config {
|
||||||
String GROUP = "easygiantsfoundry";
|
String GROUP = "easygiantsfoundry";
|
||||||
String SOUND_ID = "soundID";
|
String SOUND_ID = "soundID";
|
||||||
|
String POINTS_KEY = "easygiantsfoundrypoints";
|
||||||
|
|
||||||
@ConfigSection(
|
@ConfigSection(
|
||||||
name = "Notifications",
|
name = "Notifications",
|
||||||
@@ -219,4 +220,16 @@ public interface EasyGiantsFoundryConfig extends Config {
|
|||||||
default boolean drawHeatLeft() {
|
default boolean drawHeatLeft() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "shopPoints",
|
||||||
|
name = "Reputation",
|
||||||
|
description = "Toggle for reputation text",
|
||||||
|
position = 5,
|
||||||
|
section = infoPanelList
|
||||||
|
)
|
||||||
|
default boolean drawShopPoints()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,14 @@
|
|||||||
package com.toofifty.easygiantsfoundry;
|
package com.toofifty.easygiantsfoundry;
|
||||||
|
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
|
import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.GameObject;
|
import net.runelite.api.GameObject;
|
||||||
import net.runelite.api.GameState;
|
import net.runelite.api.GameState;
|
||||||
import net.runelite.api.InventoryID;
|
import net.runelite.api.InventoryID;
|
||||||
import net.runelite.api.Skill;
|
import net.runelite.api.Skill;
|
||||||
import net.runelite.api.events.GameObjectDespawned;
|
import net.runelite.api.events.*;
|
||||||
import net.runelite.api.events.GameObjectSpawned;
|
|
||||||
import net.runelite.api.events.GameStateChanged;
|
|
||||||
import net.runelite.api.events.GameTick;
|
|
||||||
import net.runelite.api.events.ItemContainerChanged;
|
|
||||||
import net.runelite.api.events.NpcDespawned;
|
|
||||||
import net.runelite.api.events.NpcSpawned;
|
|
||||||
import net.runelite.api.events.ScriptPostFired;
|
|
||||||
import net.runelite.api.events.StatChanged;
|
|
||||||
import net.runelite.client.Notifier;
|
import net.runelite.client.Notifier;
|
||||||
import net.runelite.client.callback.ClientThread;
|
import net.runelite.client.callback.ClientThread;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
@@ -85,6 +78,13 @@ public class EasyGiantsFoundryPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private ClientThread clientThread;
|
private ClientThread clientThread;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ConfigManager configManager;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Inject
|
||||||
|
private PointsTracker pointsTracker;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void startUp()
|
protected void startUp()
|
||||||
{
|
{
|
||||||
@@ -137,6 +137,11 @@ public class EasyGiantsFoundryPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
state.setEnabled(false);
|
state.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event.getGameState().equals(GameState.LOGGED_IN))
|
||||||
|
{
|
||||||
|
pointsTracker.load();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@@ -161,7 +166,7 @@ public class EasyGiantsFoundryPlugin extends Plugin
|
|||||||
oldStage = state.getCurrentStage();
|
oldStage = state.getCurrentStage();
|
||||||
}
|
}
|
||||||
else if (config.showGiantsFoundryHeatNotifications() &&
|
else if (config.showGiantsFoundryHeatNotifications() &&
|
||||||
helper.getActionsForHeatLevel() == config.HeatNotificationsThreshold())
|
helper.getActionsForHeatLevel() == config.HeatNotificationsThreshold())
|
||||||
{
|
{
|
||||||
notifier.notify("About to run out of heat!");
|
notifier.notify("About to run out of heat!");
|
||||||
}
|
}
|
||||||
@@ -220,7 +225,7 @@ public class EasyGiantsFoundryPlugin extends Plugin
|
|||||||
public void onItemContainerChanged(ItemContainerChanged event)
|
public void onItemContainerChanged(ItemContainerChanged event)
|
||||||
{
|
{
|
||||||
if (event.getContainerId() == InventoryID.EQUIPMENT.getId()
|
if (event.getContainerId() == InventoryID.EQUIPMENT.getId()
|
||||||
&& event.getItemContainer().count(PREFORM) == 0)
|
&& event.getItemContainer().count(PREFORM) == 0)
|
||||||
{
|
{
|
||||||
state.reset();
|
state.reset();
|
||||||
oldStage = null;
|
oldStage = null;
|
||||||
@@ -259,11 +264,17 @@ public class EasyGiantsFoundryPlugin extends Plugin
|
|||||||
checkBonus();
|
checkBonus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onWidgetLoaded(WidgetLoaded event)
|
||||||
|
{
|
||||||
|
pointsTracker.onWidgetLoaded(event.getGroupId());
|
||||||
|
}
|
||||||
|
|
||||||
private void checkBonus()
|
private void checkBonus()
|
||||||
{
|
{
|
||||||
if (!state.isEnabled() || state.getCurrentStage() == null
|
if (!state.isEnabled() || state.getCurrentStage() == null
|
||||||
|| state.getCurrentStage().getHeat() != state.getCurrentHeat()
|
|| state.getCurrentStage().getHeat() != state.getCurrentHeat()
|
||||||
|| !BonusWidget.isActive(client))
|
|| !BonusWidget.isActive(client))
|
||||||
{
|
{
|
||||||
bonusNotified = false;
|
bonusNotified = false;
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ 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 net.runelite.api.Client;
|
||||||
import net.runelite.client.ui.ColorScheme;
|
import net.runelite.client.ui.ColorScheme;
|
||||||
import net.runelite.client.ui.overlay.OverlayPanel;
|
import net.runelite.client.ui.overlay.OverlayPanel;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
@@ -17,13 +18,18 @@ import java.awt.Graphics2D;
|
|||||||
@Singleton
|
@Singleton
|
||||||
public class FoundryOverlay2D extends OverlayPanel
|
public class FoundryOverlay2D extends OverlayPanel
|
||||||
{
|
{
|
||||||
|
private static final int REGION_ID = 13491;
|
||||||
|
private final Client client;
|
||||||
|
private final EasyGiantsFoundryPlugin plugin;
|
||||||
private final EasyGiantsFoundryState state;
|
private final EasyGiantsFoundryState state;
|
||||||
private final EasyGiantsFoundryHelper helper;
|
private final EasyGiantsFoundryHelper helper;
|
||||||
private final EasyGiantsFoundryConfig config;
|
private final EasyGiantsFoundryConfig config;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private FoundryOverlay2D(EasyGiantsFoundryState state, EasyGiantsFoundryHelper helper, EasyGiantsFoundryConfig config)
|
private FoundryOverlay2D(Client client, EasyGiantsFoundryPlugin plugin, EasyGiantsFoundryState state, EasyGiantsFoundryHelper helper, EasyGiantsFoundryConfig config)
|
||||||
{
|
{
|
||||||
|
this.client = client;
|
||||||
|
this.plugin = plugin;
|
||||||
this.state = state;
|
this.state = state;
|
||||||
this.helper = helper;
|
this.helper = helper;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
@@ -48,44 +54,56 @@ public class FoundryOverlay2D extends OverlayPanel
|
|||||||
@Override
|
@Override
|
||||||
public Dimension render(Graphics2D graphics)
|
public Dimension render(Graphics2D graphics)
|
||||||
{
|
{
|
||||||
if (!state.isEnabled() || state.getCurrentStage() == null)
|
if (client.getLocalPlayer().getWorldLocation().getRegionID() != REGION_ID)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
boolean swordPickedUp = state.isEnabled() && state.getCurrentStage() != null;
|
||||||
Heat heat = state.getCurrentHeat();
|
|
||||||
Stage stage = state.getCurrentStage();
|
|
||||||
|
|
||||||
if (config.drawTitle())
|
if (config.drawTitle())
|
||||||
{
|
{
|
||||||
panelComponent.getChildren().add(TitleComponent.builder().text("Easy Giant's Foundry").build());
|
panelComponent.getChildren().add(TitleComponent.builder().text("Easy Giant's Foundry").build());
|
||||||
}
|
}
|
||||||
if (config.drawHeatInfo())
|
|
||||||
{
|
if (swordPickedUp) {
|
||||||
panelComponent.getChildren().add(
|
Heat heat = state.getCurrentHeat();
|
||||||
|
Stage stage = state.getCurrentStage();
|
||||||
|
|
||||||
|
if (config.drawHeatInfo())
|
||||||
|
{
|
||||||
|
panelComponent.getChildren().add(
|
||||||
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()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (config.drawStageInfo())
|
if (config.drawStageInfo())
|
||||||
{
|
{
|
||||||
panelComponent.getChildren().add(
|
panelComponent.getChildren().add(
|
||||||
LineComponent.builder().left("Stage").right(stage.getName() + " (" + state.getProgressAmount() / 10 + "%)").rightColor(stage.getHeat().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();
|
||||||
int heatLeft = helper.getActionsForHeatLevel();
|
int heatLeft = helper.getActionsForHeatLevel();
|
||||||
|
|
||||||
if (config.drawActionsLeft())
|
if (config.drawActionsLeft())
|
||||||
{
|
{
|
||||||
panelComponent.getChildren().add(
|
panelComponent.getChildren().add(
|
||||||
LineComponent.builder().left("Actions left").right(actionsLeft + "").build()
|
LineComponent.builder().left("Actions left").right(actionsLeft + "").build()
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
if (config.drawHeatLeft())
|
||||||
|
{
|
||||||
|
panelComponent.getChildren().add(
|
||||||
|
LineComponent.builder().left("Heat left").right(heatLeft + "").rightColor(getHeatColor(actionsLeft, heatLeft)).build()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (config.drawHeatLeft())
|
|
||||||
|
int points = plugin.getPointsTracker().getShopPoints();
|
||||||
|
if (config.drawShopPoints())
|
||||||
{
|
{
|
||||||
panelComponent.getChildren().add(
|
panelComponent.getChildren().add(
|
||||||
LineComponent.builder().left("Heat left").right(heatLeft + "").rightColor(getHeatColor(actionsLeft, heatLeft)).build()
|
LineComponent.builder().left("Reputation").right(points + "").build()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
package com.toofifty.easygiantsfoundry;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.widgets.Widget;
|
||||||
|
import net.runelite.client.callback.ClientThread;
|
||||||
|
import net.runelite.client.config.ConfigManager;
|
||||||
|
import net.runelite.client.util.Text;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
public class PointsTracker
|
||||||
|
{
|
||||||
|
private static final int SHOP_WIDGET = 753;
|
||||||
|
private static final int CHAT_WIDGET = 229;
|
||||||
|
private static final int SHOP_POINTS_TEXT = 13;
|
||||||
|
private static final int CHAT_POINTS_TEXT = 1;
|
||||||
|
private static final Pattern pattern = Pattern.compile("quality: (?<points>\\d+) Best");
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private int shopPoints;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ConfigManager configManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Client client;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
ClientThread clientThread;
|
||||||
|
|
||||||
|
public void load()
|
||||||
|
{
|
||||||
|
Integer points = configManager.getRSProfileConfiguration(EasyGiantsFoundryConfig.GROUP, EasyGiantsFoundryConfig.POINTS_KEY, int.class);
|
||||||
|
if (points != null)
|
||||||
|
{
|
||||||
|
shopPoints = points;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void save()
|
||||||
|
{
|
||||||
|
configManager.setRSProfileConfiguration(EasyGiantsFoundryConfig.GROUP, EasyGiantsFoundryConfig.POINTS_KEY, shopPoints);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onWidgetLoaded(int groupId)
|
||||||
|
{
|
||||||
|
if (groupId == SHOP_WIDGET)
|
||||||
|
{
|
||||||
|
clientThread.invokeLater(this::shopOpened);
|
||||||
|
}
|
||||||
|
else if (groupId == CHAT_WIDGET)
|
||||||
|
{
|
||||||
|
clientThread.invokeLater(this::chatBox);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void chatBox()
|
||||||
|
{
|
||||||
|
Widget chat = client.getWidget(CHAT_WIDGET, CHAT_POINTS_TEXT);
|
||||||
|
if (chat == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String chatText = Text.sanitizeMultilineText(chat.getText());
|
||||||
|
final Matcher matcher = pattern.matcher(chatText);
|
||||||
|
if (matcher.find())
|
||||||
|
{
|
||||||
|
shopPoints += Integer.parseInt(matcher.group("points"));
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void shopOpened()
|
||||||
|
{
|
||||||
|
Widget shop = client.getWidget(SHOP_WIDGET, SHOP_POINTS_TEXT);
|
||||||
|
if (shop != null && shop.getText() != null && Integer.parseInt(shop.getText()) != shopPoints)
|
||||||
|
{
|
||||||
|
shopPoints = Integer.parseInt(shop.getText());
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user