playerscouter: fix value mapping. (#1419)

This commit is contained in:
Ganom
2019-08-22 09:21:16 -04:00
committed by Kyle
parent 491c8b12fb
commit 6e5bebe734
3 changed files with 13 additions and 4 deletions

View File

@@ -375,7 +375,7 @@ public class ItemManager
{
ItemDefinition itemDefinition = getItemDefinition(itemId);
if (itemDefinition == null || itemDefinition.getName() == null || (!allowNote && itemDefinition.getNote() != -1))
if (itemDefinition.getName() == null || !allowNote && itemDefinition.getNote() != -1)
{
return null;
}

View File

@@ -283,4 +283,9 @@ public enum ItemMapping
return mapping.iterator().next();
}
public static boolean isMapped(int itemId)
{
return MAPPINGS.containsValue(itemId);
}
}

View File

@@ -62,6 +62,7 @@ import net.runelite.api.kit.KitType;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.game.ItemManager;
import net.runelite.client.game.ItemMapping;
import net.runelite.client.game.PvPValueBrokenItem;
import net.runelite.client.game.WorldLocation;
import net.runelite.client.plugins.Plugin;
@@ -373,9 +374,10 @@ public class PlayerScouter extends Plugin
{
prices.put(id, itemManager.getBrokenValue(id));
log.debug("Item has a broken value: Id {}, Value {}", id, itemManager.getBrokenValue(id));
continue;
}
if (!itemDefinition.isTradeable() && !PvPValueBrokenItem.breaksOnDeath(id))
if (!itemDefinition.isTradeable() && !ItemMapping.isMapped(id))
{
prices.put(id, itemDefinition.getPrice());
}
@@ -392,12 +394,14 @@ public class PlayerScouter extends Plugin
player.setGear(prices.entrySet()
.stream()
.sorted(Collections.reverseOrder(Map.Entry.comparingByValue()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, LinkedHashMap::new)));
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, LinkedHashMap::new))
);
player.setRiskedGear(prices.entrySet()
.stream()
.sorted(Collections.reverseOrder(Map.Entry.comparingByValue()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, LinkedHashMap::new)));
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, LinkedHashMap::new))
);
if (player.getPlayer().getSkullIcon() == null)
{