view team info

back_recharge
wangyuan 2019-09-16 15:51:27 +08:00
parent d5c1d89021
commit c64bf6eee6
2 changed files with 8 additions and 10 deletions

View File

@ -9,16 +9,14 @@ import com.ljsd.jieling.protocols.PlayerInfoProto;
import org.springframework.stereotype.Component;
@Component
public class GetPlayerOneTeamInfo extends BaseHandler {
public class GetPlayerOneTeamInfo extends BaseHandler<PlayerInfoProto.GetPlayerOneTeamInfoRequest> {
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.GET_PLAYER_ONE_TEAM_INFO_REQUEST;
}
@Override
public void process(ISession iSession, PacketNetData netData) throws Exception {
byte[] bytes = netData.parseClientProtoNetData();
PlayerInfoProto.GetPlayerOneTeamInfoRequest info = PlayerInfoProto.GetPlayerOneTeamInfoRequest.parseFrom(bytes);
PlayerLogic.getInstance().getOneTeamInfo(iSession, info.getPlayerId(), MessageTypeProto.MessageType.GET_PLAYER_ONE_TEAM_INFO_RESPONSE);
public void processWithProto(ISession iSession, PlayerInfoProto.GetPlayerOneTeamInfoRequest proto) throws Exception {
PlayerLogic.getInstance().getOneTeamInfo(iSession, proto.getPlayerId(),proto.getTeamId(), MessageTypeProto.MessageType.GET_PLAYER_ONE_TEAM_INFO_RESPONSE);
}
}

View File

@ -430,12 +430,12 @@ public class PlayerLogic {
}
}
public void getOneTeamInfo(ISession session, int id,MessageTypeProto.MessageType messageType) throws Exception {
public void getOneTeamInfo(ISession session, int id,int teamId,MessageTypeProto.MessageType messageType) throws Exception {
User user = UserManager.getUser(id);
PlayerManager playerManager = user.getPlayerInfoManager();
CommonProto.Team.Builder team = CommonProto.Team.newBuilder();
TeamPosManager teamPosManager = user.getTeamPosManager();
for (TeamPosHeroInfo heroInfo:teamPosManager.getTeamPosForHero().get(1)) {
for (TeamPosHeroInfo heroInfo:teamPosManager.getTeamPosForHero().get(teamId)) {
int templateId = user.getHeroManager().getHero(heroInfo.getHeroId()).getTemplateId();
team.addHeroTid(templateId);
}
@ -445,9 +445,9 @@ public class PlayerLogic {
.setName(playerManager.getNickName()).setUid(session.getUid());
CommonProto.TeamOneTeamInfo.Builder teamInfo = CommonProto.TeamOneTeamInfo.newBuilder();
teamInfo.setTeam(team);
teamInfo.setTotalForce(HeroLogic.getInstance().calTeamTotalForce(user,1,false));
if(teamPosManager.getTeamPosForPoken().get(1)!=null&&teamPosManager.getTeamPosForPoken().get(1).size()>0){
for(TeamPosForPokenInfo posForPokenInfo:teamPosManager.getTeamPosForPoken().get(1)){
teamInfo.setTotalForce(HeroLogic.getInstance().calTeamTotalForce(user,teamId,false));
if(teamPosManager.getTeamPosForPoken().get(teamId)!=null&&teamPosManager.getTeamPosForPoken().get(teamId).size()>0){
for(TeamPosForPokenInfo posForPokenInfo:teamPosManager.getTeamPosForPoken().get(teamId)){
teamInfo.addPokemonInfos(posForPokenInfo.getPokenId());
}
}