robot hero info

back_recharge
wangyuan 2019-11-07 12:04:29 +08:00
parent 255c9277ce
commit 2c21b1e9c4
2 changed files with 74 additions and 5 deletions

View File

@ -2,6 +2,7 @@ package com.ljsd.jieling.logic.player;
import com.ljsd.GameApplication;
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
import com.ljsd.jieling.config.clazzStaticCfg.SArenaRobotStaticConfig;
import com.ljsd.jieling.config.clazzStaticCfg.TaskStaticConfig;
import com.ljsd.jieling.core.VipPrivilegeType;
import com.ljsd.jieling.dataReport.reportBeans_37.ChatContentType;
@ -437,14 +438,47 @@ public class PlayerLogic {
}
}
public void getRobotTeamInfo(ISession session, SArenaRobotConfig sArenaRobotConfig, MessageTypeProto.MessageType messageType){
CommonProto.TeamOneInfo.Builder oneInfo = CommonProto.TeamOneInfo.newBuilder()
.setLevel(sArenaRobotConfig.getRobotLevel())
.setName(sArenaRobotConfig.getRobotName())
.setUid(sArenaRobotConfig.getId());
CommonProto.TeamOneTeamInfo.Builder teamInfo = CommonProto.TeamOneTeamInfo.newBuilder();
if(sArenaRobotConfig.getDifferDemonsId()!=null){
for(int pokenId:sArenaRobotConfig.getDifferDemonsId()){
teamInfo.addPokemonInfos(pokenId);
}
}
teamInfo.setTotalForce(sArenaRobotConfig.getTotalForce());
for(Map.Entry<Integer,Integer> item : sArenaRobotConfig.getStarOfHeroMap().entrySet()){
Integer heroTid = item.getKey();
Integer heroStar = item.getValue();
teamInfo.addTeam(CommonProto.TeamSimpleInfo.newBuilder().setHeroid(String.valueOf(heroTid)).setHeroTid(heroTid).setLevel(sArenaRobotConfig.getRobotLevel()).setStar(heroStar).build());
}
oneInfo.setTeam(teamInfo);
PlayerInfoProto.GetPlayerOneTeamInfoResponse.Builder playerTeamInfo = PlayerInfoProto.GetPlayerOneTeamInfoResponse.newBuilder().setTeamInfo(oneInfo);
MessageUtil.sendMessage(session,1,messageType.getNumber(),playerTeamInfo.build(),true);
}
public void getOneTeamInfo(ISession session, int id,int teamId,MessageTypeProto.MessageType messageType) throws Exception {
SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(id);
if(sArenaRobotConfig!=null){
getRobotTeamInfo(session,sArenaRobotConfig,messageType);
return;
}
User user = UserManager.getUser(id);
PlayerManager playerManager = user.getPlayerInfoManager();
CommonProto.TeamOneInfo.Builder oneInfo = CommonProto.TeamOneInfo.newBuilder()
.setHead(playerManager.getHead())
.setHeadFrame(playerManager.getHeadFrame())
.setLevel(playerManager.getLevel())
.setName(playerManager.getNickName()).setUid(session.getUid());
.setName(playerManager.getNickName()).setUid(id);
TeamPosManager teamPosManager = user.getTeamPosManager();
CommonProto.TeamOneTeamInfo.Builder teamInfo = CommonProto.TeamOneTeamInfo.newBuilder();
teamInfo.setTotalForce(HeroLogic.getInstance().calTeamTotalForce(user,teamId,false));
@ -477,11 +511,37 @@ public class PlayerLogic {
}
private void viewRobotHeroInfo(ISession session, SArenaRobotConfig sArenaRobotConfig,String robotHeroId) throws Exception {
PlayerInfoProto.ViewHeroInfoResponse.Builder builder = PlayerInfoProto.ViewHeroInfoResponse.newBuilder();
int[] differDemonsId = sArenaRobotConfig.getDifferDemonsId();
int differDemonsLv = sArenaRobotConfig.getDifferDemonsLv();
int heroLevel = sArenaRobotConfig.getRoleLv();
int heroBreakId = sArenaRobotConfig.getBreakId();
SCHero scHero = SCHero.getsCHero().get(Integer.parseInt(robotHeroId));
Map<Integer, Integer> robotHeroAttribute = HeroLogic.getInstance().calRobotHeroAttribute(scHero, heroLevel, heroBreakId, differDemonsId, differDemonsLv,true);
for(Map.Entry<Integer,Integer> item : robotHeroAttribute.entrySet()){
builder.addSpecialEffects(CommonProto.SpecialEffects.newBuilder().setPropertyId(item.getKey()).setPropertyValue(item.getValue()).build());
}
builder.setForce(HeroLogic.getInstance().calForce(robotHeroAttribute));
builder.setHero(CBean2Proto.getRobotHero(scHero,sArenaRobotConfig));
int resMsgId = MessageTypeProto.MessageType.VIEW_HERO_INFO_RESPONSE_VALUE;
MessageUtil.sendMessage(session,1,resMsgId,builder.build(),true);
}
public void viewHeroInfo(ISession session,int uid,String heroId) throws Exception {
SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(uid);
if(sArenaRobotConfig!=null){
viewRobotHeroInfo(session,sArenaRobotConfig,heroId);
return;
}
User userInMem = UserManager.getUserInMem(uid);
int resMsgId = MessageTypeProto.MessageType.VIEW_HERO_INFO_RESPONSE_VALUE;
if(userInMem == null){
throw new ErrorCodeException(ErrorCode.UNLOCK_SKIP_FIGHT);
throw new ErrorCodeException(ErrorCode.FRIENDS_USER_NULL);
}
Hero hero = userInMem.getHeroManager().getHeroMap().get(heroId);
if(hero == null){

View File

@ -15,9 +15,7 @@ import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.fight.CombatLogic;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.protocols.*;
import config.SMainLevelConfig;
import config.SMonsterConfig;
import config.SSpecialConfig;
import config.*;
import manager.STableManager;
import util.StringUtil;
import util.TimeUtils;
@ -107,6 +105,17 @@ public class CBean2Proto {
.build();
}
public static CommonProto.Hero getRobotHero(SCHero scHero, SArenaRobotConfig sArenaRobotConfig) throws Exception {
return CommonProto.Hero
.newBuilder()
.setId(String.valueOf(scHero.getId()))
.setHeroId(scHero.getId())
.setLevel(sArenaRobotConfig.getRoleLv())
.setStar(scHero.getStar())
.setBreakId(sArenaRobotConfig.getBreakId())
.build();
}
public static CommonProto.Mail getMail(Mail mail){
CommonProto.Mail.Builder mailProto = CommonProto.Mail
.newBuilder()