Merge pull request #1877 from benjaminlgur/wccash
woodcutting: added gp earned for woodcutting
This commit is contained in:
@@ -74,4 +74,15 @@ public interface WoodcuttingConfig extends Config
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
position = 5,
|
||||||
|
keyName = "showGPEarned",
|
||||||
|
name = "Show GP earned",
|
||||||
|
description = "Configures whether to show amount of gp earned by chopping trees"
|
||||||
|
)
|
||||||
|
default boolean showGPEarned()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -42,6 +42,7 @@ import net.runelite.client.ui.overlay.components.TitleComponent;
|
|||||||
import net.runelite.client.ui.overlay.components.table.TableAlignment;
|
import net.runelite.client.ui.overlay.components.table.TableAlignment;
|
||||||
import net.runelite.client.ui.overlay.components.table.TableComponent;
|
import net.runelite.client.ui.overlay.components.table.TableComponent;
|
||||||
|
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
class WoodcuttingOverlay extends Overlay
|
class WoodcuttingOverlay extends Overlay
|
||||||
{
|
{
|
||||||
@@ -50,6 +51,7 @@ class WoodcuttingOverlay extends Overlay
|
|||||||
private final XpTrackerService xpTrackerService;
|
private final XpTrackerService xpTrackerService;
|
||||||
private final PanelComponent panelComponent = new PanelComponent();
|
private final PanelComponent panelComponent = new PanelComponent();
|
||||||
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private WoodcuttingOverlay(final Client client, final WoodcuttingPlugin plugin, final XpTrackerService xpTrackerService)
|
private WoodcuttingOverlay(final Client client, final WoodcuttingPlugin plugin, final XpTrackerService xpTrackerService)
|
||||||
{
|
{
|
||||||
@@ -101,6 +103,11 @@ class WoodcuttingOverlay extends Overlay
|
|||||||
{
|
{
|
||||||
tableComponent.addRow("Logs cut:", Integer.toString(actions));
|
tableComponent.addRow("Logs cut:", Integer.toString(actions));
|
||||||
|
|
||||||
|
if (plugin.isShowGPEarned())
|
||||||
|
{
|
||||||
|
tableComponent.addRow("GP earned:", Integer.toString((plugin.getGpEarned())));
|
||||||
|
}
|
||||||
|
|
||||||
if (actions > 2)
|
if (actions > 2)
|
||||||
{
|
{
|
||||||
tableComponent.addRow("Logs/hr:", Integer.toString(xpTrackerService.getActionsHr(Skill.WOODCUTTING)));
|
tableComponent.addRow("Logs/hr:", Integer.toString(xpTrackerService.getActionsHr(Skill.WOODCUTTING)));
|
||||||
@@ -112,4 +119,5 @@ class WoodcuttingOverlay extends Overlay
|
|||||||
return panelComponent.render(graphics);
|
return panelComponent.render(graphics);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -37,6 +37,7 @@ import net.runelite.api.ChatMessageType;
|
|||||||
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.ItemID;
|
||||||
import net.runelite.api.Player;
|
import net.runelite.api.Player;
|
||||||
import net.runelite.api.events.AnimationChanged;
|
import net.runelite.api.events.AnimationChanged;
|
||||||
import net.runelite.api.events.ChatMessage;
|
import net.runelite.api.events.ChatMessage;
|
||||||
@@ -49,6 +50,7 @@ import net.runelite.api.events.GameTick;
|
|||||||
import net.runelite.client.Notifier;
|
import net.runelite.client.Notifier;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.eventbus.EventBus;
|
import net.runelite.client.eventbus.EventBus;
|
||||||
|
import net.runelite.client.game.ItemManager;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.plugins.PluginDependency;
|
import net.runelite.client.plugins.PluginDependency;
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
@@ -82,6 +84,9 @@ public class WoodcuttingPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private WoodcuttingConfig config;
|
private WoodcuttingConfig config;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ItemManager itemManager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private EventBus eventBus;
|
private EventBus eventBus;
|
||||||
|
|
||||||
@@ -100,6 +105,12 @@ public class WoodcuttingPlugin extends Plugin
|
|||||||
private boolean showWoodcuttingStats;
|
private boolean showWoodcuttingStats;
|
||||||
@Getter(AccessLevel.PACKAGE)
|
@Getter(AccessLevel.PACKAGE)
|
||||||
private boolean showRedwoodTrees;
|
private boolean showRedwoodTrees;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private boolean showGPEarned;
|
||||||
|
|
||||||
|
private int treeTypeID;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private int gpEarned;
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
WoodcuttingConfig getConfig(ConfigManager configManager)
|
WoodcuttingConfig getConfig(ConfigManager configManager)
|
||||||
@@ -167,9 +178,13 @@ public class WoodcuttingPlugin extends Plugin
|
|||||||
if (session == null)
|
if (session == null)
|
||||||
{
|
{
|
||||||
session = new WoodcuttingSession();
|
session = new WoodcuttingSession();
|
||||||
|
gpEarned = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
session.setLastLogCut();
|
session.setLastLogCut();
|
||||||
|
|
||||||
|
typeOfLogCut(event.getMessage());
|
||||||
|
gpEarned += itemManager.getItemPrice(treeTypeID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getMessage().contains("A bird's nest falls out of the tree") && this.showNestNotification)
|
if (event.getMessage().contains("A bird's nest falls out of the tree") && this.showNestNotification)
|
||||||
@@ -179,6 +194,50 @@ public class WoodcuttingPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void typeOfLogCut(String message)
|
||||||
|
{
|
||||||
|
if (message.contains("mushrooms."))
|
||||||
|
{
|
||||||
|
return; //TO DO Add valuation for scullicep mushroom cutting.
|
||||||
|
}
|
||||||
|
else if (message.contains("oak"))
|
||||||
|
{
|
||||||
|
treeTypeID = ItemID.OAK_LOGS;
|
||||||
|
}
|
||||||
|
else if (message.contains("willow"))
|
||||||
|
{
|
||||||
|
treeTypeID = ItemID.WILLOW_LOGS;
|
||||||
|
}
|
||||||
|
else if (message.contains("yew"))
|
||||||
|
{
|
||||||
|
treeTypeID = ItemID.YEW_LOGS;
|
||||||
|
}
|
||||||
|
else if (message.contains("redwood"))
|
||||||
|
{
|
||||||
|
treeTypeID = ItemID.REDWOOD_LOGS;
|
||||||
|
}
|
||||||
|
else if (message.contains("magic"))
|
||||||
|
{
|
||||||
|
treeTypeID = ItemID.MAGIC_LOGS;
|
||||||
|
}
|
||||||
|
else if (message.contains("teak"))
|
||||||
|
{
|
||||||
|
treeTypeID = ItemID.TEAK_LOGS;
|
||||||
|
}
|
||||||
|
else if (message.contains("mahogany"))
|
||||||
|
{
|
||||||
|
treeTypeID = ItemID.MAHOGANY_LOGS;
|
||||||
|
}
|
||||||
|
else if (message.contains("maple"))
|
||||||
|
{
|
||||||
|
treeTypeID = ItemID.MAPLE_LOGS;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
treeTypeID = ItemID.LOGS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void onGameObjectSpawned(final GameObjectSpawned event)
|
private void onGameObjectSpawned(final GameObjectSpawned event)
|
||||||
{
|
{
|
||||||
GameObject gameObject = event.getGameObject();
|
GameObject gameObject = event.getGameObject();
|
||||||
@@ -241,5 +300,6 @@ public class WoodcuttingPlugin extends Plugin
|
|||||||
this.showNestNotification = config.showNestNotification();
|
this.showNestNotification = config.showNestNotification();
|
||||||
this.showWoodcuttingStats = config.showWoodcuttingStats();
|
this.showWoodcuttingStats = config.showWoodcuttingStats();
|
||||||
this.showRedwoodTrees = config.showRedwoodTrees();
|
this.showRedwoodTrees = config.showRedwoodTrees();
|
||||||
|
this.showGPEarned = config.showGPEarned();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user