diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/item/ItemLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/item/ItemLogic.java index 41b93ff25..e66660e14 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/item/ItemLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/item/ItemLogic.java @@ -781,18 +781,27 @@ public class ItemLogic { } public static TreeSet getJewelEquipWithLeve(User user, int type, int rance, int leve) { - return user.getEquipManager().getEquipMap().entrySet().stream().filter(stringEquipEntry -> - StringUtil.isEmpty(stringEquipEntry.getValue().getHeroId()) - ).filter(stringPropertyItemEntry -> stringPropertyItemEntry.getValue() instanceof Jewel).filter(stringPropertyItemEntry -> { - if (((Jewel) stringPropertyItemEntry.getValue()).getBuildLevel() != 0 || stringPropertyItemEntry.getValue().getLevel() != 0) { - return false; - } + TreeSet strings = new TreeSet<>(); + for (Map.Entry stringPropertyItemEntry : user.getEquipManager().getEquipMap().entrySet()) { SJewelConfig config = STableManager.getConfig(SJewelConfig.class).get(stringPropertyItemEntry.getValue().getEquipId()); if (config == null) { - return false; + continue; } - return config.getLocation() == type && config.getRace() == rance && config.getLevel() == leve; - }).map(Map.Entry::getKey).collect(Collectors.toCollection(TreeSet::new)); + if (config.getLocation() != type || config.getRace() != rance || config.getLevel() != leve) { + continue; + } + if (!StringUtil.isEmpty(stringPropertyItemEntry.getValue().getHeroId())) { + Hero hero = user.getHeroManager().getHero(stringPropertyItemEntry.getValue().getHeroId()); + if (hero != null && hero.getJewelInfo().contains(stringPropertyItemEntry.getKey())) { + continue; + } + } + if (((Jewel) stringPropertyItemEntry.getValue()).getBuildLevel() != 0 || stringPropertyItemEntry.getValue().getLevel() != 0) { + continue; + } + strings.add(stringPropertyItemEntry.getValue().getId()); + } + return strings; } /**