diff --git a/serverlogic/src/main/java/com/ljsd/jieling/logic/family/GuildLogic.java b/serverlogic/src/main/java/com/ljsd/jieling/logic/family/GuildLogic.java index 7bd42f36e..4b3ddbbbd 100644 --- a/serverlogic/src/main/java/com/ljsd/jieling/logic/family/GuildLogic.java +++ b/serverlogic/src/main/java/com/ljsd/jieling/logic/family/GuildLogic.java @@ -16,6 +16,7 @@ import com.ljsd.jieling.logic.dao.root.GuildApply; import com.ljsd.jieling.logic.dao.root.GuildInfo; import com.ljsd.jieling.logic.dao.root.GuildLog; import com.ljsd.jieling.logic.dao.root.User; +import com.ljsd.jieling.logic.hero.HeroLogic; import com.ljsd.jieling.network.session.ISession; import com.ljsd.jieling.protocols.CommonProto; import com.ljsd.jieling.protocols.Family; @@ -88,6 +89,7 @@ public class GuildLogic { .setFamilyBaseInfo(CBean2Proto.getFamilyBaseInfo(guildInfo)) .setFamilyUserInfo(CBean2Proto.getFamilyUserInfo(user,GlobalsDef.CHAIRMAN)).build(); MessageUtil.sendMessage(session,1,msgId,build,true); + familyFightMatching(); } @@ -425,6 +427,10 @@ public class GuildLogic { MessageUtil.sendErrorResponse(session,0,msgId,"该人已被踢出"); return; } + //如果有防守信息则删除 + if(guildInfo.getDefendInfo().containsKey((targetUid))){ + guildInfo.removeDefendInfo(targetUid); + } User targetUser = UserManager.getUser(targetUid); targetUser.getPlayerInfoManager().setGuildId(0); addGuildLog(guildInfo.getId(),GuildDef.Log.KICK,targetUser.getPlayerInfoManager().getNickName()); @@ -724,9 +730,10 @@ public class GuildLogic { Family.FamilyDefendViewResponse.Builder response = Family.FamilyDefendViewResponse.newBuilder(); for(Map.Entry entry:defendInfo.entrySet()){ Family.FamilyDefendInfo.Builder defend = Family.FamilyDefendInfo.newBuilder(); - defend.setStarCount(5); + defend.setStarCount(entry.getValue()%1000); defend.setUid(entry.getKey()); - defend.setBuildId(entry.getValue()); + defend.setBuildId(entry.getValue()/1000); + defend.setCurForce(HeroLogic.getInstance().calTeamTotalForce(UserManager.getUser(entry.getKey()),501,false)); response.addInfo(defend); } MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true); @@ -750,6 +757,7 @@ public class GuildLogic { } CommonProto.TeamOneTeamInfo.Builder oneInfo = CommonProto.TeamOneTeamInfo.newBuilder() .setTeam(team); + oneInfo.setTotalForce(HeroLogic.getInstance().calTeamTotalForce(user,501,false)); if(teamPosManager.getTeamPosForPoken().get(1)!=null&&teamPosManager.getTeamPosForPoken().get(1).size()>0){ for(TeamPosForPokenInfo posForPokenInfo:teamPosManager.getTeamPosForPoken().get(1)){ oneInfo.addPokemonInfos(posForPokenInfo.getPokenId()); @@ -772,12 +780,13 @@ public class GuildLogic { buildId = 1; } GuildInfo guildInfo = GuilidManager.guildInfoMap.get(user.getPlayerInfoManager().getGuildId()); - guildInfo.updateDefendInfo(uid,buildId); - //重复,可提出 + //设置建筑要*1000,把星数带进去 + guildInfo.updateDefendInfo(uid,buildId*1000+5);//星数未定 Family.FamilyDefendInfo.Builder defend = Family.FamilyDefendInfo.newBuilder(); defend.setBuildId(buildId); defend.setUid(uid); defend.setStarCount(5); + defend.setCurForce(HeroLogic.getInstance().calTeamTotalForce(user,501,false)); sendIndicationToMember(guildInfo,MessageTypeProto.MessageType.FAMILY_QUICK_SET_DEFEND_INDICATION,defend.build()); MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true); } @@ -799,4 +808,31 @@ public class GuildLogic { } } } + public static void familyFightMatching() throws Exception { + Set guildIds= GuilidManager.guildInfoMap.keySet(); + if(guildIds.size()<1){ + return; + } + for(Integer gid:guildIds){ + GuildInfo guildInfo = GuilidManager.guildInfoMap.get(gid); + Map defendInfo = guildInfo.getDefendInfo(); + for(Map.Entry entry:defendInfo.entrySet()){ + User user = UserManager.getUser(entry.getKey()); + HeroManager heroManager = user.getHeroManager(); + List teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(501); + Iterator it = teamPosHeroInfos.iterator(); + FamilyFightInfo fightInfo = new FamilyFightInfo(); + Map> heroAllAttribute = new HashMap<>(); + while (it.hasNext()){ + TeamPosHeroInfo heroInfo = it.next(); + heroManager.getHero(heroInfo.getHeroId()); + Map heroAttributeMap = HeroLogic.getInstance().calHeroNotBufferAttribute(user, heroManager.getHero(heroInfo.getHeroId()), false); + heroAllAttribute.put(heroInfo.getHeroId(),heroAttributeMap); + } + fightInfo.setHeroAttribute(heroAllAttribute); + fightInfo.setStarCount(entry.getValue()%1000); + RedisUtil.getInstence().putMapEntry(RedisKey.FAMILY_FIGHT,String.valueOf(guildInfo.getId()),String.valueOf(entry.getKey()),fightInfo); + } + } + } }