From 252208e6fbdea9410ea39e51a76bc6809c5281c0 Mon Sep 17 00:00:00 2001 From: jiahuiwen Date: Wed, 17 Nov 2021 13:11:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E6=88=90=E5=AE=9D=E7=89=A9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ljsd/jieling/logic/item/ItemLogic.java | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) 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; } /**