Task【ID1006177】【新战斗版本】宝物合成
parent
f75b7ad1cc
commit
77a50f4e5e
|
@ -11,6 +11,8 @@ import com.ljsd.jieling.logic.dao.UserManager;
|
|||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.item.ItemLogic;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.HeroInfoProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
|
@ -27,16 +29,16 @@ import java.util.*;
|
|||
* Author: zsx
|
||||
* CreateDate: 2020/5/8 11:51
|
||||
*/
|
||||
public class ComplexJewelEquipHandler extends BaseHandler<HeroInfoProto.ComplexJewelEquipRequest> {
|
||||
public class ComplexJewelEquipRequestHandler extends BaseHandler<HeroInfoProto.ComplexJewelEquipRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneratedMessage processWithProto(int uid, HeroInfoProto.ComplexJewelEquipRequest proto) throws Exception {
|
||||
public void processWithProto(ISession iSession, HeroInfoProto.ComplexJewelEquipRequest proto) throws Exception {
|
||||
|
||||
User user = UserManager.getUser(uid);
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
if (user == null) {
|
||||
throw new ErrorCodeException(ErrorCode.UNKNOWN);
|
||||
}
|
||||
|
@ -72,7 +74,8 @@ public class ComplexJewelEquipHandler extends BaseHandler<HeroInfoProto.ComplexJ
|
|||
}
|
||||
|
||||
|
||||
Set<String> equipByIDs = ItemLogic.getJewelEquip(user, sEquipStarsConfig.getLocation(),sEquipStarsConfig.getRace());
|
||||
// Set<String> equipByIDs = ItemLogic.getJewelEquip(user, sEquipStarsConfig.getLocation(),sEquipStarsConfig.getRace());
|
||||
TreeSet<String> equipByIDs = ItemLogic.getJewelEquipWithLeve(user, sEquipStarsConfig.getLocation(),sEquipStarsConfig.getRace(),needLeve);
|
||||
|
||||
int needcount = sEquipStarsConfig.getRankupCount();
|
||||
if (equipByIDs.size() / needcount < proto.getNum()) {
|
||||
|
@ -97,7 +100,7 @@ public class ComplexJewelEquipHandler extends BaseHandler<HeroInfoProto.ComplexJ
|
|||
dropItems[0][0] = sTargetEquipStarsConfig.getId();
|
||||
dropItems[0][1] = proto.getNum();
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropItems, BIReason.COMPLEX_EQUIP);
|
||||
HeroInfoProto.ComplexEquipResponse.Builder response = HeroInfoProto.ComplexEquipResponse.newBuilder();
|
||||
HeroInfoProto.ComplexJewelEquipResponse.Builder response = HeroInfoProto.ComplexJewelEquipResponse.newBuilder();
|
||||
|
||||
//remove old 宝器
|
||||
int i = 1;
|
||||
|
@ -110,34 +113,31 @@ public class ComplexJewelEquipHandler extends BaseHandler<HeroInfoProto.ComplexJ
|
|||
i++;
|
||||
}
|
||||
response.setDrop(drop);
|
||||
MessageUtil.sendIndicationMessage(uid, response.build());
|
||||
MessageUtil.sendIndicationMessage(user.getId(), response.build());
|
||||
|
||||
} else {
|
||||
|
||||
Map<Integer, Map<Integer, Integer>> race2quality2soulid = STableManager.getFigureConfig(ItemStaticConfig.class).getRace2quality2soulid();
|
||||
Map<Integer, Map<Integer, Integer>> race2quality2id = STableManager.getFigureConfig(ItemStaticConfig.class).getRace2quality2id();
|
||||
|
||||
Map<Integer, Integer> soulInnerMap = new TreeMap<>(race2quality2soulid.getOrDefault(1, new HashMap<>()));
|
||||
Map<Integer, Integer> innerMap = new TreeMap<>(race2quality2id.getOrDefault(2, new HashMap<>()));
|
||||
Map<Integer, Integer> soulInnerMap = new TreeMap<>(race2quality2soulid.getOrDefault(proto.getRance(), new HashMap<>()));
|
||||
Map<Integer, Integer> innerMap = new TreeMap<>(race2quality2id.getOrDefault(proto.getRance(), new HashMap<>()));
|
||||
|
||||
Set<String> equipadds =new HashSet<>();
|
||||
List< CommonProto.Equip> equips = new LinkedList<>();
|
||||
combineEquip(user,soulInnerMap,equips,equipadds);
|
||||
combineEquip(user,innerMap,equips,equipadds);
|
||||
|
||||
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder().addAllEquipId(equips);
|
||||
HeroInfoProto.ComplexEquipResponse.Builder response = HeroInfoProto.ComplexEquipResponse.newBuilder();
|
||||
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder().addAllSoulEquip(equips);
|
||||
HeroInfoProto.ComplexJewelEquipResponse.Builder response = HeroInfoProto.ComplexJewelEquipResponse.newBuilder();
|
||||
response.addAllEquipIds(equipadds);
|
||||
response.setDrop(drop);
|
||||
System.out.print(response.build().toString());
|
||||
MessageUtil.sendIndicationMessage(uid, response.build());
|
||||
MessageUtil.sendIndicationMessage(user.getId(), response.build());
|
||||
}
|
||||
|
||||
return HeroInfoProto.ComplexEquipResponse.newBuilder().build();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void combineEquip(User user, Map<Integer, Integer> integerIntegerMap ,List<CommonProto.Equip> equips,Set<String> equipadds) throws Exception {
|
||||
|
||||
Map<Integer, Integer> consumeMap = new HashMap<>();
|
||||
|
@ -151,7 +151,7 @@ public class ComplexJewelEquipHandler extends BaseHandler<HeroInfoProto.ComplexJ
|
|||
break;
|
||||
}
|
||||
|
||||
SJewelConfig sTargetEquipStarsConfig = STableManager.getConfig(SJewelConfig.class).get(targetstar);
|
||||
SJewelConfig sTargetEquipStarsConfig = STableManager.getConfig(SJewelConfig.class).get(integerIntegerMap.get(targetstar));
|
||||
if (null == sTargetEquipStarsConfig) {
|
||||
break;
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ public class ComplexJewelEquipHandler extends BaseHandler<HeroInfoProto.ComplexJ
|
|||
throw new ErrorCodeException(ErrorCode.CFG_NULL);
|
||||
}
|
||||
|
||||
TreeSet<String> equipByIDs = ItemLogic.getJewelEquip(user, sEquipStarsConfig.getLocation(),sEquipStarsConfig.getRace());
|
||||
TreeSet<String> equipByIDs = ItemLogic.getJewelEquipWithLeve(user, sEquipStarsConfig.getLocation(),sEquipStarsConfig.getRace(),entry.getKey());
|
||||
int canConNum =equipByIDs.size()/sEquipStarsConfig.getRankupCount();
|
||||
if(canConNum<=0){
|
||||
continue;
|
||||
|
@ -204,7 +204,6 @@ public class ComplexJewelEquipHandler extends BaseHandler<HeroInfoProto.ComplexJ
|
|||
for (String id:newids) {
|
||||
equips.add(CBean2Proto.getEquipProto( user.getEquipManager().getEquipMap().get(id)));
|
||||
}
|
||||
|
||||
ItemUtil.itemCost(user, consumeMap, BIReason.COMPLEX_EQUIP_CONSUME, 0);
|
||||
}
|
||||
|
|
@ -516,6 +516,18 @@ public class ItemLogic {
|
|||
}).map(Map.Entry::getKey).collect(Collectors.toCollection(TreeSet::new));
|
||||
}
|
||||
|
||||
public static TreeSet<String> 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 -> {
|
||||
SJewelConfig config = STableManager.getConfig(SJewelConfig.class).get(stringPropertyItemEntry.getValue().getEquipId());
|
||||
if (config == null) {
|
||||
return false;
|
||||
}
|
||||
return config.getLocation() == type && config.getRace() == rance&&config.getLevel()==leve;
|
||||
}).map(Map.Entry::getKey).collect(Collectors.toCollection(TreeSet::new));
|
||||
}
|
||||
|
||||
/**
|
||||
* 宝器强化 精炼
|
||||
* @param iSession
|
||||
|
|
Loading…
Reference in New Issue