公会战修改
parent
bf36633caf
commit
447445a29f
|
@ -80,6 +80,10 @@ public class HandlerLogicThread extends Thread{
|
|||
whiteMsg.add(MessageTypeProto.MessageType.SERVER_FIVE_REQEUST_VALUE);
|
||||
whiteMsg.add(MessageTypeProto.MessageType.SERVER_ZERO_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);
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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_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";
|
||||
//把用户踢下线
|
||||
|
|
|
@ -2549,9 +2549,9 @@ public class MapLogic {
|
|||
int[][] bossType = config.getRandomBossType();
|
||||
|
||||
type = MathUtils.randomFromWeight(bossType);
|
||||
// if(mapManager.getTower()%5!=0){
|
||||
// type = 3;
|
||||
// }
|
||||
if(mapManager.getTower()%5!=0){
|
||||
type = 3;
|
||||
}
|
||||
LOGGER.info("trigger!!!!!!!!!!!!!!!!!-------->{},{}",CellUtil.pos2XY(mapManager.getCurXY())[0],CellUtil.pos2XY(mapManager.getCurXY())[1]);
|
||||
int[][][] pointId = config.getRandomMapPointId();
|
||||
int mapId = config.getMapId();
|
||||
|
|
|
@ -412,27 +412,28 @@ public class GuildFightLogic {
|
|||
List<TeamPosHeroInfo> teamAttack = userAttack.getTeamPosManager().getTeamPosForHero().get(502);
|
||||
if(attackBloodMap!=null&&attackBloodMap.size()>0){
|
||||
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()){
|
||||
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);
|
||||
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);
|
||||
break;
|
||||
}
|
||||
}
|
||||
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)
|
||||
.setTeamSkillList(HeroLogic.getInstance().getPokenmonSkills(userAttack, 1));
|
||||
|
@ -628,6 +629,10 @@ public class GuildFightLogic {
|
|||
String attackCountKey = RedisKey.getKey(RedisKey.FAMILY_FIGHT_ATTACK_COUNT, "", 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));
|
||||
for(String index:matchingRank){
|
||||
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.removeZSetRangeByRank(matchingKey,0,redisUtil.getZsetSize(matchingKey));
|
||||
redisUtil.del(matchingKey,attackCountKey,extraStar,expKey,totalStar);
|
||||
}
|
||||
/**
|
||||
* 公会战结算(Redis中数据同到mongo)
|
||||
|
@ -720,6 +718,7 @@ public class GuildFightLogic {
|
|||
//战绩结算
|
||||
int getExp = 0;
|
||||
Double rank = redisUtil.getZSetScore(RedisKey.FAMILY_FIGHT_RANK, "", str);
|
||||
// rank+=7000;
|
||||
for(Map.Entry<Integer, SGuildScoreConfig> entry:sGuildScoreConfigMap.entrySet()){
|
||||
if(rank<entry.getValue().getScoreMin()||rank>entry.getValue().getScoreMax()){
|
||||
continue;
|
||||
|
@ -757,9 +756,11 @@ public class GuildFightLogic {
|
|||
}
|
||||
break;
|
||||
}
|
||||
LOGGER.info("获得经验{}",getExp);
|
||||
redisUtil.putMapEntry(RedisKey.FAMILY_FIGHT_TOTAL_EXP,"",str,getExp);
|
||||
if(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{
|
||||
guildInfo.updateExp(guildInfo.getExp()+getExp);
|
||||
}
|
||||
|
@ -814,16 +815,9 @@ public class GuildFightLogic {
|
|||
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
|
||||
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.setLevel(guildInfo.getLevel());
|
||||
//获取星星
|
||||
|
|
Loading…
Reference in New Issue