修改灵兽
parent
871ba646e0
commit
64744bb3bb
|
@ -2153,6 +2153,27 @@ public class HeroLogic{
|
|||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
Pokemon pokemon = pokemonManager.getPokemonMap().get(pokemonId);
|
||||
if(level<=pokemon.getLevel()){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
|
||||
Map<Integer, SSpiritAnimalLevel> levelMap = SSpiritAnimalLevel.configByQualityAndLevel.get(3);
|
||||
Map<Integer,Integer> costMap = new HashMap<>();
|
||||
for(int i = pokemon.getLevel();i<level;i++){
|
||||
if(!levelMap.containsKey(i)){
|
||||
continue;
|
||||
}
|
||||
SSpiritAnimalLevel sSpiritAnimalLevel = levelMap.get(i);
|
||||
if(sSpiritAnimalLevel==null){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
|
||||
boolean b = ItemUtil.checkCost(user, costMap);
|
||||
if(!b){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pokemonManager.updatePokemonLevel(pokemonId,level);
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package config;
|
|||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="SpiritAnimalLevel")
|
||||
|
@ -25,7 +26,13 @@ public class SSpiritAnimalLevel implements BaseConfig {
|
|||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
Map<Integer,Map<Integer,SSpiritAnimalLevel>> tempConfigByQualityAndLevel = new HashMap<>();
|
||||
Map<Integer, SSpiritAnimalLevel> config = STableManager.getConfig(SSpiritAnimalLevel.class);
|
||||
for(Map.Entry<Integer,SSpiritAnimalLevel> entry:config.entrySet()){
|
||||
SSpiritAnimalLevel value = entry.getValue();
|
||||
tempConfigByQualityAndLevel.computeIfAbsent(value.getQuality(),n->new HashMap<>()).put(value.getLevel(),value);
|
||||
}
|
||||
configByQualityAndLevel = tempConfigByQualityAndLevel;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue