无尽修改

lvxinran 2019-09-27 12:52:28 +08:00
parent f708a2f546
commit 8e87514b8f
2 changed files with 17 additions and 16 deletions

View File

@ -20,6 +20,6 @@ public class FamilyDefendDetailInfoHandler extends BaseHandler {
byte[] bytes = netData.parseClientProtoNetData();
Family.FamilyDefendDetailViewRequest request = Family.FamilyDefendDetailViewRequest.parseFrom(bytes);
GuildFightLogic.viewDefendDetailInfo(iSession,request.getPlayerId(), MessageTypeProto.MessageType.FAMILY_VIEW_DEFEND_DETAIL_RESPONSE);
GuildFightLogic.viewDefendDetailInfo(iSession,request.getPlayerId(),request.getGid(), MessageTypeProto.MessageType.FAMILY_VIEW_DEFEND_DETAIL_RESPONSE);
}
}

View File

@ -95,11 +95,9 @@ public class GuildFightLogic {
* @throws Exception
*/
public static void viewDefendDetailInfo(ISession session, int uid, MessageTypeProto.MessageType messageType) throws Exception {
User user = UserManager.getUser(uid);
int guildId = user.getPlayerInfoManager().getGuildId();
FamilyFightInfo fightInfo = RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_FIGHT, String.valueOf(guildId), String.valueOf(uid), FamilyFightInfo.class);
TeamPosManager teamPosManager = user.getTeamPosManager();
public static void viewDefendDetailInfo(ISession session, int uid,int gid ,MessageTypeProto.MessageType messageType) throws Exception {
FamilyFightInfo fightInfo = RedisUtil.getInstence().getMapEntry(RedisKey.FAMILY_FIGHT, String.valueOf(gid), String.valueOf(uid), FamilyFightInfo.class);
CommonProto.Team.Builder team = CommonProto.Team.newBuilder();
CommonProto.TeamOneTeamInfo.Builder oneInfo = CommonProto.TeamOneTeamInfo.newBuilder();
if(fightInfo!=null){
@ -113,7 +111,10 @@ public class GuildFightLogic {
oneInfo.addRemainHp(remainHp);
}
}
oneInfo.setTotalForce(fightInfo.getForce());
}else{
User user = UserManager.getUser(uid);
TeamPosManager teamPosManager = user.getTeamPosManager();
List<TeamPosHeroInfo> teamPosHeroInfos = teamPosManager.getTeamPosForHero().get(501);
if(teamPosHeroInfos==null){
teamPosHeroInfos = teamPosManager.getTeamPosForHero().get(1);
@ -121,18 +122,18 @@ public class GuildFightLogic {
for(TeamPosHeroInfo heroInfo:teamPosHeroInfos){
team.addHeroTid(user.getHeroManager().getHero(heroInfo.getHeroId()).getTemplateId());
}
}
oneInfo.setTeam(team);
int force = HeroLogic.getInstance().calTeamTotalForce(user, 501, false);
if(force==0){
force = HeroLogic.getInstance().calTeamTotalForce(user, 1, false);
}
oneInfo.setTotalForce(force);
if (teamPosManager.getTeamPosForPoken().get(1) != null && teamPosManager.getTeamPosForPoken().get(1).size() > 0) {
for (TeamPosForPokenInfo posForPokenInfo : teamPosManager.getTeamPosForPoken().get(1)) {
oneInfo.addPokemonInfos(posForPokenInfo.getPokenId());
int force = HeroLogic.getInstance().calTeamTotalForce(user, 501, false);
if(force==0){
force = HeroLogic.getInstance().calTeamTotalForce(user, 1, false);
}
oneInfo.setTotalForce(force);
if (teamPosManager.getTeamPosForPoken().get(1) != null && teamPosManager.getTeamPosForPoken().get(1).size() > 0) {
for (TeamPosForPokenInfo posForPokenInfo : teamPosManager.getTeamPosForPoken().get(1)) {
oneInfo.addPokemonInfos(posForPokenInfo.getPokenId());
}
}
}
oneInfo.setTeam(team);
Family.FamilyDefendDetailViewResponse.Builder response = Family.FamilyDefendDetailViewResponse.newBuilder();
response.setTeamInfo(oneInfo);
MessageUtil.sendMessage(session, 1, messageType.getNumber(), response.build(), true);