Convert item stats mapping to use item ids instead of names
Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
@@ -84,7 +84,7 @@ public class ItemManager
|
||||
|
||||
private final ItemClient itemClient = new ItemClient();
|
||||
private Map<Integer, ItemPrice> itemPrices = Collections.emptyMap();
|
||||
private Map<String, ItemStats> itemStats = Collections.emptyMap();
|
||||
private Map<Integer, ItemStats> itemStats = Collections.emptyMap();
|
||||
private final LoadingCache<ImageKey, AsyncBufferedImage> itemImages;
|
||||
private final LoadingCache<Integer, ItemComposition> itemCompositions;
|
||||
private final LoadingCache<OutlineKey, BufferedImage> itemOutlines;
|
||||
@@ -226,7 +226,7 @@ public class ItemManager
|
||||
{
|
||||
try
|
||||
{
|
||||
final Map<String, ItemStats> stats = itemClient.getStats();
|
||||
final Map<Integer, ItemStats> stats = itemClient.getStats();
|
||||
if (stats != null)
|
||||
{
|
||||
itemStats = ImmutableMap.copyOf(stats);
|
||||
@@ -307,16 +307,16 @@ public class ItemManager
|
||||
* @return item stats
|
||||
*/
|
||||
@Nullable
|
||||
public ItemStats getItemStats(int itemId)
|
||||
public ItemStats getItemStats(int itemId, boolean allowNote)
|
||||
{
|
||||
ItemComposition itemComposition = getItemComposition(itemId);
|
||||
|
||||
if (itemComposition == null || itemComposition.getName() == null)
|
||||
if (itemComposition == null || itemComposition.getName() == null || (!allowNote && itemComposition.getNote() != -1))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return itemStats.get(itemComposition.getName());
|
||||
return itemStats.get(canonicalize(itemId));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -139,7 +139,7 @@ public class ItemStatOverlay extends Overlay
|
||||
|
||||
if (config.equipmentStats())
|
||||
{
|
||||
final ItemStats stats = itemManager.getItemStats(itemId);
|
||||
final ItemStats stats = itemManager.getItemStats(itemId, false);
|
||||
|
||||
if (stats != null)
|
||||
{
|
||||
@@ -205,7 +205,7 @@ public class ItemStatOverlay extends Overlay
|
||||
final Item item = items[slot];
|
||||
if (item != null)
|
||||
{
|
||||
other = itemManager.getItemStats(item.getId());
|
||||
other = itemManager.getItemStats(item.getId(), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user