公会战修改

lvxinran 2019-08-29 12:02:08 +08:00
parent bf36633caf
commit 447445a29f
4 changed files with 38 additions and 38 deletions

View File

@ -80,6 +80,10 @@ public class HandlerLogicThread extends Thread{
whiteMsg.add(MessageTypeProto.MessageType.SERVER_FIVE_REQEUST_VALUE); whiteMsg.add(MessageTypeProto.MessageType.SERVER_FIVE_REQEUST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.SERVER_ZERO_REQUEST_VALUE); whiteMsg.add(MessageTypeProto.MessageType.SERVER_ZERO_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.FAMILY_FIGHT_ROUND_INFO_REQUEST_VALUE); whiteMsg.add(MessageTypeProto.MessageType.FAMILY_FIGHT_ROUND_INFO_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.FAMILY_GET_INFO_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.FAMILY_GET_MEMBER_REQUEST_VALUE);
whiteMsg.add(MessageTypeProto.MessageType.FAMILY_GET_APPLY_REQUEST_VALUE);

View File

@ -131,6 +131,8 @@ public class RedisKey {
public static final String FAMILY_FIGHT_ATTACK_COUNT = "FAMILY_FIGHT_ATTACK_COUNT"; public static final String FAMILY_FIGHT_ATTACK_COUNT = "FAMILY_FIGHT_ATTACK_COUNT";
//公会总星数 //公会总星数
public static final String FAMILY_FIGHT_TOTAL_STAR = "FAMILY_FIGHT_TOTAL_STAR"; public static final String FAMILY_FIGHT_TOTAL_STAR = "FAMILY_FIGHT_TOTAL_STAR";
//公会战获得经验
public static final String FAMILY_FIGHT_TOTAL_EXP = "FAMILY_FIGHT_TOTAL_EXP";
//给用户发送邮件 //给用户发送邮件
public static final String READY_TO_USER_MAIL = "READY_TO_USER_MAIL"; public static final String READY_TO_USER_MAIL = "READY_TO_USER_MAIL";
//把用户踢下线 //把用户踢下线

View File

@ -2549,9 +2549,9 @@ public class MapLogic {
int[][] bossType = config.getRandomBossType(); int[][] bossType = config.getRandomBossType();
type = MathUtils.randomFromWeight(bossType); type = MathUtils.randomFromWeight(bossType);
// if(mapManager.getTower()%5!=0){ if(mapManager.getTower()%5!=0){
// type = 3; type = 3;
// } }
LOGGER.info("trigger!!!!!!!!!!!!!!!!!-------->{},{}",CellUtil.pos2XY(mapManager.getCurXY())[0],CellUtil.pos2XY(mapManager.getCurXY())[1]); LOGGER.info("trigger!!!!!!!!!!!!!!!!!-------->{},{}",CellUtil.pos2XY(mapManager.getCurXY())[0],CellUtil.pos2XY(mapManager.getCurXY())[1]);
int[][][] pointId = config.getRandomMapPointId(); int[][][] pointId = config.getRandomMapPointId();
int mapId = config.getMapId(); int mapId = config.getMapId();

View File

@ -412,27 +412,28 @@ public class GuildFightLogic {
List<TeamPosHeroInfo> teamAttack = userAttack.getTeamPosManager().getTeamPosForHero().get(502); List<TeamPosHeroInfo> teamAttack = userAttack.getTeamPosManager().getTeamPosForHero().get(502);
if(attackBloodMap!=null&&attackBloodMap.size()>0){ if(attackBloodMap!=null&&attackBloodMap.size()>0){
for(TeamPosHeroInfo teamHero: teamAttack){ for(TeamPosHeroInfo teamHero: teamAttack){
Hero hero = userAttack.getHeroManager().getHero(teamHero.getHeroId());
if (hero == null) {
continue;
}
StringBuilder skillSb = new StringBuilder();
StringBuilder propertySb = new StringBuilder();
String heroSkill = HeroLogic.getInstance().getHeroSkills(userDefend, hero, skillSb).toString();
Map<Integer, Integer> heroAttributeMap = HeroLogic.getInstance().calHeroNotBufferAttribute(userAttack, hero, false, 502);
for(Map.Entry<String,String> blood:attackBloodMap.entrySet()){ for(Map.Entry<String,String> blood:attackBloodMap.entrySet()){
if(teamHero.getHeroId().equals(blood.getKey())){ if(teamHero.getHeroId().equals(blood.getKey())){
Hero hero = userAttack.getHeroManager().getHero(teamHero.getHeroId());
if (hero == null) {
continue;
}
StringBuilder skillSb = new StringBuilder();
StringBuilder propertySb = new StringBuilder();
String heroSkill = HeroLogic.getInstance().getHeroSkills(userDefend, hero, skillSb).toString();
Map<Integer, Integer> heroAttributeMap = HeroLogic.getInstance().calHeroNotBufferAttribute(userAttack, hero, false, 502);
heroAttributeMap.put(HeroAttributeEnum.CurHP.getPropertyId(),heroAttributeMap.get(HeroAttributeEnum.Hp.getPropertyId())-Integer.parseInt(blood.getValue())*heroAttributeMap.get(HeroAttributeEnum.Hp.getPropertyId())/100); heroAttributeMap.put(HeroAttributeEnum.CurHP.getPropertyId(),heroAttributeMap.get(HeroAttributeEnum.Hp.getPropertyId())-Integer.parseInt(blood.getValue())*heroAttributeMap.get(HeroAttributeEnum.Hp.getPropertyId())/100);
String property = HeroLogic.getInstance().getHeroPropertyBuilder(propertySb, hero, heroAttributeMap).toString(); break;
CommonProto.FightUnitInfo heroFightInfo = CommonProto.FightUnitInfo
.newBuilder()
.setUnitId(Integer.toString(hero.getTemplateId()))
.setUnitSkillIds(heroSkill.substring(0, heroSkill.length() - 1))
.setProperty(property.substring(0, property.length() - 1))
.build();
heroAttackFightInfos.add(heroFightInfo);
} }
} }
String property = HeroLogic.getInstance().getHeroPropertyBuilder(propertySb, hero, heroAttributeMap).toString();
CommonProto.FightUnitInfo heroFightInfo = CommonProto.FightUnitInfo
.newBuilder()
.setUnitId(Integer.toString(hero.getTemplateId()))
.setUnitSkillIds(heroSkill.substring(0, heroSkill.length() - 1))
.setProperty(property.substring(0, property.length() - 1))
.build();
heroAttackFightInfos.add(heroFightInfo);
} }
CommonProto.FightTeamInfo.Builder fightAttackTeamInfoBuilder = CommonProto.FightTeamInfo.newBuilder().addAllFightUnitList(heroAttackFightInfos) CommonProto.FightTeamInfo.Builder fightAttackTeamInfoBuilder = CommonProto.FightTeamInfo.newBuilder().addAllFightUnitList(heroAttackFightInfos)
.setTeamSkillList(HeroLogic.getInstance().getPokenmonSkills(userAttack, 1)); .setTeamSkillList(HeroLogic.getInstance().getPokenmonSkills(userAttack, 1));
@ -628,6 +629,10 @@ public class GuildFightLogic {
String attackCountKey = RedisKey.getKey(RedisKey.FAMILY_FIGHT_ATTACK_COUNT, "", false); String attackCountKey = RedisKey.getKey(RedisKey.FAMILY_FIGHT_ATTACK_COUNT, "", false);
//额外星数信息 //额外星数信息
String extraStar = RedisKey.getKey(RedisKey.FAMILY_FIGHT_EXTRA_STAR,"",false); String extraStar = RedisKey.getKey(RedisKey.FAMILY_FIGHT_EXTRA_STAR,"",false);
//获得经验信息
String expKey = RedisKey.getKey(RedisKey.FAMILY_FIGHT_TOTAL_EXP,"",false);
//所有星数信息
String totalStar = RedisKey.getKey(RedisKey.FAMILY_FIGHT_TOTAL_STAR,"",false);
Set<String> matchingRank = redisUtil.getZset(matchingKey, 0, redisUtil.getZsetSize(matchingKey)); Set<String> matchingRank = redisUtil.getZset(matchingKey, 0, redisUtil.getZsetSize(matchingKey));
for(String index:matchingRank){ for(String index:matchingRank){
Map<Integer, FamilyFightInfo> fightDefend = redisUtil.getMapValues(RedisKey.FAMILY_FIGHT, index, Integer.class, FamilyFightInfo.class); Map<Integer, FamilyFightInfo> fightDefend = redisUtil.getMapValues(RedisKey.FAMILY_FIGHT, index, Integer.class, FamilyFightInfo.class);
@ -658,17 +663,10 @@ public class GuildFightLogic {
} }
} }
} }
//清除额外星数信息
// redisUtil.removeMapEntrys(RedisKey.FAMILY_FIGHT_EXTRA_STAR,"");
//清除布防信息 //清除布防信息
// GuilidManager.guildInfoMap.get(index).removeAllDefendInfo(); GuilidManager.guildInfoMap.get(index).removeAllDefendInfo();
} }
redisUtil.del(matchingKey,attackCountKey,extraStar); redisUtil.del(matchingKey,attackCountKey,extraStar,expKey,totalStar);
// 删除匹配信息
// redisUtil.removeZSetRangeByRank(matchingKey,0,redisUtil.getZsetSize(matchingKey));
} }
/** /**
* (Redismongo) * (Redismongo)
@ -720,6 +718,7 @@ public class GuildFightLogic {
//战绩结算 //战绩结算
int getExp = 0; int getExp = 0;
Double rank = redisUtil.getZSetScore(RedisKey.FAMILY_FIGHT_RANK, "", str); Double rank = redisUtil.getZSetScore(RedisKey.FAMILY_FIGHT_RANK, "", str);
// rank+=7000;
for(Map.Entry<Integer, SGuildScoreConfig> entry:sGuildScoreConfigMap.entrySet()){ for(Map.Entry<Integer, SGuildScoreConfig> entry:sGuildScoreConfigMap.entrySet()){
if(rank<entry.getValue().getScoreMin()||rank>entry.getValue().getScoreMax()){ if(rank<entry.getValue().getScoreMin()||rank>entry.getValue().getScoreMax()){
continue; continue;
@ -757,9 +756,11 @@ public class GuildFightLogic {
} }
break; break;
} }
LOGGER.info("获得经验{}",getExp);
redisUtil.putMapEntry(RedisKey.FAMILY_FIGHT_TOTAL_EXP,"",str,getExp);
if(guildInfo.getExp()+getExp>=levelConfigMap.get(guildInfo.getLevel()).getExp()){ if(guildInfo.getExp()+getExp>=levelConfigMap.get(guildInfo.getLevel()).getExp()){
guildInfo.updateExp(guildInfo.getExp()+getExp-levelConfigMap.get(guildInfo.getLevel()).getExp()); guildInfo.updateExp(guildInfo.getExp()+getExp-levelConfigMap.get(guildInfo.getLevel()).getExp());
guildInfo.updateLevel(guildInfo.getLevel()+getExp); guildInfo.updateLevel(guildInfo.getLevel()+1);
}else{ }else{
guildInfo.updateExp(guildInfo.getExp()+getExp); guildInfo.updateExp(guildInfo.getExp()+getExp);
} }
@ -814,16 +815,9 @@ public class GuildFightLogic {
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true); MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
return; return;
} }
int winStar = getTotalStar(guildId);
int defeatStar = getTotalStar(enemyFamily);
if(winStar<defeatStar){
response.setGetExp(1);
}else if(winStar==defeatStar){
response.setGetExp(10);
}else{
response.setGetExp(100);
} Integer getExp = redisUtil.getMapEntry(RedisKey.FAMILY_FIGHT_TOTAL_EXP, "", String.valueOf(guildId), Integer.class);
response.setGetExp(getExp);
response.setCurExp(guildInfo.getExp()); response.setCurExp(guildInfo.getExp());
response.setLevel(guildInfo.getLevel()); response.setLevel(guildInfo.getLevel());
//获取星星 //获取星星