loot tracker: store and match events by type
This commit is contained in:
@@ -57,6 +57,7 @@ import net.runelite.client.util.AsyncBufferedImage;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
import net.runelite.client.util.Text;
|
||||
import net.runelite.http.api.loottracker.LootRecordType;
|
||||
|
||||
class LootTrackerBox extends JPanel
|
||||
{
|
||||
@@ -70,6 +71,7 @@ class LootTrackerBox extends JPanel
|
||||
private final ItemManager itemManager;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final String id;
|
||||
private final LootRecordType lootRecordType;
|
||||
private final LootTrackerPriceType priceType;
|
||||
private final boolean showPriceType;
|
||||
|
||||
@@ -84,6 +86,7 @@ class LootTrackerBox extends JPanel
|
||||
LootTrackerBox(
|
||||
final ItemManager itemManager,
|
||||
final String id,
|
||||
final LootRecordType lootRecordType,
|
||||
@Nullable final String subtitle,
|
||||
final boolean hideIgnoredItems,
|
||||
final LootTrackerPriceType priceType,
|
||||
@@ -91,6 +94,7 @@ class LootTrackerBox extends JPanel
|
||||
final BiConsumer<String, Boolean> onItemToggle)
|
||||
{
|
||||
this.id = id;
|
||||
this.lootRecordType = lootRecordType;
|
||||
this.itemManager = itemManager;
|
||||
this.onItemToggle = onItemToggle;
|
||||
this.hideIgnoredItems = hideIgnoredItems;
|
||||
@@ -151,7 +155,7 @@ class LootTrackerBox extends JPanel
|
||||
*/
|
||||
boolean matches(final LootTrackerRecord record)
|
||||
{
|
||||
return record.getTitle().equals(id);
|
||||
return record.getTitle().equals(id) && record.getType() == lootRecordType;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -61,6 +61,7 @@ import net.runelite.client.util.ColorUtil;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
import net.runelite.client.util.SwingUtil;
|
||||
import net.runelite.http.api.loottracker.LootRecordType;
|
||||
import net.runelite.http.api.loottracker.LootTrackerClient;
|
||||
|
||||
class LootTrackerPanel extends PluginPanel
|
||||
@@ -337,10 +338,18 @@ class LootTrackerPanel extends PluginPanel
|
||||
* Creates a subtitle, adds a new entry and then passes off to the render methods, that will decide
|
||||
* how to display this new data.
|
||||
*/
|
||||
void add(final String eventName, final int actorLevel, LootTrackerItem[] items)
|
||||
void add(final String eventName, final LootRecordType type, final int actorLevel, LootTrackerItem[] items)
|
||||
{
|
||||
final String subTitle = actorLevel > -1 ? "(lvl-" + actorLevel + ")" : "";
|
||||
final LootTrackerRecord record = new LootTrackerRecord(eventName, subTitle, items, 1);
|
||||
final String subTitle;
|
||||
if (type == LootRecordType.PICKPOCKET)
|
||||
{
|
||||
subTitle = "(pickpocket)";
|
||||
}
|
||||
else
|
||||
{
|
||||
subTitle = actorLevel > -1 ? "(lvl-" + actorLevel + ")" : "";
|
||||
}
|
||||
final LootTrackerRecord record = new LootTrackerRecord(eventName, subTitle, type, items, 1);
|
||||
sessionRecords.add(record);
|
||||
|
||||
LootTrackerBox box = buildBox(record);
|
||||
@@ -487,7 +496,7 @@ class LootTrackerPanel extends PluginPanel
|
||||
overallPanel.setVisible(true);
|
||||
|
||||
// Create box
|
||||
final LootTrackerBox box = new LootTrackerBox(itemManager, record.getTitle(), record.getSubTitle(),
|
||||
final LootTrackerBox box = new LootTrackerBox(itemManager, record.getTitle(), record.getType(), record.getSubTitle(),
|
||||
hideIgnoredItems, config.priceType(), config.showPriceType(), plugin::toggleItem);
|
||||
box.addKill(record);
|
||||
|
||||
|
||||
@@ -348,7 +348,7 @@ public class LootTrackerPlugin extends Plugin
|
||||
void addLoot(String name, int combatLevel, LootRecordType type, Collection<ItemStack> items)
|
||||
{
|
||||
final LootTrackerItem[] entries = buildEntries(stack(items));
|
||||
SwingUtilities.invokeLater(() -> panel.add(name, combatLevel, entries));
|
||||
SwingUtilities.invokeLater(() -> panel.add(name, type, combatLevel, entries));
|
||||
|
||||
if (config.saveLoot())
|
||||
{
|
||||
@@ -729,7 +729,7 @@ public class LootTrackerPlugin extends Plugin
|
||||
buildLootTrackerItem(itemStack.getId(), itemStack.getQty())
|
||||
).toArray(LootTrackerItem[]::new);
|
||||
|
||||
return new LootTrackerRecord(record.getEventId(), "", drops, record.getAmount());
|
||||
return new LootTrackerRecord(record.getEventId(), "", record.getType(), drops, record.getAmount());
|
||||
})
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
}
|
||||
|
||||
@@ -25,12 +25,14 @@
|
||||
package net.runelite.client.plugins.loottracker;
|
||||
|
||||
import lombok.Value;
|
||||
import net.runelite.http.api.loottracker.LootRecordType;
|
||||
|
||||
@Value
|
||||
class LootTrackerRecord
|
||||
{
|
||||
private final String title;
|
||||
private final String subTitle;
|
||||
private final LootRecordType type;
|
||||
private final LootTrackerItem[] items;
|
||||
private final int kills;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user