diff --git a/runelite-api/src/main/java/net/runelite/api/AnimationID.java b/runelite-api/src/main/java/net/runelite/api/AnimationID.java index 58f9a56ac3..722f72c389 100644 --- a/runelite-api/src/main/java/net/runelite/api/AnimationID.java +++ b/runelite-api/src/main/java/net/runelite/api/AnimationID.java @@ -98,6 +98,15 @@ public final class AnimationID public static final int FISHING_DRAGON_HARPOON = 7401; public static final int FISHING_INFERNAL_HARPOON = 7402; public static final int FISHING_CRYSTAL_HARPOON = 8336; + public static final int CRYSTALLINE_RAT_DEATH = 8334; + public static final int CRYSTALLINE_BAT_DEATH = 4917; + public static final int CRYSTALLINE_WOLF_DEATH = 8335; + public static final int CRYSTALLINE_SPIDER_DEATH = 8338; + public static final int CRYSTALLINE_UNICORN_DEATH = 6377; + public static final int CRYSTALLINE_DRAGON_DEATH = 92; + public static final int CRYSTALLINE_BEAR_DEATH = 4929; + public static final int CRYSTALLINE_DARK_BEAST_DEATH = 2733; + public static final int CORRUPTED_SCORPION_DEATH = 6256; public static final int FISHING_OILY_ROD = 622; public static final int FISHING_KARAMBWAN = 1193; public static final int FISHING_CRUSHING_INFERNAL_EELS = 7553; diff --git a/runelite-client/src/main/java/net/runelite/client/RuneLite.java b/runelite-client/src/main/java/net/runelite/client/RuneLite.java index e54dda2e32..09c8310887 100644 --- a/runelite-client/src/main/java/net/runelite/client/RuneLite.java +++ b/runelite-client/src/main/java/net/runelite/client/RuneLite.java @@ -59,6 +59,7 @@ import net.runelite.client.eventbus.EventBus; import net.runelite.client.game.ClanManager; import net.runelite.client.game.ItemManager; import net.runelite.client.game.LootManager; +import net.runelite.client.game.XpDropManager; import net.runelite.client.game.chatbox.ChatboxPanelManager; import net.runelite.client.graphics.ModelOutlineRenderer; import net.runelite.client.menus.MenuManager; @@ -151,6 +152,9 @@ public class RuneLite @Inject private Provider lootManager; + @Inject + private Provider xpDropManager; + @Inject private Provider chatboxPanelManager; @@ -368,6 +372,7 @@ public class RuneLite chatMessageManager.get(); commandManager.get(); lootManager.get(); + xpDropManager.get(); chatboxPanelManager.get(); eventBus.subscribe(GameStateChanged.class, this, hooks::onGameStateChanged); diff --git a/runelite-client/src/main/java/net/runelite/client/game/LootManager.java b/runelite-client/src/main/java/net/runelite/client/game/LootManager.java index 59ee0d988d..59370602da 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/LootManager.java +++ b/runelite-client/src/main/java/net/runelite/client/game/LootManager.java @@ -61,9 +61,27 @@ import net.runelite.client.events.PlayerLootReceived; @Slf4j public class LootManager { - private static final Map NPC_DEATH_ANIMATIONS = ImmutableMap.of( - NpcID.CAVE_KRAKEN, AnimationID.CAVE_KRAKEN_DEATH - ); + private static final Map NPC_DEATH_ANIMATIONS = ImmutableMap.builder() + .put(NpcID.CAVE_KRAKEN, AnimationID.CAVE_KRAKEN_DEATH) + .put(NpcID.CRYSTALLINE_BAT, AnimationID.CRYSTALLINE_BAT_DEATH) + .put(NpcID.CRYSTALLINE_RAT, AnimationID.CRYSTALLINE_RAT_DEATH) + .put(NpcID.CRYSTALLINE_SPIDER, AnimationID.CRYSTALLINE_SPIDER_DEATH) + .put(NpcID.CRYSTALLINE_WOLF, AnimationID.CRYSTALLINE_WOLF_DEATH) + .put(NpcID.CRYSTALLINE_UNICORN, AnimationID.CRYSTALLINE_UNICORN_DEATH) + .put(NpcID.CRYSTALLINE_SCORPION, AnimationID.CORRUPTED_SCORPION_DEATH) + .put(NpcID.CRYSTALLINE_DRAGON, AnimationID.CRYSTALLINE_DRAGON_DEATH) + .put(NpcID.CRYSTALLINE_DARK_BEAST, AnimationID.CRYSTALLINE_DARK_BEAST_DEATH) + .put(NpcID.CRYSTALLINE_BEAR, AnimationID.CRYSTALLINE_BEAR_DEATH) + .put(NpcID.CORRUPTED_BAT, AnimationID.CRYSTALLINE_BAT_DEATH) + .put(NpcID.CORRUPTED_RAT, AnimationID.CRYSTALLINE_RAT_DEATH) + .put(NpcID.CORRUPTED_SPIDER, AnimationID.CRYSTALLINE_SPIDER_DEATH) + .put(NpcID.CORRUPTED_WOLF, AnimationID.CRYSTALLINE_WOLF_DEATH) + .put(NpcID.CORRUPTED_UNICORN, AnimationID.CRYSTALLINE_UNICORN_DEATH) + .put(NpcID.CORRUPTED_SCORPION, AnimationID.CORRUPTED_SCORPION_DEATH) + .put(NpcID.CORRUPTED_DRAGON, AnimationID.CRYSTALLINE_DRAGON_DEATH) + .put(NpcID.CORRUPTED_DARK_BEAST, AnimationID.CRYSTALLINE_DARK_BEAST_DEATH) + .put(NpcID.CORRUPTED_BEAR, AnimationID.CRYSTALLINE_BEAR_DEATH) + .build(); private final EventBus eventBus; private final Client client; @@ -167,6 +185,7 @@ public class LootManager final Tile tile = itemSpawned.getTile(); final LocalPoint location = tile.getLocalLocation(); final int packed = location.getSceneX() << 8 | location.getSceneY(); + log.debug("storing items in {}", packed); itemSpawns.put(packed, new ItemStack(item.getId(), item.getQuantity(), location)); log.debug("Item spawn {} ({}) location {}", item.getId(), item.getQuantity(), location); } diff --git a/runelite-client/src/main/java/net/runelite/client/game/XpDropEvent.java b/runelite-client/src/main/java/net/runelite/client/game/XpDropEvent.java new file mode 100644 index 0000000000..6f1f36e2a1 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/game/XpDropEvent.java @@ -0,0 +1,12 @@ +package net.runelite.client.game; + +import lombok.Data; +import net.runelite.api.Skill; +import net.runelite.api.events.Event; + +@Data +public class XpDropEvent implements Event +{ + private Skill skill; + private int exp; +} diff --git a/runelite-client/src/main/java/net/runelite/client/game/XpDropManager.java b/runelite-client/src/main/java/net/runelite/client/game/XpDropManager.java new file mode 100644 index 0000000000..b42cbdc99f --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/game/XpDropManager.java @@ -0,0 +1,60 @@ +package net.runelite.client.game; + +import java.util.EnumMap; +import java.util.Map; +import javax.inject.Inject; +import javax.inject.Singleton; +import lombok.AccessLevel; +import lombok.Getter; +import net.runelite.api.Client; +import net.runelite.api.Skill; +import net.runelite.api.events.ExperienceChanged; +import net.runelite.api.events.GameStateChanged; +import net.runelite.client.eventbus.EventBus; + +@Singleton +public class XpDropManager +{ + + private final Map previousSkillExpTable = new EnumMap<>(Skill.class); + @Getter(AccessLevel.PACKAGE) + private int damage = 0; + @Getter(AccessLevel.PACKAGE) + private int tickShow = 0; + private int previousExpGained; + private Client client; + private EventBus eventBus; + + @Inject + private XpDropManager( + final EventBus eventBus, + final Client client + ) + { + this.client = client; + this.eventBus = eventBus; + eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged); + eventBus.subscribe(ExperienceChanged.class, this, this::onExperienceChanged); + } + + private void onGameStateChanged(GameStateChanged event) + { + damage = 0; + tickShow = 0; + } + + private void onExperienceChanged(ExperienceChanged event) + { + final Skill skill = event.getSkill(); + final int xp = client.getSkillExperience(skill); + Integer previous = previousSkillExpTable.put(skill, xp); + if (previous != null) + { + previousExpGained = xp - previous; + XpDropEvent xpDropEvent = new XpDropEvent(); + xpDropEvent.setExp(previousExpGained); + xpDropEvent.setSkill(skill); + eventBus.post(XpDropEvent.class, xpDropEvent); + } + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpDropPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpDropPlugin.java index 91e8036c98..a2b4f94d9d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpDropPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/experiencedrop/XpDropPlugin.java @@ -29,8 +29,6 @@ package net.runelite.client.plugins.experiencedrop; import com.google.inject.Provides; import java.awt.Color; import java.util.Arrays; -import java.util.EnumMap; -import java.util.Map; import java.util.stream.IntStream; import javax.inject.Inject; import javax.inject.Singleton; @@ -46,7 +44,6 @@ import net.runelite.api.SpriteID; import net.runelite.api.Varbits; import net.runelite.api.WorldType; import net.runelite.api.events.ConfigChanged; -import net.runelite.api.events.ExperienceChanged; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameTick; import net.runelite.api.events.ScriptCallbackEvent; @@ -57,6 +54,7 @@ import net.runelite.api.widgets.WidgetInfo; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.EventBus; import net.runelite.client.game.NPCManager; +import net.runelite.client.game.XpDropEvent; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.ui.overlay.OverlayManager; @@ -65,30 +63,23 @@ import net.runelite.client.util.ColorUtil; @PluginDescriptor( name = "XP Drop", description = "Enable customization of the way XP drops are displayed", - tags = {"experience", "levels", "tick"} -) + tags = {"experience", "levels", "tick"}) @Singleton public class XpDropPlugin extends Plugin { private static final int XPDROP_PADDING = 2; // space between xp drop icons private static final double HITPOINT_RATIO = 1.33; // Base rate of hp xp per point damage private static final double DMM_MULTIPLIER_RATIO = 10; - @Inject private Client client; - @Inject private XpDropConfig config; - @Inject private NPCManager npcManager; - @Inject private OverlayManager overlayManager; - @Inject private XpDropOverlay overlay; - @Inject private EventBus eventBus; @@ -106,16 +97,15 @@ public class XpDropPlugin extends Plugin private boolean hasDropped = false; private boolean correctPrayer; private Skill lastSkill = null; - private final Map previousSkillExpTable = new EnumMap<>(Skill.class); private PrayerType currentTickPrayer; private XpDropConfig.DamageMode damageMode; - private boolean hideSkillIcons; private Color getMeleePrayerColor; private Color getRangePrayerColor; private Color getMagePrayerColor; private int fakeXpDropDelay; private XpDropConfig.DamageMode showdamagedrops; + @Getter(AccessLevel.PACKAGE) private Color damageColor; @@ -153,10 +143,17 @@ public class XpDropPlugin extends Plugin eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged); eventBus.subscribe(WidgetHiddenChanged.class, this, this::onWidgetHiddenChanged); eventBus.subscribe(GameTick.class, this, this::onGameTick); - eventBus.subscribe(ExperienceChanged.class, this, this::onExperienceChanged); + eventBus.subscribe(XpDropEvent.class, this, this::onXpDropEvent); eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent); } + private void onXpDropEvent(XpDropEvent event) + { + previousExpGained = event.getExp(); + lastSkill = event.getSkill(); + hasDropped = true; + } + private void onConfigChanged(ConfigChanged event) { if (!event.getGroup().equals("xpdrop")) @@ -188,8 +185,8 @@ public class XpDropPlugin extends Plugin private void onGameStateChanged(GameStateChanged event) { - damage = 0; tickShow = 0; + damage = 0; } private void onWidgetHiddenChanged(WidgetHiddenChanged event) @@ -269,9 +266,12 @@ public class XpDropPlugin extends Plugin switch (prayer) { case MELEE: - if (spriteIDs.anyMatch(id -> - id == SpriteID.SKILL_ATTACK || id == SpriteID.SKILL_STRENGTH || id == SpriteID.SKILL_DEFENCE - || correctPrayer)) + if (spriteIDs.anyMatch( + id -> + id == SpriteID.SKILL_ATTACK + || id == SpriteID.SKILL_STRENGTH + || id == SpriteID.SKILL_DEFENCE + || correctPrayer)) { color = this.getMeleePrayerColor.getRGB(); correctPrayer = true; @@ -351,21 +351,6 @@ public class XpDropPlugin extends Plugin client.runScript(XPDROP_DISABLED, lastSkill.ordinal(), previousExpGained); } - private void onExperienceChanged(ExperienceChanged event) - { - final Skill skill = event.getSkill(); - final int xp = client.getSkillExperience(skill); - - lastSkill = skill; - - Integer previous = previousSkillExpTable.put(skill, xp); - if (previous != null) - { - previousExpGained = xp - previous; - hasDropped = true; - } - } - private void onScriptCallbackEvent(ScriptCallbackEvent e) { if (this.showdamagedrops == XpDropConfig.DamageMode.NONE) @@ -404,16 +389,19 @@ public class XpDropPlugin extends Plugin final int exp = intStack[intStackSize - 1]; calculateDamageDealt(exp); } - else if (eventName.equals("xpDropAddDamage") && - damageMode == XpDropConfig.DamageMode.IN_XP_DROP && - damage > 0) + else if (eventName.equals("xpDropAddDamage") + && damageMode == XpDropConfig.DamageMode.IN_XP_DROP + && damage > 0) { final String[] stringStack = client.getStringStack(); final int stringStackSize = client.getStringStackSize(); - String builder = stringStack[stringStackSize - 1] + - ColorUtil.colorTag(this.damageColor) + - " (" + damage + ")"; + String builder = + stringStack[stringStackSize - 1] + + ColorUtil.colorTag(this.damageColor) + + " (" + + damage + + ")"; stringStack[stringStackSize - 1] = builder; } } @@ -431,7 +419,8 @@ public class XpDropPlugin extends Plugin Actor a = client.getLocalPlayer().getInteracting(); if (!(a instanceof NPC) && !(a instanceof Player)) { - // If we are interacting with nothing we may have clicked away at the perfect time fall back to last tick + // If we are interacting with nothing we may have clicked away at the perfect time fall back + // to last tick if (!(lastOpponent instanceof NPC) && !(lastOpponent instanceof Player)) { damage = (int) Math.rint(damageDealt); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletConfig.java index de9ed17d0d..134b32ae1d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletConfig.java @@ -321,4 +321,16 @@ public interface GauntletConfig extends Config { return false; } + + @ConfigItem( + position = 21, + keyName = "displayResources", + name = "Show raw resources gathered", + description = "Displays how much of each resource you have gathered.", + titleSection = "resources" + ) + default boolean displayGatheredResources() + { + return false; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletPlugin.java index 9b56c36b6c..d2c558497e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/gauntlet/GauntletPlugin.java @@ -43,6 +43,7 @@ import net.runelite.api.Client; import net.runelite.api.GameObject; import net.runelite.api.GameState; import net.runelite.api.HeadIcon; +import net.runelite.api.ItemID; import net.runelite.api.NPC; import net.runelite.api.NPCDefinition; import net.runelite.api.NpcID; @@ -50,6 +51,7 @@ import net.runelite.api.ObjectID; import net.runelite.api.Player; import net.runelite.api.Projectile; import net.runelite.api.ProjectileID; +import net.runelite.api.Skill; import net.runelite.api.SoundEffectID; import net.runelite.api.Varbits; import net.runelite.api.events.AnimationChanged; @@ -58,6 +60,7 @@ 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.MenuOptionClicked; import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.NpcSpawned; import net.runelite.api.events.ProjectileSpawned; @@ -65,6 +68,8 @@ import net.runelite.api.events.VarbitChanged; import net.runelite.client.callback.ClientThread; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.EventBus; +import net.runelite.client.events.NpcLootReceived; +import net.runelite.client.game.ItemManager; import net.runelite.client.game.SkillIconManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; @@ -73,7 +78,10 @@ import static net.runelite.client.plugins.gauntlet.Hunllef.BossAttack.LIGHTNING; import static net.runelite.client.plugins.gauntlet.Hunllef.BossAttack.MAGIC; import static net.runelite.client.plugins.gauntlet.Hunllef.BossAttack.PRAYER; import static net.runelite.client.plugins.gauntlet.Hunllef.BossAttack.RANGE; +import net.runelite.client.game.XpDropEvent; import net.runelite.client.ui.overlay.OverlayManager; +import net.runelite.client.ui.overlay.infobox.Counter; +import net.runelite.client.ui.overlay.infobox.InfoBoxManager; @PluginDescriptor( name = "Gauntlet", @@ -104,7 +112,8 @@ public class GauntletPlugin extends Plugin ObjectID.PHREN_ROOTS_36066, ObjectID.FISHING_SPOT_36068, ObjectID.FISHING_SPOT_35971, ObjectID.GRYM_ROOT, ObjectID.GRYM_ROOT_36070, ObjectID.LINUM_TIRINUM, ObjectID.LINUM_TIRINUM_36072 ); - + private static final int GATHERING_HERB = 0; + private static final int GATHERING_CLOTH = 1; @Inject @Getter(AccessLevel.NONE) private Client client; @@ -138,6 +147,10 @@ public class GauntletPlugin extends Plugin @Setter(AccessLevel.PACKAGE) @Nullable private Hunllef hunllef; + @Inject + private InfoBoxManager infoBoxManager; + @Inject + private ItemManager itemManager; private boolean attackVisualOutline; private boolean completeStartup = false; private boolean displayTimerChat; @@ -160,11 +173,24 @@ public class GauntletPlugin extends Plugin private final Map items = new HashMap<>(); private final Set projectiles = new HashSet<>(); private final Set resources = new HashSet<>(); + private GauntletConfig.CounterDisplay countAttacks; private int resourceIconSize; private Set tornadoes = new HashSet<>(); private int projectileIconSize; - + private boolean displayResources; + private Counter oreCounter; + private Counter woodCounter; + private Counter clothCounter; + private Counter fishCounter; + private Counter herbCounter; + private int oresGathered; + private int woodGathered; + private int clothGathered; + private int fishGathered; + private int herbGathered; + private int currentFarmingAction = -1; + private boolean countersVisible = false; @Provides GauntletConfig getConfig(ConfigManager configManager) @@ -177,6 +203,7 @@ public class GauntletPlugin extends Plugin { addSubscriptions(); updateConfig(); + initializeCounters(); overlayManager.add(overlay); overlayManager.add(infoboxoverlay); overlayManager.add(GauntletCounter); @@ -200,6 +227,47 @@ public class GauntletPlugin extends Plugin } } + private void addCounters() + { + if (!countersVisible) + { + infoBoxManager.addInfoBox(oreCounter); + infoBoxManager.addInfoBox(woodCounter); + infoBoxManager.addInfoBox(clothCounter); + infoBoxManager.addInfoBox(fishCounter); + infoBoxManager.addInfoBox(herbCounter); + countersVisible = true; + } + } + + private void initializeCounters() + { + resetGatheringCounters(); + oreCounter = new Counter(itemManager.getImage(ItemID.CORRUPTED_ORE), this, 0); + woodCounter = new Counter(itemManager.getImage(ItemID.PHREN_BARK_23878), this, 0); + clothCounter = new Counter(itemManager.getImage(ItemID.LINUM_TIRINUM_23876), this, 0); + fishCounter = new Counter(itemManager.getImage(ItemID.RAW_PADDLEFISH), this, 0); + herbCounter = new Counter(itemManager.getImage(ItemID.GRYM_LEAF_23875), this, 0); + } + + private void resetGatheringCounters() + { + oresGathered = 0; + fishGathered = 0; + woodGathered = 0; + clothGathered = 0; + herbGathered = 0; + } + + private void updateCounters() + { + oreCounter.setCount(oresGathered); + woodCounter.setCount(woodGathered); + clothCounter.setCount(clothGathered); + fishCounter.setCount(fishGathered); + herbCounter.setCount(herbGathered); + } + @Override protected void shutDown() { @@ -213,12 +281,24 @@ public class GauntletPlugin extends Plugin overlayManager.remove(overlay); overlayManager.remove(infoboxoverlay); overlayManager.remove(GauntletCounter); + removeCounters(); + resetGatheringCounters(); resources.clear(); projectiles.clear(); tornadoes.clear(); setHunllef(null); } + private void removeCounters() + { + infoBoxManager.removeInfoBox(oreCounter); + infoBoxManager.removeInfoBox(woodCounter); + infoBoxManager.removeInfoBox(clothCounter); + infoBoxManager.removeInfoBox(fishCounter); + infoBoxManager.removeInfoBox(herbCounter); + countersVisible = false; + } + private void addSubscriptions() { eventBus.subscribe(AnimationChanged.class, this, this::onAnimationChanged); @@ -231,6 +311,56 @@ public class GauntletPlugin extends Plugin eventBus.subscribe(NpcSpawned.class, this, this::onNpcSpawned); eventBus.subscribe(ProjectileSpawned.class, this, this::onProjectileSpawned); eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged); + eventBus.subscribe(XpDropEvent.class, this, this::onXpDropEvent); + eventBus.subscribe(NpcLootReceived.class, this, this::onNpcLootReceived); + eventBus.subscribe(MenuOptionClicked.class, this, this::onMenuOptionClicked); + } + + private void onMenuOptionClicked(MenuOptionClicked menuOptionClicked) + { + if (menuOptionClicked.getTarget().toUpperCase().contains("LINUM")) + { + currentFarmingAction = GATHERING_CLOTH; + } + if (menuOptionClicked.getTarget().toUpperCase().contains("GRYM")) + { + currentFarmingAction = GATHERING_HERB; + } + } + + private void onNpcLootReceived(NpcLootReceived npcLootReceived) + { + fishGathered += (int) npcLootReceived.getItems().stream().filter(item -> item.getId() == ItemID.RAW_PADDLEFISH).count(); + herbGathered += (int) npcLootReceived.getItems().stream().filter(item -> item.getId() == ItemID.GRYM_LEAF || item.getId() == ItemID.GRYM_LEAF_23875).count(); + updateCounters(); + } + + private void onXpDropEvent(XpDropEvent experienceChanged) + { + if (experienceChanged.getSkill().compareTo(Skill.MINING) == 0) + { + oresGathered++; + } + if (experienceChanged.getSkill().compareTo(Skill.WOODCUTTING) == 0) + { + woodGathered++; + } + if (experienceChanged.getSkill().compareTo(Skill.FARMING) == 0) + { + if (currentFarmingAction == GATHERING_HERB) + { + herbGathered++; + } + else if (currentFarmingAction == GATHERING_CLOTH) + { + clothGathered++; + } + } + if (experienceChanged.getSkill().compareTo(Skill.FISHING) == 0) + { + fishGathered++; + } + updateCounters(); } private void onAnimationChanged(AnimationChanged event) @@ -325,6 +455,18 @@ public class GauntletPlugin extends Plugin timerVisible = false; } } + + if (event.getKey().equals("displayResources")) + { + if (this.displayResources && this.startedGauntlet()) + { + addCounters(); + } + else + { + removeCounters(); + } + } } private void onGameObjectDespawned(GameObjectDespawned event) @@ -379,6 +521,7 @@ public class GauntletPlugin extends Plugin if (HUNLLEF_NPC_IDS.contains(npc.getId())) { setHunllef(null); + resetGatheringCounters(); } else if (TORNADO_NPC_IDS.contains(npc.getId())) { @@ -436,6 +579,14 @@ public class GauntletPlugin extends Plugin { timer.checkStates(true); } + if (startedGauntlet() && displayResources) + { + addCounters(); + } + else + { + removeCounters(); + } } boolean fightingBoss() @@ -468,5 +619,6 @@ public class GauntletPlugin extends Plugin this.displayTimerChat = config.displayTimerChat(); this.attackVisualOutline = config.attackVisualOutline(); this.highlightPrayerInfobox = config.highlightPrayerInfobox(); + this.displayResources = config.displayGatheredResources(); } }