回退bug
parent
4ae13de871
commit
701d32c31f
|
@ -1547,8 +1547,11 @@ public class HeroLogic {
|
|||
throw new ErrorCodeException(ErrorCode.HERO_ITEM_NOT);
|
||||
}
|
||||
}
|
||||
|
||||
if (needTotalHeroNums != (removeHeroIds.size() + removeItemMap.size())) {
|
||||
int itemNum = 0;
|
||||
for (Integer value : removeItemMap.values()) {
|
||||
itemNum += value;
|
||||
}
|
||||
if (needTotalHeroNums != (removeHeroIds.size() + itemNum)) {
|
||||
LOGGER.error("hero num not enough");
|
||||
throw new ErrorCodeException(ErrorCode.HERO_UN_MATCH);
|
||||
}
|
||||
|
@ -4059,12 +4062,11 @@ public class HeroLogic {
|
|||
// 法宝归元
|
||||
if (hero.getEspecialEquipLevel() > 0) {
|
||||
Map<Integer, Integer> dropTempMap = ItemLogic.getInstance().heroEspecialEquipReturnItem(hero);
|
||||
if (dropTempMap == null) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
if (dropTempMap != null) {
|
||||
dropTempMap.forEach((k, v) -> dropMap.put(k, dropMap.getOrDefault(k, 0) + v));
|
||||
hero.updateEspecial(1);
|
||||
}
|
||||
}
|
||||
// 卸下魂印
|
||||
Map<Integer, Integer> soulEquipByPositionMap = hero.getSoulEquipByPositionMap();
|
||||
for (Integer value : soulEquipByPositionMap.values()) {
|
||||
|
@ -4092,13 +4094,19 @@ public class HeroLogic {
|
|||
}
|
||||
ItemUtil.itemCost(user, cost, BIReason.HERO_RETURN, hero.getTemplateId());
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, ItemUtil.mapToArray(dropMap), BIReason.HERO_RETURN);
|
||||
List<CommonProto.Item> itemList = drop.getItemlistList();
|
||||
List<Integer> itemId = new ArrayList<>(itemList.size());
|
||||
List<Integer> itemNum = new ArrayList<>(itemList.size());
|
||||
itemList.forEach(item -> {
|
||||
itemId.add(item.getItemId());
|
||||
itemNum.add((int) item.getItemNum());
|
||||
});
|
||||
if (!soulEquipByPositionMap.isEmpty()) {
|
||||
List<CommonProto.Item> itemlistList = drop.getItemlistList();
|
||||
Set<Integer> needRemove = new HashSet<>(soulEquipByPositionMap.size());
|
||||
for (int i = 0; i < itemlistList.size(); i++) {
|
||||
CommonProto.Item item = itemlistList.get(i);
|
||||
if (soulEquipByPositionMap.values().contains(item.getItemId())) {
|
||||
needRemove.add(i);
|
||||
}
|
||||
}
|
||||
for (Integer index : needRemove) {
|
||||
drop.removeItemlist(index);
|
||||
}
|
||||
}
|
||||
hero.setLevel(1);
|
||||
hero.setBreakId(0);
|
||||
hero.setStar(5);
|
||||
|
|
Loading…
Reference in New Issue