暂时修改
parent
39bc93bbca
commit
356f652cd1
|
@ -45,10 +45,9 @@ public class CrossServiceLogic {
|
||||||
return core.findOne(query, CoreOfServerInfo.class).getName();
|
return core.findOne(query, CoreOfServerInfo.class).getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void insert(User user) throws UnknownHostException {
|
public void insert(ArenaOfUser arenaOfUser) throws UnknownHostException {
|
||||||
// ArenaOfUser arenaOfUser = new ArenaOfUser(user);
|
MongoTemplate core = MongoUtil.getCoreMongoTemplate();
|
||||||
// MongoTemplate core = MongoUtil.getCoreMongoTemplate();
|
core.insert(arenaOfUser,"arenaOfUser");
|
||||||
// core.insert(arenaOfUser,"arenaOfUser");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(ArenaOfUser arenaOfUser) throws Exception {
|
public void update(ArenaOfUser arenaOfUser) throws Exception {
|
||||||
|
@ -91,17 +90,12 @@ public class CrossServiceLogic {
|
||||||
public void dispose(User user) throws Exception{
|
public void dispose(User user) throws Exception{
|
||||||
|
|
||||||
ArenaOfUser query = query(user.getId());
|
ArenaOfUser query = query(user.getId());
|
||||||
|
ArenaOfUser arenaOfUser = buildArenaOfUser(user);
|
||||||
|
countForce(arenaOfUser);
|
||||||
// 添加
|
// 添加
|
||||||
if (query == null){
|
if (query == null){
|
||||||
insert(user);
|
insert(arenaOfUser);
|
||||||
}
|
} else {
|
||||||
// 更新
|
|
||||||
else {
|
|
||||||
// 获取新的跨服用户信息
|
|
||||||
ArenaOfUser arenaOfUser = buildArenaOfUser(user);
|
|
||||||
// 计算战力
|
|
||||||
countForce(arenaOfUser);
|
|
||||||
// 更新数据
|
|
||||||
update(arenaOfUser);
|
update(arenaOfUser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -596,8 +596,8 @@ public class FightUtil {
|
||||||
return CommonProto.FightTeamInfo.
|
return CommonProto.FightTeamInfo.
|
||||||
newBuilder()
|
newBuilder()
|
||||||
.addAllFightUnitList(heroFightInfos)
|
.addAllFightUnitList(heroFightInfos)
|
||||||
.addAllPokemonUnitList(HeroLogic.getInstance().getPokemonSkills(user))
|
.addAllPokemonUnitList(HeroLogic.getInstance().getCrossPokemonSkills(arenaOfUser))
|
||||||
.setTeamPassiveList(HeroLogic.getInstance().getPokenmonPassiveSkills(user,teamId))
|
.setTeamPassiveList("")
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1768,6 +1768,31 @@ public class HeroLogic{
|
||||||
return pokemonInfos;
|
return pokemonInfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<CommonProto.FightUnitInfo> getCrossPokemonSkills(ArenaOfUser user){
|
||||||
|
//todo 灵兽
|
||||||
|
Map<String, Pokemon> pokemons = user.getPokemons();
|
||||||
|
List<CommonProto.FightUnitInfo> pokemonInfos = new ArrayList<>();
|
||||||
|
int
|
||||||
|
for(Map.Entry<String,Pokemon> entry:pokemons.entrySet()){
|
||||||
|
Pokemon pokemon = entry.getValue();
|
||||||
|
|
||||||
|
if(pokemon==null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
SSpiritAnimalSkill sSpiritAnimalSkill = SSpiritAnimalSkill.skillByAnimalAndStar.get(pokemon.getTmpId()).get(pokemon.getStar());
|
||||||
|
Map<Integer, Integer> map = calOnePokemonAttribute(pokemon.getTmpId(),pokemon.getStar(),pokemon.getLevel());
|
||||||
|
StringBuilder propertyBuilder = getOnePokemonProperty(map,pokemon.getLevel());
|
||||||
|
CommonProto.FightUnitInfo info = CommonProto.FightUnitInfo.newBuilder()
|
||||||
|
.setPosition(entry.getKey())
|
||||||
|
.setStar(pokemon.getStar())
|
||||||
|
.setProperty(propertyBuilder.toString())
|
||||||
|
.setUnitId(String.valueOf(pokemon.getTmpId())).setUnitSkillIds(String.valueOf(sSpiritAnimalSkill.getId())).build();
|
||||||
|
pokemonInfos.add(info);
|
||||||
|
}
|
||||||
|
return pokemonInfos;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getPokenmonPassiveSkills(User user,int teamId){
|
public String getPokenmonPassiveSkills(User user,int teamId){
|
||||||
//todo 灵兽 目前用不到
|
//todo 灵兽 目前用不到
|
||||||
// Map<Integer, Pokemon> pokemonMap = user.getPokemonManager().getPokemonMap();
|
// Map<Integer, Pokemon> pokemonMap = user.getPokemonManager().getPokemonMap();
|
||||||
|
|
Loading…
Reference in New Issue