Merge pull request #27 from Toofifty/reputation-fix
Reputation fix and Color changes
This commit is contained in:
@@ -8,7 +8,7 @@ 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
|
- Highlights relevant tool with customizable status colors
|
||||||
* Red = Wrong temperature
|
* Red = Wrong temperature
|
||||||
* Green = Right temperature
|
* Green = Right temperature
|
||||||
* Orange = one action or temperature change remaining
|
* Orange = one action or temperature change remaining
|
||||||
@@ -26,6 +26,7 @@ Helpful overlays for the Giant's Foundry minigame
|
|||||||
* Added Bonus sound/notifications
|
* Added Bonus sound/notifications
|
||||||
* Added overlay configs
|
* Added overlay configs
|
||||||
* Added info panel configs
|
* Added info panel configs
|
||||||
|
* Added color configuration
|
||||||
- [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
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ repositories {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
def runeLiteVersion = '1.8.27'
|
def runeLiteVersion = 'latest.release'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly group: 'net.runelite', name:'client', version: runeLiteVersion
|
compileOnly group: 'net.runelite', name:'client', version: runeLiteVersion
|
||||||
@@ -24,9 +24,9 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = 'com.toofifty'
|
group = 'com.toofifty'
|
||||||
version = '1.0.5'
|
version = '1.0.6'
|
||||||
sourceCompatibility = '1.8'
|
|
||||||
|
|
||||||
tasks.withType(JavaCompile) {
|
tasks.withType(JavaCompile) {
|
||||||
options.encoding = 'UTF-8'
|
options.encoding = 'UTF-8'
|
||||||
|
options.release.set(11)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
package com.toofifty.easygiantsfoundry;
|
package com.toofifty.easygiantsfoundry;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
import net.runelite.client.config.Config;
|
import net.runelite.client.config.Config;
|
||||||
import net.runelite.client.config.ConfigGroup;
|
import net.runelite.client.config.ConfigGroup;
|
||||||
import net.runelite.client.config.ConfigItem;
|
import net.runelite.client.config.ConfigItem;
|
||||||
import net.runelite.client.config.ConfigSection;
|
import net.runelite.client.config.ConfigSection;
|
||||||
|
import net.runelite.client.ui.ColorScheme;
|
||||||
|
|
||||||
@ConfigGroup(EasyGiantsFoundryConfig.GROUP)
|
@ConfigGroup(EasyGiantsFoundryConfig.GROUP)
|
||||||
public interface EasyGiantsFoundryConfig extends Config {
|
public interface EasyGiantsFoundryConfig extends Config {
|
||||||
@@ -162,7 +164,7 @@ public interface EasyGiantsFoundryConfig extends Config {
|
|||||||
@ConfigSection(
|
@ConfigSection(
|
||||||
name = "Info Panel",
|
name = "Info Panel",
|
||||||
description = "Settings for the Info Panel overlay",
|
description = "Settings for the Info Panel overlay",
|
||||||
position = 1
|
position = 2
|
||||||
)
|
)
|
||||||
String infoPanelList = "infoPanelList";
|
String infoPanelList = "infoPanelList";
|
||||||
|
|
||||||
@@ -232,4 +234,97 @@ public interface EasyGiantsFoundryConfig extends Config {
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ConfigSection(
|
||||||
|
name = "Colour",
|
||||||
|
description = "Colours",
|
||||||
|
position = 3
|
||||||
|
)
|
||||||
|
String colourList = "colourList";
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "mouldText",
|
||||||
|
name = "Mould Text",
|
||||||
|
description = "Colour for optimal mould text",
|
||||||
|
position = 0,
|
||||||
|
section = colourList
|
||||||
|
)
|
||||||
|
default Color mouldTextColour()
|
||||||
|
{
|
||||||
|
return new Color(0xdc10d);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "generalColour",
|
||||||
|
name = "General",
|
||||||
|
description = "Colour for highlighting objects/npcs in general",
|
||||||
|
position = 1,
|
||||||
|
section = colourList
|
||||||
|
)
|
||||||
|
default Color generalHighlight()
|
||||||
|
{
|
||||||
|
return Color.CYAN;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "lavaWaterColour",
|
||||||
|
name = "Lava/Waterfall",
|
||||||
|
description = "Colour for highlighting lava/waterfall",
|
||||||
|
position = 2,
|
||||||
|
section = colourList
|
||||||
|
)
|
||||||
|
default Color lavaWaterfallColour()
|
||||||
|
{
|
||||||
|
return ColorScheme.PROGRESS_COMPLETE_COLOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "toolGood",
|
||||||
|
name = "Tool Good",
|
||||||
|
description = "Colour for highlighting current tool when they are usable",
|
||||||
|
position = 3,
|
||||||
|
section = colourList
|
||||||
|
)
|
||||||
|
default Color toolGood()
|
||||||
|
{
|
||||||
|
return ColorScheme.PROGRESS_COMPLETE_COLOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "toolBad",
|
||||||
|
name = "Tool Bad",
|
||||||
|
description = "Colour for highlighting current tool when they are not usable",
|
||||||
|
position = 4,
|
||||||
|
section = colourList
|
||||||
|
)
|
||||||
|
default Color toolBad()
|
||||||
|
{
|
||||||
|
return ColorScheme.PROGRESS_ERROR_COLOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "toolCaution",
|
||||||
|
name = "Tool Caution",
|
||||||
|
description = "Colour for highlighting current tool when they are about to be not usable",
|
||||||
|
position = 5,
|
||||||
|
section = colourList
|
||||||
|
)
|
||||||
|
default Color toolCaution()
|
||||||
|
{
|
||||||
|
return ColorScheme.PROGRESS_INPROGRESS_COLOR;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "toolBonus",
|
||||||
|
name = "Tool Bonus",
|
||||||
|
description = "Colour for highlighting current tool when they have a bonus to click on",
|
||||||
|
position = 6,
|
||||||
|
section = colourList
|
||||||
|
)
|
||||||
|
default Color toolBonus()
|
||||||
|
{
|
||||||
|
return Color.CYAN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.toofifty.easygiantsfoundry;
|
package com.toofifty.easygiantsfoundry;
|
||||||
|
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
|
import com.toofifty.easygiantsfoundry.enums.Stage;
|
||||||
|
import javax.inject.Inject;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
@@ -8,18 +10,24 @@ 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.*;
|
import net.runelite.api.events.GameObjectDespawned;
|
||||||
|
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.api.events.VarbitChanged;
|
||||||
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.config.ConfigManager;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
import net.runelite.client.events.ConfigChanged;
|
import net.runelite.client.events.ConfigChanged;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
import net.runelite.client.ui.overlay.OverlayManager;
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
import net.runelite.client.config.ConfigManager;
|
|
||||||
import com.toofifty.easygiantsfoundry.enums.Stage;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
@@ -42,12 +50,17 @@ public class EasyGiantsFoundryPlugin extends Plugin
|
|||||||
|
|
||||||
private static final int PREFORM = 27010;
|
private static final int PREFORM = 27010;
|
||||||
|
|
||||||
|
private static final int REPUTATION_VARBIT = 3436;
|
||||||
|
|
||||||
private Stage oldStage;
|
private Stage oldStage;
|
||||||
|
|
||||||
private int lastBoost;
|
private int lastBoost;
|
||||||
|
|
||||||
private boolean bonusNotified = false;
|
private boolean bonusNotified = false;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private int reputation;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private EasyGiantsFoundryState state;
|
private EasyGiantsFoundryState state;
|
||||||
|
|
||||||
@@ -81,15 +94,15 @@ public class EasyGiantsFoundryPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private ConfigManager configManager;
|
private ConfigManager configManager;
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Inject
|
|
||||||
private PointsTracker pointsTracker;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void startUp()
|
protected void startUp()
|
||||||
{
|
{
|
||||||
overlayManager.add(overlay2d);
|
overlayManager.add(overlay2d);
|
||||||
overlayManager.add(overlay3d);
|
overlayManager.add(overlay3d);
|
||||||
|
if (client.getGameState() == GameState.LOGGED_IN)
|
||||||
|
{
|
||||||
|
reputation = client.getVarpValue(REPUTATION_VARBIT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -140,7 +153,7 @@ public class EasyGiantsFoundryPlugin extends Plugin
|
|||||||
|
|
||||||
if (event.getGameState().equals(GameState.LOGGED_IN))
|
if (event.getGameState().equals(GameState.LOGGED_IN))
|
||||||
{
|
{
|
||||||
pointsTracker.load();
|
reputation = client.getVarpValue(REPUTATION_VARBIT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,6 +257,15 @@ public class EasyGiantsFoundryPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onVarbitChanged(VarbitChanged event)
|
||||||
|
{
|
||||||
|
if (event.getVarpId() == REPUTATION_VARBIT)
|
||||||
|
{
|
||||||
|
reputation = client.getVarpValue(REPUTATION_VARBIT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
protected void onConfigChanged(ConfigChanged configChanged)
|
protected void onConfigChanged(ConfigChanged configChanged)
|
||||||
{
|
{
|
||||||
@@ -264,12 +286,6 @@ 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
|
||||||
|
|||||||
@@ -2,6 +2,11 @@ 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.Graphics2D;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Singleton;
|
||||||
import net.runelite.api.Client;
|
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;
|
||||||
@@ -9,12 +14,6 @@ import net.runelite.client.ui.overlay.OverlayPosition;
|
|||||||
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;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Singleton;
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Dimension;
|
|
||||||
import java.awt.Graphics2D;
|
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class FoundryOverlay2D extends OverlayPanel
|
public class FoundryOverlay2D extends OverlayPanel
|
||||||
{
|
{
|
||||||
@@ -98,12 +97,12 @@ public class FoundryOverlay2D extends OverlayPanel
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//
|
||||||
int points = plugin.getPointsTracker().getShopPoints();
|
// int points = plugin.getPointsTracker().getShopPoints();
|
||||||
if (config.drawShopPoints())
|
if (config.drawShopPoints())
|
||||||
{
|
{
|
||||||
panelComponent.getChildren().add(
|
panelComponent.getChildren().add(
|
||||||
LineComponent.builder().left("Reputation").right(points + "").build()
|
LineComponent.builder().left("Reputation").right(plugin.getReputation() + "").build()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,18 +2,19 @@ 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.Graphics2D;
|
||||||
|
import java.awt.Shape;
|
||||||
|
import javax.inject.Inject;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.GameObject;
|
import net.runelite.api.GameObject;
|
||||||
import net.runelite.api.NPC;
|
import net.runelite.api.NPC;
|
||||||
import net.runelite.api.Point;
|
import net.runelite.api.Point;
|
||||||
import net.runelite.api.widgets.Widget;
|
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.Overlay;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
public class FoundryOverlay3D extends Overlay {
|
public class FoundryOverlay3D extends Overlay {
|
||||||
|
|
||||||
private static final int HAND_IN_WIDGET = 49414221;
|
private static final int HAND_IN_WIDGET = 49414221;
|
||||||
@@ -47,22 +48,22 @@ public class FoundryOverlay3D extends Overlay {
|
|||||||
{
|
{
|
||||||
if (stage.getHeat() != heat)
|
if (stage.getHeat() != heat)
|
||||||
{
|
{
|
||||||
return ColorScheme.PROGRESS_ERROR_COLOR;
|
return config.toolBad();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BonusWidget.isActive(client))
|
if (BonusWidget.isActive(client))
|
||||||
{
|
{
|
||||||
return Color.CYAN;
|
return config.toolBonus();
|
||||||
}
|
}
|
||||||
|
|
||||||
int actionsLeft = helper.getActionsLeftInStage();
|
int actionsLeft = helper.getActionsLeftInStage();
|
||||||
int heatLeft = helper.getActionsForHeatLevel();
|
int heatLeft = helper.getActionsForHeatLevel();
|
||||||
if (actionsLeft <= 1 || heatLeft <= 1)
|
if (actionsLeft <= 1 || heatLeft <= 1)
|
||||||
{
|
{
|
||||||
return ColorScheme.PROGRESS_INPROGRESS_COLOR;
|
return config.toolCaution();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ColorScheme.PROGRESS_COMPLETE_COLOR;
|
return config.toolGood();
|
||||||
}
|
}
|
||||||
|
|
||||||
private GameObject getStageObject(Stage stage)
|
private GameObject getStageObject(Stage stage)
|
||||||
@@ -131,7 +132,7 @@ public class FoundryOverlay3D extends Overlay {
|
|||||||
graphics.fill(objectClickbox);
|
graphics.fill(objectClickbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (color.equals(ColorScheme.PROGRESS_ERROR_COLOR) && config.highlightWaterAndLava())
|
if (stage.getHeat() != heat && config.highlightWaterAndLava())
|
||||||
{
|
{
|
||||||
drawHeatChangers(graphics);
|
drawHeatChangers(graphics);
|
||||||
}
|
}
|
||||||
@@ -153,7 +154,7 @@ public class FoundryOverlay3D extends Overlay {
|
|||||||
if (shape != null)
|
if (shape != null)
|
||||||
{
|
{
|
||||||
Point mousePosition = client.getMouseCanvasPosition();
|
Point mousePosition = client.getMouseCanvasPosition();
|
||||||
Color color = ColorScheme.PROGRESS_COMPLETE_COLOR;
|
Color color = config.lavaWaterfallColour();
|
||||||
if (shape.contains(mousePosition.getX(), mousePosition.getY()))
|
if (shape.contains(mousePosition.getX(), mousePosition.getY()))
|
||||||
{
|
{
|
||||||
graphics.setColor(color.darker());
|
graphics.setColor(color.darker());
|
||||||
@@ -181,7 +182,7 @@ public class FoundryOverlay3D extends Overlay {
|
|||||||
Shape shape = crucible.getConvexHull();
|
Shape shape = crucible.getConvexHull();
|
||||||
if (shape != null)
|
if (shape != null)
|
||||||
{
|
{
|
||||||
Color color = Color.CYAN;
|
Color color = config.generalHighlight();
|
||||||
graphics.setColor(color);
|
graphics.setColor(color);
|
||||||
graphics.draw(shape);
|
graphics.draw(shape);
|
||||||
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20));
|
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20));
|
||||||
@@ -201,7 +202,7 @@ public class FoundryOverlay3D extends Overlay {
|
|||||||
Shape shape = mouldJig.getConvexHull();
|
Shape shape = mouldJig.getConvexHull();
|
||||||
if (shape != null)
|
if (shape != null)
|
||||||
{
|
{
|
||||||
Color color = Color.CYAN;
|
Color color = config.generalHighlight();
|
||||||
graphics.setColor(color);
|
graphics.setColor(color);
|
||||||
graphics.draw(shape);
|
graphics.draw(shape);
|
||||||
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20));
|
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20));
|
||||||
@@ -217,7 +218,7 @@ public class FoundryOverlay3D extends Overlay {
|
|||||||
Shape shape = kovac.getConvexHull();
|
Shape shape = kovac.getConvexHull();
|
||||||
if (shape != null)
|
if (shape != null)
|
||||||
{
|
{
|
||||||
Color color = Color.CYAN;
|
Color color = config.generalHighlight();
|
||||||
graphics.setColor(color);
|
graphics.setColor(color);
|
||||||
graphics.draw(shape);
|
graphics.draw(shape);
|
||||||
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20));
|
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20));
|
||||||
|
|||||||
@@ -2,15 +2,14 @@ package com.toofifty.easygiantsfoundry;
|
|||||||
|
|
||||||
import com.toofifty.easygiantsfoundry.enums.CommissionType;
|
import com.toofifty.easygiantsfoundry.enums.CommissionType;
|
||||||
import com.toofifty.easygiantsfoundry.enums.Mould;
|
import com.toofifty.easygiantsfoundry.enums.Mould;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import javax.inject.Inject;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.ScriptID;
|
import net.runelite.api.ScriptID;
|
||||||
import net.runelite.api.widgets.Widget;
|
import net.runelite.api.widgets.Widget;
|
||||||
import net.runelite.client.callback.ClientThread;
|
import net.runelite.client.callback.ClientThread;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class MouldHelper
|
public class MouldHelper
|
||||||
{
|
{
|
||||||
static final int MOULD_LIST_PARENT = 47054857;
|
static final int MOULD_LIST_PARENT = 47054857;
|
||||||
@@ -29,6 +28,9 @@ public class MouldHelper
|
|||||||
@Inject
|
@Inject
|
||||||
private ClientThread clientThread;
|
private ClientThread clientThread;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private EasyGiantsFoundryConfig config;
|
||||||
|
|
||||||
public void selectBest(int scriptId)
|
public void selectBest(int scriptId)
|
||||||
{
|
{
|
||||||
Widget parent = client.getWidget(MOULD_LIST_PARENT);
|
Widget parent = client.getWidget(MOULD_LIST_PARENT);
|
||||||
@@ -52,7 +54,7 @@ public class MouldHelper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (bestWidget != null) {
|
if (bestWidget != null) {
|
||||||
bestWidget.setTextColor(GREEN);
|
bestWidget.setTextColor(config.mouldTextColour().getRGB());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scriptId == DRAW_MOULD_LIST_SCRIPT || scriptId == REDRAW_MOULD_LIST_SCRIPT)
|
if (scriptId == DRAW_MOULD_LIST_SCRIPT || scriptId == REDRAW_MOULD_LIST_SCRIPT)
|
||||||
|
|||||||
@@ -1,86 +0,0 @@
|
|||||||
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