back_recharge
parent
84104a5971
commit
d04f6fe3bf
|
@ -28,47 +28,57 @@ public class UpSoulEquipQuiickHandler extends BaseHandler<HeroInfoProto.UpQuickS
|
|||
User user = UserManager.getUser(iSession.getUid());
|
||||
SoulEquip soulEquip = user.getEquipManager().getSoulEquipMap().get(upQuickSoulEquipRequest.getEquipId());
|
||||
if (null == soulEquip) {
|
||||
throw new Exception("装备不存在");
|
||||
throw new Exception("升级的装备不存在");
|
||||
}
|
||||
int addleve = 1;
|
||||
SEquipSign sEcfg = SEquipSign.getsEquipSignMap().get(soulEquip.getCfgId());
|
||||
if (null == sEcfg ) {
|
||||
throw new Exception("装备配置不存在" + soulEquip.getCfgId());
|
||||
if (null == sEcfg) {
|
||||
throw new Exception("升级的装备配置不存在" + soulEquip.getCfgId());
|
||||
}
|
||||
SEquipSign nextEcfg = SEquipSign.getsEquipSignMap().get(soulEquip.getCfgId()+addleve);
|
||||
if ( null == nextEcfg) {
|
||||
SEquipSign nextEcfg = SEquipSign.getsEquipSignMap().get(soulEquip.getCfgId() + addleve);
|
||||
if (null == nextEcfg) {
|
||||
MessageUtil.sendErrorResponse(iSession, 0, MessageTypeProto.MessageType.UP_SOUL_EQUIP_RESPONSE_VALUE, "最高等级");
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> consumIds = new LinkedList<>();
|
||||
|
||||
int nextNeedExp = SEquipSign.getEquipExpMap().get(sEcfg.getId());
|
||||
|
||||
int sumExp = soulEquip.getExp();
|
||||
int leve = soulEquip.getLevel();
|
||||
boolean full = false;
|
||||
for (String equipId : upQuickSoulEquipRequest.getSoulEquipIdsList()) {
|
||||
if (full) {
|
||||
break;
|
||||
}
|
||||
SoulEquip equip = user.getEquipManager().getSoulEquipMap().get(equipId);
|
||||
if (null == equip) {
|
||||
MessageUtil.sendErrorResponse(iSession, 0, MessageTypeProto.MessageType.UP_SOUL_EQUIP_RESPONSE_VALUE, "");
|
||||
MessageUtil.sendErrorResponse(iSession, 0, MessageTypeProto.MessageType.UP_SOUL_EQUIP_RESPONSE_VALUE, "消耗的装备不存在");
|
||||
return;
|
||||
}
|
||||
SEquipSign sEquipSign1 = SEquipSign.getsEquipSignMap().get(equip.getCfgId());
|
||||
if (null == sEquipSign1) {
|
||||
throw new Exception("装备配置不存在" + equip.getCfgId());
|
||||
throw new Exception("消耗的装备配置不存在" + equip.getCfgId());
|
||||
}
|
||||
if (upQuickSoulEquipRequest.getEquipId() == equipId) {
|
||||
throw new Exception("消耗正在升级的装备" + equip.getCfgId());
|
||||
}
|
||||
sumExp += sEquipSign1.getResolve();
|
||||
consumIds.add(equipId);
|
||||
if (sumExp >= nextNeedExp) {
|
||||
leve+=1;
|
||||
addleve+=1;
|
||||
SEquipSign nextEcfg1 = SEquipSign.getsEquipSignMap().get(equip.getCfgId()+addleve);
|
||||
while (sumExp >= nextNeedExp) {
|
||||
SEquipSign nextEcfg1 = SEquipSign.getsEquipSignMap().get(soulEquip.getCfgId()+addleve);
|
||||
if (null == nextEcfg1) {
|
||||
full = true;
|
||||
break;
|
||||
}
|
||||
addleve += 1;
|
||||
leve += 1;
|
||||
nextNeedExp = SEquipSign.getEquipExpMap().get(nextEcfg1.getId());
|
||||
}
|
||||
if (full) {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
consumIds.forEach(id->user.getEquipManager().removeSoulEquip(id));
|
||||
consumIds.forEach(id -> user.getEquipManager().removeSoulEquip(id));
|
||||
soulEquip.setExp(sumExp);
|
||||
soulEquip.setLevel(leve);
|
||||
HeroInfoProto.UpSoulEquipResponse.Builder builder = HeroInfoProto.UpSoulEquipResponse.newBuilder();
|
||||
|
@ -76,7 +86,7 @@ public class UpSoulEquipQuiickHandler extends BaseHandler<HeroInfoProto.UpQuickS
|
|||
builder.setLeve(leve);
|
||||
builder.addAllSoulEquipIds(consumIds);
|
||||
builder.setEquipId(upQuickSoulEquipRequest.getEquipId());
|
||||
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.UP_SOUL_EQUIP_RESPONSE_VALUE,builder.build(),true);
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.UP_SOUL_EQUIP_RESPONSE_VALUE, builder.build(), true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue