Skip to content
This repository has been archived by the owner on Aug 29, 2022. It is now read-only.

Commit

Permalink
Fix todo by taking horizontal samples as well
Browse files Browse the repository at this point in the history
  • Loading branch information
casid committed Feb 15, 2018
1 parent 282647d commit 35cc161
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ public List<InventorySlot> getAll() {
}

slots.parallelStream().forEach(slot -> {
for (int y = -1; y <= 1; ++y) {
slot.imageHashes.add(getHash(inventoryImage, slot.x, slot.y + y * slotOffsetY, (int) slotWidth, (int) slotHeight));
for (int x = -1; x <= 1; ++x) {
for (int y = -1; y <= 1; ++y) {
slot.imageHashes.add(getHash(inventoryImage, slot.x + x * slotOffsetX, slot.y + y * slotOffsetY, (int) slotWidth, (int) slotHeight));
}
}
slot.x += inventoryArea.x + slotCenterX;
slot.y += inventoryArea.y + slotCenterY;
Expand All @@ -81,6 +83,7 @@ private Set<Integer> getIgnoredSlots() {

private Hash getHash(BufferedImage inventoryImage, int slotX, int slotY, int slotWidth, int slotHeight) {
try {
slotX = Math.max(0, Math.min(inventoryImage.getWidth() - slotWidth, slotX));
slotY = Math.max(0, Math.min(inventoryImage.getHeight() - slotHeight, slotY));
return imageHashPlugin.getHash(inventoryImage.getSubimage(slotX, slotY, slotWidth, slotHeight));
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ void smallerResolution() {
thenSlotsContainCurrency(2, 4, false);
thenSlotsContainCurrency(5, 7, true);
thenSlotsContainCurrency(8, 9, false);
thenSlotsContainCurrency(10, 11, true);
// TODO shard at 12 is not recognized
thenSlotsContainCurrency(10, 12, true);
thenSlotsContainCurrency(13, 15, true);
thenSlotsContainCurrency(16, 44, false);
thenSlotsContainCurrency(45, 45, true);
Expand Down

0 comments on commit 35cc161

Please sign in to comment.