Automatically filters loot tracker loot to only show loot that the currently
logged in account has received and to show all loot from all accounts on login screen Signed-off-by: PKLite <stonewall@pklite.xyz>
This commit is contained in:
@@ -28,6 +28,7 @@ import java.time.Instant;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@@ -36,6 +37,8 @@ import lombok.NoArgsConstructor;
|
|||||||
public class LootRecord
|
public class LootRecord
|
||||||
{
|
{
|
||||||
private String eventId;
|
private String eventId;
|
||||||
|
@Getter
|
||||||
|
private String username;
|
||||||
private LootRecordType type;
|
private LootRecordType type;
|
||||||
private Collection<GameItem> drops;
|
private Collection<GameItem> drops;
|
||||||
private Instant time;
|
private Instant time;
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import java.awt.image.BufferedImage;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.BoxLayout;
|
import javax.swing.BoxLayout;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
@@ -43,6 +44,8 @@ import javax.swing.JMenuItem;
|
|||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JPopupMenu;
|
import javax.swing.JPopupMenu;
|
||||||
import javax.swing.border.EmptyBorder;
|
import javax.swing.border.EmptyBorder;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.runelite.api.GameState;
|
||||||
import net.runelite.client.game.ItemManager;
|
import net.runelite.client.game.ItemManager;
|
||||||
import net.runelite.client.ui.ColorScheme;
|
import net.runelite.client.ui.ColorScheme;
|
||||||
import net.runelite.client.ui.FontManager;
|
import net.runelite.client.ui.FontManager;
|
||||||
@@ -53,6 +56,7 @@ import net.runelite.client.util.ImageUtil;
|
|||||||
import net.runelite.client.util.StackFormatter;
|
import net.runelite.client.util.StackFormatter;
|
||||||
import net.runelite.http.api.loottracker.LootTrackerClient;
|
import net.runelite.http.api.loottracker.LootTrackerClient;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
class LootTrackerPanel extends PluginPanel
|
class LootTrackerPanel extends PluginPanel
|
||||||
{
|
{
|
||||||
private static final int MAX_LOOT_BOXES = 500;
|
private static final int MAX_LOOT_BOXES = 500;
|
||||||
@@ -131,6 +135,8 @@ class LootTrackerPanel extends PluginPanel
|
|||||||
INVISIBLE_ICON_HOVER = new ImageIcon(ImageUtil.alphaOffset(invisibleImg, -220));
|
INVISIBLE_ICON_HOVER = new ImageIcon(ImageUtil.alphaOffset(invisibleImg, -220));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private final JPanel displaySelector;
|
||||||
|
|
||||||
LootTrackerPanel(final LootTrackerPlugin plugin, final ItemManager itemManager, final LootTrackerConfig config)
|
LootTrackerPanel(final LootTrackerPlugin plugin, final ItemManager itemManager, final LootTrackerConfig config)
|
||||||
{
|
{
|
||||||
this.itemManager = itemManager;
|
this.itemManager = itemManager;
|
||||||
@@ -289,6 +295,11 @@ class LootTrackerPanel extends PluginPanel
|
|||||||
overallPanel.add(overallIcon, BorderLayout.WEST);
|
overallPanel.add(overallIcon, BorderLayout.WEST);
|
||||||
overallPanel.add(overallInfo, BorderLayout.CENTER);
|
overallPanel.add(overallInfo, BorderLayout.CENTER);
|
||||||
|
|
||||||
|
displaySelector = new JPanel();
|
||||||
|
displaySelector.setLayout(new GridLayout(1, 1));
|
||||||
|
displaySelector.setBorder(new EmptyBorder(2, 10, 10, 10));
|
||||||
|
displaySelector.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||||
|
|
||||||
// Create reset all menu
|
// Create reset all menu
|
||||||
final JMenuItem reset = new JMenuItem("Reset All");
|
final JMenuItem reset = new JMenuItem("Reset All");
|
||||||
reset.addActionListener(e ->
|
reset.addActionListener(e ->
|
||||||
@@ -318,6 +329,7 @@ class LootTrackerPanel extends PluginPanel
|
|||||||
logsContainer.setLayout(new BoxLayout(logsContainer, BoxLayout.Y_AXIS));
|
logsContainer.setLayout(new BoxLayout(logsContainer, BoxLayout.Y_AXIS));
|
||||||
layoutPanel.add(actionsContainer);
|
layoutPanel.add(actionsContainer);
|
||||||
layoutPanel.add(overallPanel);
|
layoutPanel.add(overallPanel);
|
||||||
|
layoutPanel.add(displaySelector);
|
||||||
layoutPanel.add(logsContainer);
|
layoutPanel.add(logsContainer);
|
||||||
|
|
||||||
// Add error pane
|
// Add error pane
|
||||||
@@ -335,10 +347,10 @@ class LootTrackerPanel extends PluginPanel
|
|||||||
* Creates a subtitle, adds a new entry and then passes off to the render methods, that will decide
|
* Creates a subtitle, adds a new entry and then passes off to the render methods, that will decide
|
||||||
* how to display this new data.
|
* how to display this new data.
|
||||||
*/
|
*/
|
||||||
void add(final String eventName, final int actorLevel, LootTrackerItem[] items)
|
void add(final String eventName, final String localUsername, final int actorLevel, LootTrackerItem[] items)
|
||||||
{
|
{
|
||||||
final String subTitle = actorLevel > -1 ? "(lvl-" + actorLevel + ")" : "";
|
final String subTitle = actorLevel > -1 ? "(lvl-" + actorLevel + ")" : "";
|
||||||
final LootTrackerRecord record = new LootTrackerRecord(eventName, subTitle, items, System.currentTimeMillis());
|
final LootTrackerRecord record = new LootTrackerRecord( eventName, localUsername, subTitle, items, System.currentTimeMillis());
|
||||||
records.add(record);
|
records.add(record);
|
||||||
LootTrackerBox box = buildBox(record);
|
LootTrackerBox box = buildBox(record);
|
||||||
if (box != null)
|
if (box != null)
|
||||||
@@ -405,8 +417,9 @@ class LootTrackerPanel extends PluginPanel
|
|||||||
/**
|
/**
|
||||||
* Rebuilds all the boxes from scratch using existing listed records, depending on the grouping mode.
|
* Rebuilds all the boxes from scratch using existing listed records, depending on the grouping mode.
|
||||||
*/
|
*/
|
||||||
private void rebuild()
|
public void rebuild()
|
||||||
{
|
{
|
||||||
|
|
||||||
logsContainer.removeAll();
|
logsContainer.removeAll();
|
||||||
boxes.clear();
|
boxes.clear();
|
||||||
int start = 0;
|
int start = 0;
|
||||||
@@ -422,6 +435,8 @@ class LootTrackerPanel extends PluginPanel
|
|||||||
updateOverall();
|
updateOverall();
|
||||||
logsContainer.revalidate();
|
logsContainer.revalidate();
|
||||||
logsContainer.repaint();
|
logsContainer.repaint();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -431,12 +446,21 @@ class LootTrackerPanel extends PluginPanel
|
|||||||
*/
|
*/
|
||||||
private LootTrackerBox buildBox(LootTrackerRecord record)
|
private LootTrackerBox buildBox(LootTrackerRecord record)
|
||||||
{
|
{
|
||||||
|
|
||||||
// If this record is not part of current view, return
|
// If this record is not part of current view, return
|
||||||
if (!record.matches(currentView))
|
if (!record.matches(currentView))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.plugin.client.getGameState().equals(GameState.LOGGED_IN))
|
||||||
|
{
|
||||||
|
if (!(this.plugin.client.getLocalPlayer().getName().equals(record.getLocalUsername())))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Group all similar loot together
|
// Group all similar loot together
|
||||||
if (groupLoot)
|
if (groupLoot)
|
||||||
{
|
{
|
||||||
@@ -456,7 +480,8 @@ class LootTrackerPanel extends PluginPanel
|
|||||||
overallPanel.setVisible(true);
|
overallPanel.setVisible(true);
|
||||||
|
|
||||||
// Create box
|
// Create box
|
||||||
final LootTrackerBox box = new LootTrackerBox(itemManager, record.getTitle(), record.getSubTitle(), hideIgnoredItems, plugin::toggleItem);
|
final LootTrackerBox box = new LootTrackerBox(itemManager, record.getTitle(), record.getSubTitle(),
|
||||||
|
hideIgnoredItems, plugin::toggleItem);
|
||||||
box.combine(record);
|
box.combine(record);
|
||||||
|
|
||||||
// Create popup menu
|
// Create popup menu
|
||||||
@@ -519,6 +544,14 @@ class LootTrackerPanel extends PluginPanel
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (Objects.nonNull(record.getLocalUsername()) && Objects.nonNull(plugin.client.getLocalPlayer()))
|
||||||
|
{
|
||||||
|
if (!record.getLocalUsername().equals(plugin.client.getLocalPlayer().getName()))
|
||||||
|
{
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int present = record.getItems().length;
|
int present = record.getItems().length;
|
||||||
|
|
||||||
@@ -542,7 +575,6 @@ class LootTrackerPanel extends PluginPanel
|
|||||||
overallKillsLabel.setText(htmlLabel("Total count: ", overallKills));
|
overallKillsLabel.setText(htmlLabel("Total count: ", overallKills));
|
||||||
overallGpLabel.setText(htmlLabel("Total value: ", overallGp));
|
overallGpLabel.setText(htmlLabel("Total value: ", overallGp));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String htmlLabel(String key, long value)
|
private static String htmlLabel(String key, long value)
|
||||||
{
|
{
|
||||||
final String valueStr = StackFormatter.quantityToStackSize(value);
|
final String valueStr = StackFormatter.quantityToStackSize(value);
|
||||||
|
|||||||
@@ -64,8 +64,8 @@ import net.runelite.api.ChatMessageType;
|
|||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.InventoryID;
|
import net.runelite.api.InventoryID;
|
||||||
import net.runelite.api.Item;
|
import net.runelite.api.Item;
|
||||||
import net.runelite.api.ItemDefinition;
|
|
||||||
import net.runelite.api.ItemContainer;
|
import net.runelite.api.ItemContainer;
|
||||||
|
import net.runelite.api.ItemDefinition;
|
||||||
import net.runelite.api.NPC;
|
import net.runelite.api.NPC;
|
||||||
import net.runelite.api.Player;
|
import net.runelite.api.Player;
|
||||||
import net.runelite.api.SpriteID;
|
import net.runelite.api.SpriteID;
|
||||||
@@ -76,6 +76,7 @@ import net.runelite.api.events.ChatMessage;
|
|||||||
import net.runelite.api.events.ConfigChanged;
|
import net.runelite.api.events.ConfigChanged;
|
||||||
import net.runelite.api.events.ItemContainerChanged;
|
import net.runelite.api.events.ItemContainerChanged;
|
||||||
import net.runelite.api.events.LocalPlayerDeath;
|
import net.runelite.api.events.LocalPlayerDeath;
|
||||||
|
import net.runelite.api.events.PlayerSpawned;
|
||||||
import net.runelite.api.events.WidgetLoaded;
|
import net.runelite.api.events.WidgetLoaded;
|
||||||
import net.runelite.api.widgets.WidgetID;
|
import net.runelite.api.widgets.WidgetID;
|
||||||
import net.runelite.client.RuneLite;
|
import net.runelite.client.RuneLite;
|
||||||
@@ -133,7 +134,8 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Player deaths
|
// Player deaths
|
||||||
private static final String PLAYER_DEATH_MESSAGE = "Oh dear, you are dead!";
|
public static HashSet<String> usernameSet = new HashSet<String>(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 File LOOT_RECORDS_FILE = new File(RuneLite.RUNELITE_DIR, "lootRecords.json");
|
||||||
private static final Set<Integer> RESPAWN_REGIONS = ImmutableSet.of(
|
private static final Set<Integer> RESPAWN_REGIONS = ImmutableSet.of(
|
||||||
12850, // Lumbridge
|
12850, // Lumbridge
|
||||||
@@ -159,7 +161,7 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
private LootTrackerConfig config;
|
private LootTrackerConfig config;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private Client client;
|
public Client client;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ClientThread clientThread;
|
private ClientThread clientThread;
|
||||||
@@ -178,7 +180,6 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
|
|
||||||
private Multiset<Integer> inventorySnapshot;
|
private Multiset<Integer> inventorySnapshot;
|
||||||
|
|
||||||
|
|
||||||
@Getter(AccessLevel.PACKAGE)
|
@Getter(AccessLevel.PACKAGE)
|
||||||
private LootTrackerClient lootTrackerClient;
|
private LootTrackerClient lootTrackerClient;
|
||||||
private BufferedReader bufferedReader;
|
private BufferedReader bufferedReader;
|
||||||
@@ -318,6 +319,7 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
lootRecords.addAll(RuneLiteAPI.GSON.fromJson(new FileReader(LOOT_RECORDS_FILE),
|
lootRecords.addAll(RuneLiteAPI.GSON.fromJson(new FileReader(LOOT_RECORDS_FILE),
|
||||||
new TypeToken<ArrayList<LootRecord>>()
|
new TypeToken<ArrayList<LootRecord>>()
|
||||||
{ }.getType()));
|
{ }.getType()));
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
@@ -343,6 +345,7 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
clientToolbar.removeNavigation(navButton);
|
clientToolbar.removeNavigation(navButton);
|
||||||
lootTrackerClient = null;
|
lootTrackerClient = null;
|
||||||
|
lootRecords = new ArrayList<LootRecord>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@@ -353,8 +356,10 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
final String name = npc.getName();
|
final String name = npc.getName();
|
||||||
final int combat = npc.getCombatLevel();
|
final int combat = npc.getCombatLevel();
|
||||||
final LootTrackerItem[] entries = buildEntries(stack(items));
|
final LootTrackerItem[] entries = buildEntries(stack(items));
|
||||||
SwingUtilities.invokeLater(() -> panel.add(name, combat, entries));
|
String localUsername = client.getLocalPlayer().getName();
|
||||||
LootRecord lootRecord = new LootRecord(name, LootRecordType.NPC, toGameItems(items), Instant.now());
|
SwingUtilities.invokeLater(() -> panel.add(name, localUsername, combat, entries));
|
||||||
|
LootRecord lootRecord = new LootRecord( name, localUsername, LootRecordType.NPC,
|
||||||
|
toGameItems(items), Instant.now());
|
||||||
|
|
||||||
if (lootTrackerClient != null && config.saveLoot())
|
if (lootTrackerClient != null && config.saveLoot())
|
||||||
{
|
{
|
||||||
@@ -366,6 +371,16 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onPlayerSpawned(PlayerSpawned event)
|
||||||
|
{
|
||||||
|
if (event.getPlayer().equals(client.getLocalPlayer()))
|
||||||
|
{
|
||||||
|
SwingUtilities.invokeLater(() -> panel.rebuild());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onPlayerLootReceived(final PlayerLootReceived playerLootReceived)
|
public void onPlayerLootReceived(final PlayerLootReceived playerLootReceived)
|
||||||
{
|
{
|
||||||
@@ -374,9 +389,10 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
final String name = player.getName();
|
final String name = player.getName();
|
||||||
final int combat = player.getCombatLevel();
|
final int combat = player.getCombatLevel();
|
||||||
final LootTrackerItem[] entries = buildEntries(stack(items));
|
final LootTrackerItem[] entries = buildEntries(stack(items));
|
||||||
SwingUtilities.invokeLater(() -> panel.add(name, combat, entries));
|
String localUsername = client.getLocalPlayer().getName();
|
||||||
LootRecord lootRecord = new LootRecord(name, LootRecordType.PLAYER, toGameItems(items), Instant.now());
|
SwingUtilities.invokeLater(() -> panel.add(name, localUsername, combat, entries));
|
||||||
|
LootRecord lootRecord = new LootRecord(localUsername, name, LootRecordType.PLAYER,
|
||||||
|
toGameItems(items), Instant.now());
|
||||||
if (lootTrackerClient != null && config.saveLoot())
|
if (lootTrackerClient != null && config.saveLoot())
|
||||||
{
|
{
|
||||||
lootTrackerClient.submit(lootRecord);
|
lootTrackerClient.submit(lootRecord);
|
||||||
@@ -447,6 +463,11 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event.getGroupId() == WidgetID.CHATBOX_GROUP_ID)
|
||||||
|
{
|
||||||
|
panel.rebuild();
|
||||||
|
}
|
||||||
|
|
||||||
// Convert container items to array of ItemStack
|
// Convert container items to array of ItemStack
|
||||||
final Collection<ItemStack> items = Arrays.stream(container.getItems())
|
final Collection<ItemStack> items = Arrays.stream(container.getItems())
|
||||||
.filter(item -> item.getId() > 0)
|
.filter(item -> item.getId() > 0)
|
||||||
@@ -460,11 +481,12 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
final LootTrackerItem[] entries = buildEntries(stack(items));
|
final LootTrackerItem[] entries = buildEntries(stack(items));
|
||||||
SwingUtilities.invokeLater(() -> panel.add(eventType, -1, entries));
|
SwingUtilities.invokeLater(() -> panel.add(client.getLocalPlayer().getName(), eventType, -1, entries));
|
||||||
|
|
||||||
if (lootTrackerClient != null && config.saveLoot())
|
if (lootTrackerClient != null && config.saveLoot())
|
||||||
{
|
{
|
||||||
LootRecord lootRecord = new LootRecord(eventType, LootRecordType.EVENT, toGameItems(items), Instant.now());
|
LootRecord lootRecord = new LootRecord(client.getLocalPlayer().getName(), eventType, LootRecordType.EVENT,
|
||||||
|
toGameItems(items), Instant.now());
|
||||||
lootTrackerClient.submit(lootRecord);
|
lootTrackerClient.submit(lootRecord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -479,34 +501,6 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
|
|
||||||
final String message = event.getMessage();
|
final String message = event.getMessage();
|
||||||
|
|
||||||
if (message.equals(PLAYER_DEATH_MESSAGE))
|
|
||||||
{
|
|
||||||
ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY);
|
|
||||||
if (inventorySnapshot != null)
|
|
||||||
{
|
|
||||||
Multiset<Integer> currentInventory = HashMultiset.create();
|
|
||||||
if (inventory != null)
|
|
||||||
{
|
|
||||||
Arrays.stream(client.getItemContainer(InventoryID.INVENTORY).getItems())
|
|
||||||
.forEach(item -> currentInventory.add(item.getId(), item.getQuantity()));
|
|
||||||
}
|
|
||||||
|
|
||||||
final Multiset<Integer> diff = Multisets.difference(inventorySnapshot, currentInventory);
|
|
||||||
|
|
||||||
log.info(inventorySnapshot.toString());
|
|
||||||
log.info(currentInventory.toString());
|
|
||||||
log.info(diff.toString());
|
|
||||||
|
|
||||||
List<ItemStack> itemsLost = diff.entrySet().stream()
|
|
||||||
.map(e -> new ItemStack(e.getElement(), (-1 * e.getCount()), client.getLocalPlayer().getLocalLocation()))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
|
|
||||||
final LootTrackerItem[] entries = buildEntries(stack(itemsLost));
|
|
||||||
SwingUtilities.invokeLater(() -> panel.add("Death: " + client.getLocalPlayer().getName(),
|
|
||||||
client.getLocalPlayer().getCombatLevel(), entries));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (message.equals(CHEST_LOOTED_MESSAGE))
|
if (message.equals(CHEST_LOOTED_MESSAGE))
|
||||||
{
|
{
|
||||||
final int regionID = client.getLocalPlayer().getWorldLocation().getRegionID();
|
final int regionID = client.getLocalPlayer().getWorldLocation().getRegionID();
|
||||||
@@ -589,11 +583,10 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
|
|
||||||
final LootTrackerItem[] entries = buildEntries(stack(itemsLost));
|
final LootTrackerItem[] entries = buildEntries(stack(itemsLost));
|
||||||
String name = "Death: " + client.getLocalPlayer().getName();
|
String name = "Death: " + client.getLocalPlayer().getName();
|
||||||
SwingUtilities.invokeLater(() -> panel.add(name,
|
SwingUtilities.invokeLater(() -> panel.add(name, client.getLocalPlayer().getName(),
|
||||||
client.getLocalPlayer().getCombatLevel(), entries));
|
client.getLocalPlayer().getCombatLevel(), entries));
|
||||||
LootRecord lootRecord = new LootRecord(name, LootRecordType.DEATH, toGameItems(itemsLost),
|
LootRecord lootRecord = new LootRecord(name, client.getLocalPlayer().getName(), LootRecordType.DEATH,
|
||||||
Instant.now());
|
toGameItems(itemsLost), Instant.now());
|
||||||
|
|
||||||
if (lootTrackerClient != null && config.saveLoot())
|
if (lootTrackerClient != null && config.saveLoot())
|
||||||
{
|
{
|
||||||
lootTrackerClient.submit(lootRecord);
|
lootTrackerClient.submit(lootRecord);
|
||||||
@@ -699,11 +692,12 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
final LootTrackerItem[] entries = buildEntries(stack(items));
|
final LootTrackerItem[] entries = buildEntries(stack(items));
|
||||||
SwingUtilities.invokeLater(() -> panel.add(chestType, -1, entries));
|
SwingUtilities.invokeLater(() -> panel.add(client.getLocalPlayer().getName(), chestType, -1, entries));
|
||||||
|
|
||||||
if (lootTrackerClient != null && config.saveLoot())
|
if (lootTrackerClient != null && config.saveLoot())
|
||||||
{
|
{
|
||||||
LootRecord lootRecord = new LootRecord(chestType, LootRecordType.EVENT, toGameItems(items), Instant.now());
|
LootRecord lootRecord = new LootRecord(client.getLocalPlayer().getName(), chestType,
|
||||||
|
LootRecordType.EVENT, toGameItems(items), Instant.now());
|
||||||
lootTrackerClient.submit(lootRecord);
|
lootTrackerClient.submit(lootRecord);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -771,7 +765,8 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
buildLootTrackerItem(itemStack.getId(), itemStack.getQty())
|
buildLootTrackerItem(itemStack.getId(), itemStack.getQty())
|
||||||
).toArray(LootTrackerItem[]::new);
|
).toArray(LootTrackerItem[]::new);
|
||||||
|
|
||||||
trackerRecords.add(new LootTrackerRecord(record.getEventId(), "", drops, -1));
|
trackerRecords.add(new LootTrackerRecord(record.getEventId(), record.getUsername(),
|
||||||
|
"", drops, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
return trackerRecords;
|
return trackerRecords;
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import lombok.Value;
|
|||||||
class LootTrackerRecord
|
class LootTrackerRecord
|
||||||
{
|
{
|
||||||
private final String title;
|
private final String title;
|
||||||
|
private String localUsername;
|
||||||
private final String subTitle;
|
private final String subTitle;
|
||||||
@SerializedName("item_records")
|
@SerializedName("item_records")
|
||||||
private final LootTrackerItem[] items;
|
private final LootTrackerItem[] items;
|
||||||
|
|||||||
Reference in New Issue
Block a user