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.ImageUtil;
|
||||||
import net.runelite.client.util.QuantityFormatter;
|
import net.runelite.client.util.QuantityFormatter;
|
||||||
import net.runelite.client.util.Text;
|
import net.runelite.client.util.Text;
|
||||||
|
import net.runelite.http.api.loottracker.LootRecordType;
|
||||||
|
|
||||||
class LootTrackerBox extends JPanel
|
class LootTrackerBox extends JPanel
|
||||||
{
|
{
|
||||||
@@ -70,6 +71,7 @@ class LootTrackerBox extends JPanel
|
|||||||
private final ItemManager itemManager;
|
private final ItemManager itemManager;
|
||||||
@Getter(AccessLevel.PACKAGE)
|
@Getter(AccessLevel.PACKAGE)
|
||||||
private final String id;
|
private final String id;
|
||||||
|
private final LootRecordType lootRecordType;
|
||||||
private final LootTrackerPriceType priceType;
|
private final LootTrackerPriceType priceType;
|
||||||
private final boolean showPriceType;
|
private final boolean showPriceType;
|
||||||
|
|
||||||
@@ -84,6 +86,7 @@ class LootTrackerBox extends JPanel
|
|||||||
LootTrackerBox(
|
LootTrackerBox(
|
||||||
final ItemManager itemManager,
|
final ItemManager itemManager,
|
||||||
final String id,
|
final String id,
|
||||||
|
final LootRecordType lootRecordType,
|
||||||
@Nullable final String subtitle,
|
@Nullable final String subtitle,
|
||||||
final boolean hideIgnoredItems,
|
final boolean hideIgnoredItems,
|
||||||
final LootTrackerPriceType priceType,
|
final LootTrackerPriceType priceType,
|
||||||
@@ -91,6 +94,7 @@ class LootTrackerBox extends JPanel
|
|||||||
final BiConsumer<String, Boolean> onItemToggle)
|
final BiConsumer<String, Boolean> onItemToggle)
|
||||||
{
|
{
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
this.lootRecordType = lootRecordType;
|
||||||
this.itemManager = itemManager;
|
this.itemManager = itemManager;
|
||||||
this.onItemToggle = onItemToggle;
|
this.onItemToggle = onItemToggle;
|
||||||
this.hideIgnoredItems = hideIgnoredItems;
|
this.hideIgnoredItems = hideIgnoredItems;
|
||||||
@@ -151,7 +155,7 @@ class LootTrackerBox extends JPanel
|
|||||||
*/
|
*/
|
||||||
boolean matches(final LootTrackerRecord record)
|
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.ImageUtil;
|
||||||
import net.runelite.client.util.QuantityFormatter;
|
import net.runelite.client.util.QuantityFormatter;
|
||||||
import net.runelite.client.util.SwingUtil;
|
import net.runelite.client.util.SwingUtil;
|
||||||
|
import net.runelite.http.api.loottracker.LootRecordType;
|
||||||
import net.runelite.http.api.loottracker.LootTrackerClient;
|
import net.runelite.http.api.loottracker.LootTrackerClient;
|
||||||
|
|
||||||
class LootTrackerPanel extends PluginPanel
|
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
|
* 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 LootRecordType type, final int actorLevel, LootTrackerItem[] items)
|
||||||
{
|
{
|
||||||
final String subTitle = actorLevel > -1 ? "(lvl-" + actorLevel + ")" : "";
|
final String subTitle;
|
||||||
final LootTrackerRecord record = new LootTrackerRecord(eventName, subTitle, items, 1);
|
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);
|
sessionRecords.add(record);
|
||||||
|
|
||||||
LootTrackerBox box = buildBox(record);
|
LootTrackerBox box = buildBox(record);
|
||||||
@@ -487,7 +496,7 @@ class LootTrackerPanel extends PluginPanel
|
|||||||
overallPanel.setVisible(true);
|
overallPanel.setVisible(true);
|
||||||
|
|
||||||
// Create box
|
// 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);
|
hideIgnoredItems, config.priceType(), config.showPriceType(), plugin::toggleItem);
|
||||||
box.addKill(record);
|
box.addKill(record);
|
||||||
|
|
||||||
|
|||||||
@@ -348,7 +348,7 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
void addLoot(String name, int combatLevel, LootRecordType type, Collection<ItemStack> items)
|
void addLoot(String name, int combatLevel, LootRecordType type, Collection<ItemStack> items)
|
||||||
{
|
{
|
||||||
final LootTrackerItem[] entries = buildEntries(stack(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())
|
if (config.saveLoot())
|
||||||
{
|
{
|
||||||
@@ -729,7 +729,7 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
buildLootTrackerItem(itemStack.getId(), itemStack.getQty())
|
buildLootTrackerItem(itemStack.getId(), itemStack.getQty())
|
||||||
).toArray(LootTrackerItem[]::new);
|
).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));
|
.collect(Collectors.toCollection(ArrayList::new));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,12 +25,14 @@
|
|||||||
package net.runelite.client.plugins.loottracker;
|
package net.runelite.client.plugins.loottracker;
|
||||||
|
|
||||||
import lombok.Value;
|
import lombok.Value;
|
||||||
|
import net.runelite.http.api.loottracker.LootRecordType;
|
||||||
|
|
||||||
@Value
|
@Value
|
||||||
class LootTrackerRecord
|
class LootTrackerRecord
|
||||||
{
|
{
|
||||||
private final String title;
|
private final String title;
|
||||||
private final String subTitle;
|
private final String subTitle;
|
||||||
|
private final LootRecordType type;
|
||||||
private final LootTrackerItem[] items;
|
private final LootTrackerItem[] items;
|
||||||
private final int kills;
|
private final int kills;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user