Skip to content

Commit

Permalink
fix(loot): ignore intersection if rarity threshold not set (#647)
Browse files Browse the repository at this point in the history
  • Loading branch information
iProdigy authored Jan 30, 2025
1 parent 4b9d411 commit d0bbc17
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Unreleased

- Minor: Add `%SENDER%` template variable for chat notifier. (#644)
- Bugfix: Ignore misconfigured loot value-rarity intersection setting if rarity threshold is not configured. (#647)

## 1.10.20

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/dinkplugin/notifiers/LootNotifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ private void handleNotify(Collection<ItemStack> items, String dropper, LootRecor
RareItemStack rarest = null;

final double rarityThreshold = config.lootRarityThreshold() > 0 ? 1.0 / config.lootRarityThreshold() : Double.NaN;
final boolean intersection = config.lootRarityValueIntersection() && Double.isFinite(rarityThreshold);
for (ItemStack item : reduced) {
SerializedItemStack stack = ItemUtils.stackFromItem(itemManager, item.getId(), item.getQuantity());
long totalPrice = stack.getTotalPrice();
Expand All @@ -181,7 +182,7 @@ private void handleNotify(Collection<ItemStack> items, String dropper, LootRecor
if (MathUtils.lessThanOrEqual(rarity.orElse(1), rarityThreshold)) {
criteria.add(LootCriteria.RARITY);
}
if (config.lootRarityValueIntersection()) {
if (intersection) {
shouldSend = criteria.contains(LootCriteria.VALUE) && (rarity.isEmpty() || criteria.contains(LootCriteria.RARITY));
} else {
shouldSend = criteria.contains(LootCriteria.VALUE) || criteria.contains(LootCriteria.RARITY);
Expand Down

0 comments on commit d0bbc17

Please sign in to comment.