back_recharge
jiahuiwen 2019-03-01 13:40:27 +08:00
commit b06e783754
17 changed files with 165 additions and 98 deletions

View File

@ -88,7 +88,7 @@ public class LjsdMongoTemplate {
BasicDBObject update= new BasicDBObject().append("$inc",new BasicDBObject().append(key, 1)); BasicDBObject update= new BasicDBObject().append("$inc",new BasicDBObject().append(key, 1));
DBObject query = cursor.next(); DBObject query = cursor.next();
DBObject result = collection.findAndModify(query, update); DBObject result = collection.findAndModify(query, update);
return Integer.valueOf(result.get(key).toString())+1; return Integer.parseInt(result.get(key).toString())+1;
} else { } else {
searchQuery.put(key, 1); searchQuery.put(key, 1);
collection.insert(searchQuery); collection.insert(searchQuery);

View File

@ -23,7 +23,7 @@ public abstract class MongoRoot {
} }
public int _getIntId() { public int _getIntId() {
return Integer.valueOf(id); return Integer.parseInt(id);
} }
public void setId(String id) { public void setId(String id) {

View File

@ -9,7 +9,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
public class MongoUpdateCache { public class MongoUpdateCache {
class UpdateRequest { static class UpdateRequest {
MongoBase mongoBase; MongoBase mongoBase;
String fullKey; String fullKey;
Object value; Object value;

View File

@ -47,7 +47,7 @@ public class SCHero implements BaseConfig{
private Map<Integer, Map<Integer,SCHero.ConsumeMaterialInfo>> consumeMaterialInfoOfPositionByStar; private Map<Integer, Map<Integer,SCHero.ConsumeMaterialInfo>> consumeMaterialInfoOfPositionByStar;
public class ConsumeMaterialInfo{ public static class ConsumeMaterialInfo{
private int groupID; private int groupID;
private int nums; private int nums;

View File

@ -17,6 +17,8 @@ public class SWorkShopRebuildConfig implements BaseConfig {
private int[][] secondaryCost; private int[][] secondaryCost;
private int exp;
private static Map<Integer,SWorkShopRebuildConfig> sWorkShopRebuildConfigMap; private static Map<Integer,SWorkShopRebuildConfig> sWorkShopRebuildConfigMap;
@ -51,5 +53,7 @@ public class SWorkShopRebuildConfig implements BaseConfig {
return secondaryCost; return secondaryCost;
} }
public int getExp() {
return exp;
}
} }

View File

@ -2,6 +2,7 @@ package com.ljsd.jieling.config;
import com.ljsd.jieling.logic.STableManager; import com.ljsd.jieling.logic.STableManager;
import com.ljsd.jieling.logic.Table; import com.ljsd.jieling.logic.Table;
import com.ljsd.jieling.util.MathUtils;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -41,18 +42,17 @@ public class SWorkShopSetting implements BaseConfig {
Map<Integer,Integer> promoteMapTmp = new HashMap<>(); Map<Integer,Integer> promoteMapTmp = new HashMap<>();
int maxExpTmp = 0; int maxExpTmp = 0;
int maxCookExpTmp = 0; int maxCookExpTmp = 0;
int exp =0;
for(SWorkShopSetting sWorkShopSetting : sWorkShopSettingMapTmp.values()){ for(SWorkShopSetting sWorkShopSetting : sWorkShopSettingMapTmp.values()){
exp+=sWorkShopSetting.getExp(); Map<Integer,Integer> promoteMapTmptm = new HashMap<>(promoteMapTmp);
int[] promote = sWorkShopSetting.getPromote(); int[] promote = sWorkShopSetting.getPromote();
if(promote!=null&&promote.length>0){ if(promote!=null&&promote.length>0){
promoteMapTmp.put(promote[0],promote[1]); promoteMapTmp.put(promote[0],promote[1]);
sWorkShopSetting.setPromoteMap(promoteMapTmp); promoteMapTmptm.put(promote[0],promote[1]);
sWorkShopSetting.setPromoteMap(promoteMapTmptm);
} }
maxExpTmp+=sWorkShopSetting.getExp(); maxExpTmp = MathUtils.getMaxNum(maxExpTmp,sWorkShopSetting.getExp());
maxExpTmp+=sWorkShopSetting.getFoodExp(); maxCookExpTmp=MathUtils.getMaxNum(maxExpTmp,sWorkShopSetting.getFoodExp());
sWorkShopSetting.setExp(exp);
int[][] poolWeight = sWorkShopSetting.getPoolRate(); int[][] poolWeight = sWorkShopSetting.getPoolRate();
if(poolWeight!=null && poolWeight.length>0){ if(poolWeight!=null && poolWeight.length>0){
int totalWeight = 0; int totalWeight = 0;

View File

@ -716,6 +716,37 @@ public class RedisUtil {
} }
return -1; return -1;
} }
// ===============================set=================================
public boolean sadd(String key,String member){
try {
redisTemplate.opsForSet().add(key,member);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public boolean sremove(String key,String member){
try {
redisTemplate.opsForSet().remove(key,member);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public int getSetLength(String key){
try {
return redisTemplate.opsForSet().size(key).intValue();
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}

View File

@ -62,6 +62,8 @@ public class GMRequestHandler extends BaseHandler{
Mail mail = new Mail(uid,"GM","GM",prarm1+"#"+prarm2,nowTime,30*24*60*60,"GM", Global.MAIL_TYPE_GM); Mail mail = new Mail(uid,"GM","GM",prarm1+"#"+prarm2,nowTime,30*24*60*60,"GM", Global.MAIL_TYPE_GM);
cUser.getMailManager().addMail(mail); cUser.getMailManager().addMail(mail);
break; break;
default:
break;
} }
try { try {
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GM_RESPONSE_VALUE, null, true); MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GM_RESPONSE_VALUE, null, true);

View File

@ -89,27 +89,28 @@ public class STableManager {
LOGGER.error("file not find {}, do not find sheet with {} you need rebuild all sheet by gen sheet tool!", path, tableName); LOGGER.error("file not find {}, do not find sheet with {} you need rebuild all sheet by gen sheet tool!", path, tableName);
// return null; // return null;
} }
BufferedReader bufferedReader = new BufferedReader(new FileReader(file)); try(BufferedReader bufferedReader = new BufferedReader(new FileReader(file))){
LOGGER.info("initMap:{}", clazz.getSimpleName()); LOGGER.info("initMap:{}", clazz.getSimpleName());
while ((line = bufferedReader.readLine()) != null) { while ((line = bufferedReader.readLine()) != null) {
if (line.isEmpty()){ if (line.isEmpty()){
continue; continue;
}
T obj = clazz.newInstance();
String[] prarms = line.split("\\t");
switch (lineNum) {
case 0:
prarms = StringUtil.fieldHandle(prarms);
key.addAll(Arrays.asList(prarms));
break;
case 1:
type.addAll(Arrays.asList(prarms));
break;
default:
dealParams(clazz, map, key, type, obj, prarms);
break;
}
lineNum++;
} }
T obj = clazz.newInstance();
String[] prarms = line.split("\\t");
switch (lineNum) {
case 0:
prarms = StringUtil.fieldHandle(prarms);
key.addAll(Arrays.asList(prarms));
break;
case 1:
type.addAll(Arrays.asList(prarms));
break;
default:
dealParams(clazz, map, key, type, obj, prarms);
break;
}
lineNum++;
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -139,27 +140,28 @@ public class STableManager {
List<String> key = new ArrayList<>(); List<String> key = new ArrayList<>();
List<String> type = new ArrayList<>(); List<String> type = new ArrayList<>();
int lineNum = 0; int lineNum = 0;
BufferedReader bufferedReader = new BufferedReader(new FileReader(file)); try (BufferedReader bufferedReader = new BufferedReader(new FileReader(file))){
LOGGER.info("initMap:{}", tableName); LOGGER.info("initMap:{}", tableName);
while ((line = bufferedReader.readLine()) != null) { while ((line = bufferedReader.readLine()) != null) {
T obj = clazz.newInstance(); T obj = clazz.newInstance();
String[] prarms = line.split("\\t"); String[] prarms = line.split("\\t");
switch (lineNum) { switch (lineNum) {
case 0: case 0:
prarms = StringUtil.fieldHandle(prarms); prarms = StringUtil.fieldHandle(prarms);
key.addAll(Arrays.asList(prarms)); key.addAll(Arrays.asList(prarms));
break; break;
case 1: case 1:
type.addAll(Arrays.asList(prarms)); type.addAll(Arrays.asList(prarms));
break; break;
default: default:
dealParams(clazz, mapConf, key, type, obj, prarms); dealParams(clazz, mapConf, key, type, obj, prarms);
break; break;
}
lineNum++;
} }
lineNum++; map.put(i, mapConf);
tableName = tableName.substring(0, 3);
} }
map.put(i, mapConf);
tableName = tableName.substring(0, 3);
} }
return map; return map;
} }

View File

@ -1,6 +1,7 @@
package com.ljsd.jieling.logic.chat; package com.ljsd.jieling.logic.chat;
import com.ljsd.jieling.config.SGameSetting; import com.ljsd.jieling.config.SGameSetting;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.network.session.ISession; import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.ChatProto; import com.ljsd.jieling.protocols.ChatProto;
import com.ljsd.jieling.protocols.MessageTypeProto; import com.ljsd.jieling.protocols.MessageTypeProto;
@ -28,6 +29,7 @@ public class ChatLogic {
return; return;
} }
//移除自己所在的频道。 //移除自己所在的频道。
} }
public void sendChatInfo(ISession iSession, ChatProto.SendChatInfoRequest sendChatInfoRequest) { public void sendChatInfo(ISession iSession, ChatProto.SendChatInfoRequest sendChatInfoRequest) {

View File

@ -2,6 +2,7 @@ package com.ljsd.jieling.logic.dao;
import com.ljsd.common.mogodb.MongoBase; import com.ljsd.common.mogodb.MongoBase;
import com.ljsd.jieling.config.*; import com.ljsd.jieling.config.*;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.util.KeyGenUtils; import com.ljsd.jieling.util.KeyGenUtils;
import com.ljsd.jieling.util.MathUtils; import com.ljsd.jieling.util.MathUtils;
import com.ljsd.jieling.util.UUIDEnum; import com.ljsd.jieling.util.UUIDEnum;
@ -143,29 +144,46 @@ public class Equip extends MongoBase {
} }
public void rebuildEquip(int workShopLevle){ public void rebuildEquip(int workShopLevle){
SWorkShopSetting sWorkShopSetting = SWorkShopSetting.getsWorkShopSettingByLevel(workShopLevle);
if( null == sWorkShopSetting ){
return;
}
Map<Integer, Integer> promoteMap = sWorkShopSetting.getPromoteMap();
SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(this.equipId); SEquipConfig sEquipConfig = SEquipConfig.getsEquipConfigById(this.equipId);
int properTyId = sEquipConfig.getPropertyMin()[0]; int properTyId = sEquipConfig.getPropertyMin()[0];
Integer propertyPromote = promoteMap.get(properTyId); SWorkShopSetting sWorkShopSetting = SWorkShopSetting.getsWorkShopSettingByLevel(workShopLevle);
int properMinNum = sEquipConfig.getPropertyMin()[1]; Map<Integer, Integer> promoteMap = null;
int properMaxNum = sEquipConfig.getPropertyMax()[1]; SPropertyConfig sPropertyConfigFirst = SPropertyConfig.getsPropertyConfigByPID(properTyId);
int finalProperValue = MathUtils.random(properMinNum * (100 + propertyPromote) / 100, properMaxNum* (100 + propertyPromote) / 100); if(sPropertyConfigFirst != null && sPropertyConfigFirst.getStyle() == GlobalsDef.ABSOLUTE_TYPE){
this.propertyValueByIdMap.put(properTyId,finalProperValue); Integer propertyPromote = null;
if( sWorkShopSetting !=null ){
promoteMap = sWorkShopSetting.getPromoteMap();
if(promoteMap!=null){
propertyPromote = promoteMap.get(properTyId);
}
}
if(propertyPromote==null){
propertyPromote =0;
}
int properMinNum = sEquipConfig.getPropertyMin()[1];
int properMaxNum = sEquipConfig.getPropertyMax()[1];
int finalProperValue = MathUtils.random(properMinNum * (100 + propertyPromote) / 100, properMaxNum* (100 + propertyPromote) / 100);
this.propertyValueByIdMap.put(properTyId,finalProperValue);
}
List<SEquipPropertyPool> sEquipPropertyPoolList = SEquipPropertyPool.getSEquipPropertyPool(sEquipConfig.getPool()); List<SEquipPropertyPool> sEquipPropertyPoolList = SEquipPropertyPool.getSEquipPropertyPool(sEquipConfig.getPool());
for(SEquipPropertyPool sEquipPropertyPool : sEquipPropertyPoolList){ for(SEquipPropertyPool sEquipPropertyPool : sEquipPropertyPoolList){
Integer secondPropertyId = secondValueByIdMap.get(sEquipPropertyPool.getId()); int secondPropertyId = sEquipPropertyPool.getPropertyId();
if(secondPropertyId == null ){ if(!secondValueByIdMap.containsKey(secondPropertyId)){
continue; continue;
} }
Integer secondPropertyPromote = promoteMap.get(secondPropertyId); SPropertyConfig sPropertyConfig = SPropertyConfig.getsPropertyConfigByPID(secondPropertyId);
if(sPropertyConfig == null || sPropertyConfig.getStyle() != GlobalsDef.ABSOLUTE_TYPE){
continue;
}
Integer secondPropertyPromote =null;
if(promoteMap!=null){
secondPropertyPromote = promoteMap.get(secondPropertyId);
}
if(secondPropertyPromote == null){ if(secondPropertyPromote == null){
continue; secondPropertyPromote =0;
} }
int value = MathUtils.random(sEquipPropertyPool.getMin() * (100 + secondPropertyPromote) / 100, sEquipPropertyPool.getMax()* (100 + secondPropertyPromote) / 100); int value = MathUtils.random(sEquipPropertyPool.getMin() * (100 + secondPropertyPromote) / 100, sEquipPropertyPool.getMax()* (100 + secondPropertyPromote) / 100);
secondValueByIdMap.put(secondPropertyId,value); secondValueByIdMap.put(secondPropertyId,value);
} }

View File

@ -24,11 +24,11 @@ public class WorkShopController extends MongoBase {
} }
public void add(int type,int openId) throws Exception { public void add(int type,int openId) throws Exception {
if(openBlueStateMap.containsKey(type)){ if(!openBlueStateMap.containsKey(type)){
openBlueStateMap.put(type,new ArrayList<>()); openBlueStateMap.put(type,new ArrayList<>());
} }
openBlueStateMap.get(type).add(openId); openBlueStateMap.get(type).add(openId);
updateString("openBlueStateMap." + type,1); updateString("openBlueStateMap." + type, openBlueStateMap.get(type));
} }
public void addWorkShopExp(int addExp) throws Exception { public void addWorkShopExp(int addExp) throws Exception {

View File

@ -193,8 +193,9 @@ public class HeroLogic {
Map<Integer, List<TeamPosHeroInfo>> teamPosForHero = teamPosManager.getTeamPosForHero(); Map<Integer, List<TeamPosHeroInfo>> teamPosForHero = teamPosManager.getTeamPosForHero();
Map<Integer, String> teamNames = teamPosManager.getTeamNames(); Map<Integer, String> teamNames = teamPosManager.getTeamNames();
Map<Integer, List<TeamPosForPokenInfo>> teamPosForPoken = teamPosManager.getTeamPosForPoken(); Map<Integer, List<TeamPosForPokenInfo>> teamPosForPoken = teamPosManager.getTeamPosForPoken();
for(Integer teamId:teamPosForHero.keySet()){ for(Map.Entry<Integer, List<TeamPosHeroInfo>> item :teamPosForHero.entrySet()){
List<TeamPosHeroInfo> teamPosHeroInfoList = teamPosForHero.get(teamId); int teamId = item.getKey();
List<TeamPosHeroInfo> teamPosHeroInfoList = item.getValue();
List<TeamPosForPokenInfo> teamPosForPokenInfos = teamPosForPoken.get(teamId); List<TeamPosForPokenInfo> teamPosForPokenInfos = teamPosForPoken.get(teamId);
if(null == teamPosForPokenInfos){ if(null == teamPosForPokenInfos){
teamPosForPokenInfos = new ArrayList<>(1); teamPosForPokenInfos = new ArrayList<>(1);
@ -245,17 +246,6 @@ public class HeroLogic {
} }
Set<String> cacheHeroIds = new HashSet<>(); Set<String> cacheHeroIds = new HashSet<>();
Set<String> alreadyHeroIds = new HashSet<>();
Map<Integer, List<TeamPosHeroInfo>> teamPosForHero = user.getTeamPosManager().getTeamPosForHero();
for(Integer teamIdTmp : teamPosForHero.keySet()){
if(teamIdTmp == teamId){
continue;
}
List<TeamPosHeroInfo> teamPosHeroInfoList = teamPosForHero.get(teamIdTmp);
for(TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfoList){
alreadyHeroIds.add(teamPosHeroInfo.getHeroId());
}
}
for(CommonProto.TeamHeroInfo teamHeroInfo: heroIds){ for(CommonProto.TeamHeroInfo teamHeroInfo: heroIds){
String heroId = teamHeroInfo.getHeroId(); String heroId = teamHeroInfo.getHeroId();
if(user.getHeroManager().getHero(heroId) == null) { if(user.getHeroManager().getHero(heroId) == null) {
@ -266,9 +256,6 @@ public class HeroLogic {
if(cacheHeroIds.contains(heroId)){ if(cacheHeroIds.contains(heroId)){
return "card repeated"; return "card repeated";
} }
if(alreadyHeroIds.contains(heroId)){
return "card repeated";
}
cacheHeroIds.add(heroId); cacheHeroIds.add(heroId);
} }
@ -580,6 +567,8 @@ public class HeroLogic {
case GlobalsDef.SPEED_TYPE: case GlobalsDef.SPEED_TYPE:
result = scHero.getSpeed(); result = scHero.getSpeed();
break; break;
default:
break;
} }
return result; return result;

View File

@ -114,10 +114,13 @@ public class WorkShopLogic {
} }
private void times2Array(int [][] array,int times){ private int[][] times2Array(int [][] array,int times){
for(int[] a :array){ int[][] result = new int[array.length][];
a[1] =a[1]*times; for(int i=0;i<array.length;i++){
int value = array[i][1] * times;
result[i] = new int[]{array[i][0],value};
} }
return result;
} }
private boolean checkIsUnlock(int optType,int type,WorkShopController workShopController,int[] openRules){ private boolean checkIsUnlock(int optType,int type,WorkShopController workShopController,int[] openRules){
@ -216,12 +219,13 @@ public class WorkShopLogic {
User user = UserManager.getUser(uid); User user = UserManager.getUser(uid);
SWorkShopFoundationConfig sWorkShopFoundationConfig = SWorkShopFoundationConfig.getShopFoundationConfigMap().get(materialId); SWorkShopFoundationConfig sWorkShopFoundationConfig = SWorkShopFoundationConfig.getShopFoundationConfigMap().get(materialId);
if(!checkIsUnlock(GlobalsDef.WORK_BASE_TYPE,sWorkShopFoundationConfig.getType(),user.getWorkShopController(),sWorkShopFoundationConfig.getOpenRules())){ if(!checkIsUnlock(GlobalsDef.WORK_BASE_TYPE,sWorkShopFoundationConfig.getType(),user.getWorkShopController(),sWorkShopFoundationConfig.getOpenRules())){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.WORKSHOP_FOUNDATION_RESPONSE_VALUE,"未开"); // MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.WORKSHOP_FOUNDATION_RESPONSE_VALUE,"未开");
return; // return;
LOGGER.error("不匹配");
} }
int[][] cost = sWorkShopFoundationConfig.getCost(); int[][] cost = sWorkShopFoundationConfig.getCost();
times2Array(cost,nums); int[][] reallyCost = times2Array(cost, nums);
if( !ItemUtil.itemCost(user, cost)){ if( !ItemUtil.itemCost(user, reallyCost)){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.WORKSHOP_FOUNDATION_RESPONSE_VALUE,"道具不足"); MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.WORKSHOP_FOUNDATION_RESPONSE_VALUE,"道具不足");
return; return;
} }
@ -247,8 +251,9 @@ public class WorkShopLogic {
User user = UserManager.getUser(uid); User user = UserManager.getUser(uid);
SWorkShopEquipmentConfig sWorkShopEquipmentConfig = SWorkShopEquipmentConfig.getsWorkShopEquipmentConfigMap().get(equipTid); SWorkShopEquipmentConfig sWorkShopEquipmentConfig = SWorkShopEquipmentConfig.getsWorkShopEquipmentConfigMap().get(equipTid);
if(!checkIsUnlock(GlobalsDef.WORK_CREATE_TYPE,sWorkShopEquipmentConfig.getType(),user.getWorkShopController(),sWorkShopEquipmentConfig.getOpenRules())){ if(!checkIsUnlock(GlobalsDef.WORK_CREATE_TYPE,sWorkShopEquipmentConfig.getType(),user.getWorkShopController(),sWorkShopEquipmentConfig.getOpenRules())){
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.WORKSHOP_FOUNDATION_RESPONSE_VALUE,"未开"); // MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.WORKSHOP_FOUNDATION_RESPONSE_VALUE,"未开");
return; // return;
LOGGER.error("不匹配");
} }
int runesNum = sWorkShopEquipmentConfig.getRunesNum(); int runesNum = sWorkShopEquipmentConfig.getRunesNum();
int[][] specialRunes = sWorkShopEquipmentConfig.getSpecialRunes(); int[][] specialRunes = sWorkShopEquipmentConfig.getSpecialRunes();
@ -318,7 +323,9 @@ public class WorkShopLogic {
MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.WORKSHOP_REBUILD_RESPONSE_VALUE,err); MessageUtil.sendErrorResponse(session,0,MessageTypeProto.MessageType.WORKSHOP_REBUILD_RESPONSE_VALUE,err);
return; return;
} }
SWorkShopRebuildConfig sWorkShopRebuildConfig = SWorkShopRebuildConfig.getsWorkShopRebuildConfigByQulity(sEquipConfig.getQuality());
int addExp = sWorkShopRebuildConfig.getExp();
user.getWorkShopController().addWorkShopExp(addExp);
equip.rebuildEquip(user.getWorkShopController().getWorkShopLevel()); equip.rebuildEquip(user.getWorkShopController().getWorkShopLevel());
equipManager.addEquip(equip); equipManager.addEquip(equip);
PlayerInfoProto.WorkShopRebuildRespoonse build = PlayerInfoProto.WorkShopRebuildRespoonse.newBuilder().setEquip(CBean2Proto.getEquipProto(equip)).build(); PlayerInfoProto.WorkShopRebuildRespoonse build = PlayerInfoProto.WorkShopRebuildRespoonse.newBuilder().setEquip(CBean2Proto.getEquipProto(equip)).build();

View File

@ -56,8 +56,10 @@ public class RedisRecordSendThread extends Thread{
} }
map.get(topic).add(new DefaultTypedTuple<String>(itemInfo,(double)increment)); map.get(topic).add(new DefaultTypedTuple<String>(itemInfo,(double)increment));
} }
for(String topic : map.keySet()){ for(Map.Entry<String,Set<ZSetOperations.TypedTuple<String>>> item : map.entrySet()){
RedisUtil.getInstence().zsetAddAall(topic,map.get(topic)); String topic = item.getKey();
Set<ZSetOperations.TypedTuple<String>> value = item.getValue();
RedisUtil.getInstence().zsetAddAall(topic,value);
} }
}catch (Exception e){ }catch (Exception e){

View File

@ -94,8 +94,10 @@ public class CBean2Proto {
private static List<CommonProto.SpecialEffects> parseFromMap(Map<Integer,Integer> propertyValueByIdMap){ private static List<CommonProto.SpecialEffects> parseFromMap(Map<Integer,Integer> propertyValueByIdMap){
List<CommonProto.SpecialEffects> result = new ArrayList<>(); List<CommonProto.SpecialEffects> result = new ArrayList<>();
for(Integer propertyId:propertyValueByIdMap.keySet()){ for(Map.Entry<Integer,Integer> item:propertyValueByIdMap.entrySet()){
result.add(CommonProto.SpecialEffects.newBuilder().setPropertyId(propertyId).setPropertyValue(propertyValueByIdMap.get(propertyId)).build()); Integer propertyId = item.getKey();
Integer propertyValue = item.getValue();
result.add(CommonProto.SpecialEffects.newBuilder().setPropertyId(propertyId).setPropertyValue(propertyValue).build());
} }
return result; return result;
} }
@ -104,8 +106,10 @@ public class CBean2Proto {
public static CommonProto.PokemonInfo getPokemon(Pokemon pokemon) { public static CommonProto.PokemonInfo getPokemon(Pokemon pokemon) {
Map<Integer, Integer> comonpentsLevelMap = pokemon.getComonpentsLevelMap(); Map<Integer, Integer> comonpentsLevelMap = pokemon.getComonpentsLevelMap();
List<CommonProto.Pokemoncomonpent> pokemoncomonpentList = new ArrayList<>(); List<CommonProto.Pokemoncomonpent> pokemoncomonpentList = new ArrayList<>();
for(Integer comonpentId : comonpentsLevelMap.keySet()){ for( Map.Entry <Integer, Integer> item: comonpentsLevelMap.entrySet()){
pokemoncomonpentList.add(CommonProto.Pokemoncomonpent.newBuilder().setId(comonpentId).setLevel(comonpentsLevelMap.get(comonpentId)).build()); Integer comonpentId = item.getKey();
Integer value = item.getValue();
pokemoncomonpentList.add(CommonProto.Pokemoncomonpent.newBuilder().setId(comonpentId).setLevel(value).build());
} }
return CommonProto.PokemonInfo.newBuilder() return CommonProto.PokemonInfo.newBuilder()
.setId(pokemon.getId()) .setId(pokemon.getId())

View File

@ -112,4 +112,10 @@ public class MathUtils {
return original; return original;
} }
public static int getMaxNum(int a, int b) {
if(a>=b){
return a;
}
return b;
}
} }