Merge pull request #586 from pklite/loottracker-death-untradables
Adds GP value to untradables lost on pvp death
This commit is contained in:
@@ -39,8 +39,6 @@ public enum LootRecordSortType implements Comparator<LootTrackerRecord>
|
|||||||
}
|
}
|
||||||
int sum = Arrays.stream(o1.getItems()).flatMapToInt(lootTrackerItem ->
|
int sum = Arrays.stream(o1.getItems()).flatMapToInt(lootTrackerItem ->
|
||||||
IntStream.of((int) lootTrackerItem.getPrice() * lootTrackerItem.getQuantity())).sum();
|
IntStream.of((int) lootTrackerItem.getPrice() * lootTrackerItem.getQuantity())).sum();
|
||||||
log.info(String.valueOf(sum + Arrays.stream(o2.getItems()).flatMapToInt(lootTrackerItem ->
|
|
||||||
IntStream.of((int) lootTrackerItem.getPrice() * lootTrackerItem.getQuantity())).sum()));
|
|
||||||
return sum + Arrays.stream(o2.getItems()).flatMapToInt(lootTrackerItem ->
|
return sum + Arrays.stream(o2.getItems()).flatMapToInt(lootTrackerItem ->
|
||||||
IntStream.of((int) lootTrackerItem.getPrice() * lootTrackerItem.getQuantity())).sum();
|
IntStream.of((int) lootTrackerItem.getPrice() * lootTrackerItem.getQuantity())).sum();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,11 +33,9 @@ import java.awt.event.MouseAdapter;
|
|||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.IntStream;
|
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.BoxLayout;
|
import javax.swing.BoxLayout;
|
||||||
import javax.swing.ImageIcon;
|
import javax.swing.ImageIcon;
|
||||||
@@ -446,7 +444,6 @@ class LootTrackerPanel extends PluginPanel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
buildBox(records.get(i));
|
buildBox(records.get(i));
|
||||||
log.info(String.valueOf(Arrays.stream(records.get(i).getItems()).flatMapToInt(a -> IntStream.of(a.getQuantity() * (int) a.getPrice())).sum()));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
boxes.forEach(LootTrackerBox::rebuild);
|
boxes.forEach(LootTrackerBox::rebuild);
|
||||||
|
|||||||
@@ -743,14 +743,23 @@ public class LootTrackerPlugin extends Plugin
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
private LootTrackerItem buildLootTrackerItem(int itemId, int quantity)
|
private LootTrackerItem buildLootTrackerItem(int itemId, int quantity)
|
||||||
{
|
{
|
||||||
final ItemDefinition itemComposition = itemManager.getItemDefinition(itemId);
|
final ItemDefinition itemDefinition = itemManager.getItemDefinition(itemId);
|
||||||
final int realItemId = itemComposition.getNote() != -1 ? itemComposition.getLinkedNoteId() : itemId;
|
final int realItemId = itemDefinition.getNote() != -1 ? itemDefinition.getLinkedNoteId() : itemId;
|
||||||
final long price = (long) itemManager.getItemPrice(realItemId) * (long) quantity;
|
final long price;
|
||||||
final boolean ignored = ignoredItems.contains(itemComposition.getName());
|
// If it's a death we want to get a coin value for untradeables lost
|
||||||
|
if (!itemDefinition.isTradeable() && quantity < 0)
|
||||||
|
{
|
||||||
|
price = (long) itemDefinition.getPrice() * (long) quantity;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
price = (long) itemManager.getItemPrice(realItemId) * (long) quantity;
|
||||||
|
}
|
||||||
|
final boolean ignored = ignoredItems.contains(itemDefinition.getName());
|
||||||
|
|
||||||
return new LootTrackerItem(
|
return new LootTrackerItem(
|
||||||
itemId,
|
itemId,
|
||||||
itemComposition.getName(),
|
itemDefinition.getName(),
|
||||||
quantity,
|
quantity,
|
||||||
price,
|
price,
|
||||||
ignored);
|
ignored);
|
||||||
|
|||||||
Reference in New Issue
Block a user