diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java index 6e459949c5..03179c69b9 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerConfig.java @@ -158,5 +158,15 @@ public interface LootTrackerConfig extends Config return ""; } + @ConfigItem( + keyName = "lootValueMessage", + name = "Loot Value Messages", + description = "Sends a game message with the total value you of your loot when you get a kill", + position = 5 + ) + default boolean sendLootValueMessages() + { + return true; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java index 33eb043639..7c21c9f7dc 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java @@ -133,10 +133,6 @@ public class LootTrackerPlugin extends Plugin 5179, "Brimstone Chest", 11573, "Crystal Chest" ); - - // Player deaths - public static HashSet usernameSet = new HashSet(Arrays.stream(new String[]{"All Records"}).collect(Collectors.toList())); - private static final File LOOT_RECORDS_FILE = new File(RuneLite.RUNELITE_DIR, "lootRecords.json"); private static final Set RESPAWN_REGIONS = ImmutableSet.of( 12850, // Lumbridge @@ -144,49 +140,38 @@ public class LootTrackerPlugin extends Plugin 12342, // Edgeville 11062 // Camelot ); - private boolean pvpDeath = false; - - @Inject - private ClientToolbar clientToolbar; - - @Inject - private ItemManager itemManager; - - @Inject - private ChatMessageManager chatMessageManager; - - @Inject - private SpriteManager spriteManager; - - @Inject - private LootTrackerConfig config; - + // Player deaths + public static HashSet usernameSet = new HashSet(Arrays.stream(new String[]{"All Records"}).collect(Collectors.toList())); @Inject public Client client; - + @VisibleForTesting + public Collection lootRecords = new ArrayList<>(); + private boolean pvpDeath = false; + @Inject + private ClientToolbar clientToolbar; + @Inject + private ItemManager itemManager; + @Inject + private ChatMessageManager chatMessageManager; + @Inject + private SpriteManager spriteManager; + @Inject + private LootTrackerConfig config; @Inject private ClientThread clientThread; - @Inject private SessionManager sessionManager; - @Inject private ScheduledExecutorService executor; - private LootTrackerPanel panel; private NavigationButton navButton; private String eventType; - private List ignoredItems = new ArrayList<>(); - private Multiset inventorySnapshot; - @Getter(AccessLevel.PACKAGE) private LootTrackerClient lootTrackerClient; private BufferedReader bufferedReader; private JsonStreamParser jsonStreamParser; - @VisibleForTesting - public Collection lootRecords = new ArrayList<>(); private static Collection stack(Collection items) { @@ -217,6 +202,13 @@ public class LootTrackerPlugin extends Plugin return list; } + private static Collection toGameItems(Collection items) + { + return items.stream() + .map(item -> new GameItem(item.getId(), item.getQuantity())) + .collect(Collectors.toList()); + } + @Provides LootTrackerConfig provideConfig(ConfigManager configManager) { @@ -405,7 +397,6 @@ public class LootTrackerPlugin extends Plugin } } - @Subscribe public void onPlayerSpawned(PlayerSpawned event) { @@ -418,6 +409,18 @@ public class LootTrackerPlugin extends Plugin @Subscribe public void onPlayerLootReceived(final PlayerLootReceived playerLootReceived) { + if (config.sendLootValueMessages()) + { + if (WorldType.isDeadmanWorld(client.getWorldType()) || WorldType.isHighRiskWorld(client.getWorldType()) || WorldType.isPvpWorld(client.getWorldType()) || client.getVar(Varbits.IN_WILDERNESS) == 1) + { + final String totalValue = StackFormatter.quantityToRSStackSize(playerLootReceived.getItems().stream() + .mapToInt(itemStack -> itemManager.getItemPrice(itemStack.getId()) * itemStack.getQuantity()).sum()); + + chatMessageManager.queue(QueuedMessage.builder().type(ChatMessageType.CONSOLE).runeLiteFormattedMessage( + new ChatMessageBuilder().append("The total value of your loot is " + totalValue + " GP.") + .build()).build()); + } + } final Player player = playerLootReceived.getPlayer(); final Collection items = playerLootReceived.getItems(); final String name = player.getName(); @@ -793,13 +796,6 @@ public class LootTrackerPlugin extends Plugin .toArray(LootTrackerItem[]::new); } - private static Collection toGameItems(Collection items) - { - return items.stream() - .map(item -> new GameItem(item.getId(), item.getQuantity())) - .collect(Collectors.toList()); - } - public Collection convertToLootTrackerRecord(final Collection records) { Collection trackerRecords = new ArrayList<>(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/PvpToolsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/PvpToolsPlugin.java index 0fda9fe9af..4a7c393f31 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/PvpToolsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/PvpToolsPlugin.java @@ -1,10 +1,12 @@ /* - * Copyright (c) 2019. PKLite - All Rights Reserved - * Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited. - * Proprietary and confidential. Refer to PKLite License file for more information on - * full terms of this copyright and to determine what constitutes authorized use. - * Written by PKLite(ST0NEWALL, others) , 2019 - * + * ****************************************************************************** + * * Copyright (c) 2019 RuneLitePlus + * * Redistributions and modifications of this software are permitted as long as this notice remains in its original unmodified state at the top of this file. + * * If there are any questions comments, or feedback about this software, please direct all inquiries directly to the file authors: + * * ST0NEWALL#9112 + * * RuneLitePlus Discord: https://discord.gg/Q7wFtCe + * * RuneLitePlus website: https://runelitepl.us + * ***************************************************************************** */ package net.runelite.client.plugins.pvptools; @@ -44,6 +46,7 @@ import net.runelite.api.events.MenuEntryAdded; import net.runelite.api.events.MenuOpened; import net.runelite.api.events.PlayerDespawned; import net.runelite.api.events.PlayerSpawned; +import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.game.AsyncBufferedImage; @@ -104,6 +107,9 @@ public class PvpToolsPlugin extends Plugin @Inject private ItemManager itemManager; + @Inject + private ChatMessageManager chatMessageManager; + private PvpToolsPlugin uhPvpToolsPlugin = this; private static final String WALK_HERE = "WALK HERE"; @@ -510,6 +516,7 @@ public class PvpToolsPlugin extends Plugin } } + /** * Enables or disables the fall in helper feature */