公会技能, 连点升级bug处理
parent
391c7f3cbe
commit
d09523bb89
|
|
@ -1505,39 +1505,32 @@ public class GuildLogic {
|
||||||
Map<Integer, Integer> skillInfo= user.getGuildMyInfo().getGuildSkill();
|
Map<Integer, Integer> skillInfo= user.getGuildMyInfo().getGuildSkill();
|
||||||
|
|
||||||
Map<Integer, Map<Integer, SGuildTechnology>> typeMap = SGuildTechnology.technologyMap.get(type);
|
Map<Integer, Map<Integer, SGuildTechnology>> typeMap = SGuildTechnology.technologyMap.get(type);
|
||||||
if(skillInfo.getOrDefault(type, 0)!=beforeLevel||afterLevel>600)
|
if(skillInfo.getOrDefault(type, 0)!=beforeLevel||afterLevel>600) {
|
||||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||||
|
}
|
||||||
int size = typeMap.size();
|
int size = typeMap.size();
|
||||||
|
|
||||||
|
|
||||||
Map<Integer,Integer> consumeMap = new HashMap<>(2);
|
Map<Integer,Integer> consumeMap = new HashMap<>(2);
|
||||||
int baseLevel = beforeLevel / size;//100->16
|
int baseLevel = beforeLevel / size;//100->16
|
||||||
int nextIndex = beforeLevel % size;//100->4
|
int nextIndex = beforeLevel % size;//100->4
|
||||||
|
|
||||||
int afterBaseLevel =afterLevel / size;
|
int afterBaseLevel =afterLevel / size;
|
||||||
int afterNextIndex = afterLevel % size;
|
int afterNextIndex = afterLevel % size;
|
||||||
// if(){
|
|
||||||
// }else{
|
|
||||||
// int level = skillInfo.get(type);
|
|
||||||
// consume = typeMap.get(level%size+1).get(level/size).getConsume();
|
|
||||||
// if(typeMap.get(level%size+1).get(level/size+1)==null){
|
|
||||||
// throw new ErrorCodeException(ErrorCode.HERO_LEVE_MAX);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
while(baseLevel<afterBaseLevel || nextIndex<afterNextIndex){
|
|
||||||
|
|
||||||
|
while(baseLevel<afterBaseLevel || nextIndex<afterNextIndex){
|
||||||
|
// 消耗道具获取
|
||||||
int[][] consume = typeMap.get(nextIndex+1).get(baseLevel).getConsume();
|
int[][] consume = typeMap.get(nextIndex+1).get(baseLevel).getConsume();
|
||||||
for(int[] consumeOnce:consume) {
|
for(int[] consumeOnce:consume) {
|
||||||
consumeMap.put(consumeOnce[0],consumeMap.getOrDefault(consumeOnce[0], 0)+consumeOnce[1]);
|
consumeMap.put(consumeOnce[0],consumeMap.getOrDefault(consumeOnce[0], 0)+consumeOnce[1]);
|
||||||
}
|
}
|
||||||
|
// 道具消耗
|
||||||
if(!ItemUtil.checkCost(user, consumeMap)){
|
boolean itemCost = ItemUtil.itemCost(user, ItemUtil.mapToArray(consumeMap), BIReason.GUILD_SKILL_LEVEL_UP_CONSUME, 1);
|
||||||
//把这一次的减回去
|
if(!itemCost){
|
||||||
for(int[] consumeOnce:consume) {
|
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||||
consumeMap.put(consumeOnce[0],consumeMap.getOrDefault(consumeOnce[0], 0)-consumeOnce[1]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
// 清理道具map
|
||||||
|
consumeMap.clear();
|
||||||
|
// 次数增加
|
||||||
if(nextIndex+1==size){
|
if(nextIndex+1==size){
|
||||||
nextIndex=0;
|
nextIndex=0;
|
||||||
baseLevel++;
|
baseLevel++;
|
||||||
|
|
@ -1545,14 +1538,10 @@ public class GuildLogic {
|
||||||
nextIndex++;
|
nextIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
boolean itemCost = ItemUtil.itemCost(user, ItemUtil.mapToArray(consumeMap), BIReason.GUILD_SKILL_LEVEL_UP_CONSUME, 1);
|
|
||||||
if(!itemCost){
|
|
||||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
|
||||||
}
|
|
||||||
Family.GuildSkillLevelUpResponse response = Family.GuildSkillLevelUpResponse.newBuilder().setType(type).setCurlevel(baseLevel*size+nextIndex).build();
|
Family.GuildSkillLevelUpResponse response = Family.GuildSkillLevelUpResponse.newBuilder().setType(type).setCurlevel(baseLevel*size+nextIndex).build();
|
||||||
|
|
||||||
user.getGuildMyInfo().setGuildSkillByType(type,baseLevel*size+nextIndex);
|
user.getGuildMyInfo().setGuildSkillByType(type,baseLevel*size+nextIndex);
|
||||||
// user.getGuildMyInfo().setGuildSkillByType(type,590);
|
|
||||||
|
|
||||||
Poster.getPoster().dispatchEvent(new UserMainTeamForceEvent(session.getUid()));
|
Poster.getPoster().dispatchEvent(new UserMainTeamForceEvent(session.getUid()));
|
||||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),response,true);
|
MessageUtil.sendMessage(session,1,messageType.getNumber(),response,true);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue