异妖可下阵
parent
defb87c5da
commit
871ba646e0
|
@ -694,11 +694,22 @@ public class HeroLogic{
|
||||||
* @param teamPokemonInfos
|
* @param teamPokemonInfos
|
||||||
*/
|
*/
|
||||||
public void savePokemonTeam(ISession session, List<CommonProto.TeamPokemonInfo> teamPokemonInfos) throws Exception {
|
public void savePokemonTeam(ISession session, List<CommonProto.TeamPokemonInfo> teamPokemonInfos) throws Exception {
|
||||||
if (teamPokemonInfos == null || teamPokemonInfos.isEmpty()) {
|
if (teamPokemonInfos == null) {
|
||||||
LOGGER.info("savePokemonTeam uid=>{} , teamPokemonInfos isEmpty", session.getUid());
|
LOGGER.info("savePokemonTeam uid=>{} , teamPokemonInfos isEmpty", session.getUid());
|
||||||
throw new ErrorCodeException(ErrorCode.newDefineCode("Pokemon null"));
|
throw new ErrorCodeException(ErrorCode.newDefineCode("Pokemon null"));
|
||||||
}
|
}
|
||||||
User user = UserManager.getUser(session.getUid());
|
User user = UserManager.getUser(session.getUid());
|
||||||
|
int level = user.getPlayerInfoManager().getLevel();
|
||||||
|
int openCount = 0;
|
||||||
|
for (int sprintLevel : SSpiritAnimalSetting.sSpiritAnimalSetting.getBlockUnlockLevel()) {
|
||||||
|
if (level >= sprintLevel) {
|
||||||
|
openCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (teamPokemonInfos.size() > openCount) {
|
||||||
|
LOGGER.info("savePokemonTeam uid=>{} , count is wrong ", session.getUid());
|
||||||
|
throw new ErrorCodeException(ErrorCode.newDefineCode("count is wrong : " + openCount));
|
||||||
|
}
|
||||||
Map<String, Pokemon> pokemonMap = user.getPokemonManager().getPokemonMap();
|
Map<String, Pokemon> pokemonMap = user.getPokemonManager().getPokemonMap();
|
||||||
Map<Integer, String> pokemonTeamMap = new HashMap<>();
|
Map<Integer, String> pokemonTeamMap = new HashMap<>();
|
||||||
for (CommonProto.TeamPokemonInfo teamPokemonInfo : teamPokemonInfos) {
|
for (CommonProto.TeamPokemonInfo teamPokemonInfo : teamPokemonInfos) {
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
package config;
|
||||||
|
|
||||||
|
import manager.STableManager;
|
||||||
|
import manager.Table;
|
||||||
|
|
||||||
|
@Table(name ="SpiritAnimalSetting")
|
||||||
|
public class SSpiritAnimalSetting implements BaseConfig {
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
private int[] blockUnlockLevel;
|
||||||
|
|
||||||
|
private int proPercent;
|
||||||
|
|
||||||
|
private int returnCost;
|
||||||
|
|
||||||
|
public static SSpiritAnimalSetting sSpiritAnimalSetting;
|
||||||
|
@Override
|
||||||
|
public void init() throws Exception {
|
||||||
|
sSpiritAnimalSetting = STableManager.getConfig(SSpiritAnimalSetting.class).get(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[] getBlockUnlockLevel() {
|
||||||
|
return blockUnlockLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getProPercent() {
|
||||||
|
return proPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getReturnCost() {
|
||||||
|
return returnCost;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue