玉虚论道

back_recharge
xuexinpeng 2021-09-28 19:15:13 +08:00
parent d20ba835bf
commit 4a1f019c1a
5 changed files with 103 additions and 61 deletions

View File

@ -113,61 +113,7 @@ public class CrossYuxulundaoChallengeHandler extends BaseHandler<ArenaInfoProto.
result = getFightResultByPersonToPerson(user, defUid, yuxuTeamId.stream().mapToInt(Integer::intValue).toArray(), teamId.stream().mapToInt(Integer::intValue).toArray(), arenaRecord, res);
}
long winCount = Arrays.stream(result).boxed().filter(n -> n == 1).count();
//战斗记录
if (defUid > 1000) {
if (arenaRecord != null) {
if (winCount >= 2) {
//攻击者赢了
arenaRecord.setYxldBattleType(1);
arenaRecord.setYxldScoreChange(+25);
} else {
arenaRecord.setYxldBattleType(2);
arenaRecord.setYxldScoreChange(-25);
}
arenaRecord.setYxldResult(result);
//挑战者记录
RedisUtil redisUtil = RedisUtil.getInstence();
String key2 = RedisKey.getKey(RedisKey.CROSS_YUXULUNDAO_RECORD, String.valueOf(user.getId()), false);
long defLenth = redisUtil.lGetListSize(key2);
if (defLenth > 20) {
redisUtil.lPop(key2);
}
arenaRecord.setCreateTime(TimeUtils.nowInt());
String defarenaRecordJson = new Gson().toJson(arenaRecord);
redisUtil.lSet(key2, defarenaRecordJson);
if (winCount >= 2) {
//防守方输了了
arenaRecord.setYxldBattleType(4);
arenaRecord.setYxldScoreChange(-25);
} else {
//防守方赢了
arenaRecord.setYxldBattleType(3);
arenaRecord.setYxldScoreChange(+25);
}
//被挑战者记录
arenaRecord.setCreateTime(TimeUtils.nowInt()); // 时间
arenaRecord.setAttackId(user.getId()); //id
arenaRecord.setLevel(user.getPlayerInfoManager().getLevel()); //等级
arenaRecord.setHead(user.getPlayerInfoManager().getHead()); //头像
arenaRecord.setUserName(user.getPlayerInfoManager().getNickName()); //名字
arenaRecord.setHeadFrame(user.getPlayerInfoManager().getHeadFrame());//头像框
arenaRecord.setPracticeLevel(user.getHeroManager().getPracticeLevel());//修行等级
int[] newResult = new int[3];
for (int i = 0; i < result.length; i++) {
newResult[i] = result[i] ^ 1;
}
arenaRecord.setYxldResult(newResult);
int myforce = HeroLogic.getInstance().calTeamTotalForce(user, GlobalsDef.CROSS_YU_XU_LUN_DAO_ONE, false) + HeroLogic.getInstance().calTeamTotalForce(user, GlobalsDef.CROSS_YU_XU_LUN_DAO_TWO, false) + HeroLogic.getInstance().calTeamTotalForce(user, GlobalsDef.CROSS_YU_XU_LUN_DAO_THREE, false);
arenaRecord.setAttackForce(myforce); //总战斗力
String key = RedisKey.getKey(RedisKey.CROSS_YUXULUNDAO_RECORD, String.valueOf(defUid), false);
long def = redisUtil.lGetListSize(key);
if (def > 20) {
redisUtil.lPop(key);
}
String arenaRecordJson = new Gson().toJson(arenaRecord);
redisUtil.lSet(key, arenaRecordJson);
}
}
List<ArenaEnemy> enemyList = arenaManager.getCrossYuxulundaoEnemies();
enemyList.forEach(n -> res.addArenaEnemys(CrossYuxulundaoLogic.getInstance().getMatchRivalInfo(n.getEnemyId(), 0, 0)));
CSPlayer myQuery = CrossServiceLogic.getPlayerByRedis(user.getId());
@ -231,6 +177,63 @@ public class CrossYuxulundaoChallengeHandler extends BaseHandler<ArenaInfoProto.
rank.addRank(user.getId(), String.valueOf(crossGroup), defQuery.getCrossYuxulundaoNewScore());
}
}
//战斗记录
if (defUid > 1000) {
if (arenaRecord != null) {
if (winCount >= 2) {
//攻击者赢了
arenaRecord.setYxldBattleType(1);
arenaRecord.setYxldScoreChange(winerGetScore);
} else {
arenaRecord.setYxldBattleType(2);
arenaRecord.setYxldScoreChange(loserGetScore);
}
arenaRecord.setYxldResult(result);
//挑战者记录
RedisUtil redisUtil = RedisUtil.getInstence();
String key2 = RedisKey.getKey(RedisKey.CROSS_YUXULUNDAO_RECORD, String.valueOf(user.getId()), false);
long defLenth = redisUtil.lGetListSize(key2);
if (defLenth > 20) {
redisUtil.lPop(key2);
}
arenaRecord.setCreateTime(TimeUtils.nowInt());
String defarenaRecordJson = new Gson().toJson(arenaRecord);
redisUtil.lSet(key2, defarenaRecordJson);
if (winCount >= 2) {
//防守方输了了
arenaRecord.setYxldBattleType(4);
arenaRecord.setYxldScoreChange(loserGetScore);
} else {
//防守方赢了
arenaRecord.setYxldBattleType(3);
arenaRecord.setYxldScoreChange(winerGetScore);
}
//被挑战者记录
arenaRecord.setCreateTime(TimeUtils.nowInt()); // 时间
arenaRecord.setAttackId(user.getId()); //id
arenaRecord.setLevel(user.getPlayerInfoManager().getLevel()); //等级
arenaRecord.setHead(user.getPlayerInfoManager().getHead()); //头像
arenaRecord.setUserName(user.getPlayerInfoManager().getNickName()); //名字
arenaRecord.setHeadFrame(user.getPlayerInfoManager().getHeadFrame());//头像框
arenaRecord.setPracticeLevel(user.getHeroManager().getPracticeLevel());//修行等级
int[] newResult = new int[3];
for (int i = 0; i < result.length; i++) {
newResult[i] = result[i] ^ 1;
}
arenaRecord.setYxldResult(newResult);
int myforce = HeroLogic.getInstance().calTeamTotalForce(user, GlobalsDef.CROSS_YU_XU_LUN_DAO_ONE, false) + HeroLogic.getInstance().calTeamTotalForce(user, GlobalsDef.CROSS_YU_XU_LUN_DAO_TWO, false) + HeroLogic.getInstance().calTeamTotalForce(user, GlobalsDef.CROSS_YU_XU_LUN_DAO_THREE, false);
arenaRecord.setAttackForce(myforce); //总战斗力
String key = RedisKey.getKey(RedisKey.CROSS_YUXULUNDAO_RECORD, String.valueOf(defUid), false);
long def = redisUtil.lGetListSize(key);
if (def > 20) {
redisUtil.lPop(key);
}
String arenaRecordJson = new Gson().toJson(arenaRecord);
redisUtil.lSet(key, arenaRecordJson);
}
}
int id = SMServerRankConfig.getIdByScore(myQuery.getCrossYuxulundaoNewScore());
if (myQuery.getCrossYxldMaxLevel() < id) {
//首次爬升到该位置发奖励
@ -273,7 +276,7 @@ public class CrossYuxulundaoChallengeHandler extends BaseHandler<ArenaInfoProto.
//rpc 数据调用测试
CrossArenaManager crossArenaManager = null;
CoreSettings coreSettings = ConfigurableApplicationContextManager.getBean(CoreSettings.class);
if (!csPlayer.getRpcIp().equals(coreSettings.getIp()) && csPlayer.getRpcPort() != coreSettings.getPort()) {
if (!csPlayer.getRpcIp().equals(coreSettings.getIp()) || csPlayer.getRpcPort() != coreSettings.getPort()) {
String ip = csPlayer.getRpcIp();
int port = csPlayer.getRpcPort();
int uid = csPlayer.getUserId();

View File

@ -46,7 +46,8 @@ public class CrossYuxulundaoTeamInfoHandler extends BaseHandler<PlayerInfoProto.
if (playerId <= 1000) {
//机器人
//res = PlayerLogic.getInstance().getCrossOneTeamInfo(playerId,null,yuxuTeamId);
playerTeamInfo = PlayerInfoProto.GetPlayerCrossYxldOneTeamInfoResponse.newBuilder().setTeamInfo(PlayerLogic.getInstance().getCrossOneTeamInfo(playerId, null, yuxuTeamId));
playerTeamInfo = PlayerInfoProto.GetPlayerCrossYxldOneTeamInfoResponse.newBuilder().
setTeamInfo(PlayerLogic.getInstance().getCrossOneTeamInfo(playerId, null, yuxuTeamId));
} else {
//真人.
playerTeamInfo = PlayerInfoProto.GetPlayerCrossYxldOneTeamInfoResponse.newBuilder()

View File

@ -3421,17 +3421,23 @@ public class HeroLogic{
for(Integer heroTid :heroList){
SCHero scHero = SCHero.getsCHero().get(heroTid);
Map<Integer, Long> robotHeroAttribute = calRobotHeroAttribute(scHero, heroLevel, 0, differDemonsId, differDemonsLv,true);
totalForce+=calForce(robotHeroAttribute);
int add =calForce(robotHeroAttribute);
sArenaRobotConfig.setYxldTotalForce1(sArenaRobotConfig.getYxldTotalForce1()+add);
totalForce+=add;
}
for(Integer heroTid :heroList2){
SCHero scHero = SCHero.getsCHero().get(heroTid);
Map<Integer, Long> robotHeroAttribute = calRobotHeroAttribute(scHero, heroLevel, 0, differDemonsId, differDemonsLv,true);
totalForce+=calForce(robotHeroAttribute);
int add =calForce(robotHeroAttribute);
sArenaRobotConfig.setYxldTotalForce2(sArenaRobotConfig.getYxldTotalForce2()+add);
totalForce+=add;
}
for(Integer heroTid :heroList3){
SCHero scHero = SCHero.getsCHero().get(heroTid);
Map<Integer, Long> robotHeroAttribute = calRobotHeroAttribute(scHero, heroLevel, 0, differDemonsId, differDemonsLv,true);
totalForce+=calForce(robotHeroAttribute);
int add =calForce(robotHeroAttribute);
sArenaRobotConfig.setYxldTotalForce3(sArenaRobotConfig.getYxldTotalForce3()+add);
totalForce+=add;
}
return totalForce;
}

View File

@ -735,12 +735,15 @@ public class PlayerLogic {
Integer heroStar = item.getValue().getStar();
teamInfo.addTeam(CommonProto.TeamSimpleInfo.newBuilder().setHeroid(String.valueOf(heroTid)).setHeroTid(heroTid).setLevel(sArenaRobotConfig.getRoleLv()).setStar(heroStar).setPosition(position++).build());
}
teamInfo.setTotalForce(sArenaRobotConfig.getYxldTotalForce1());
}else if(id ==GlobalsDef.CROSS_YU_XU_LUN_DAO_TWO){
for(Map.Entry<Integer,CommonProto.Hero> item : sArenaRobotConfig.getHeroMapList2().entrySet()){
Integer heroTid = item.getKey();
Integer heroStar = item.getValue().getStar();
teamInfo.addTeam(CommonProto.TeamSimpleInfo.newBuilder().setHeroid(String.valueOf(heroTid)).setHeroTid(heroTid).setLevel(sArenaRobotConfig.getRoleLv()).setStar(heroStar).setPosition(position++).build());
}
teamInfo.setTotalForce(sArenaRobotConfig.getYxldTotalForce2());
}else if(id ==GlobalsDef.CROSS_YU_XU_LUN_DAO_THREE){
for(Map.Entry<Integer,CommonProto.Hero> item : sArenaRobotConfig.getHeroMapList3().entrySet()){
@ -748,8 +751,9 @@ public class PlayerLogic {
Integer heroStar = item.getValue().getStar();
teamInfo.addTeam(CommonProto.TeamSimpleInfo.newBuilder().setHeroid(String.valueOf(heroTid)).setHeroTid(heroTid).setLevel(sArenaRobotConfig.getRoleLv()).setStar(heroStar).setPosition(position++).build());
}
teamInfo.setTotalForce(sArenaRobotConfig.getYxldTotalForce3());
}
teamInfo.setTotalForce(sArenaRobotConfig.getTotalForce());
//teamInfo.setTotalForce(sArenaRobotConfig.getYxldTotalForce());
oneInfo.addCrossTeam(teamInfo);
}
//oneInfo.setTeam(teamInfo);

View File

@ -43,6 +43,10 @@ public class SArenaRobotConfig implements BaseConfig {
private int yxldTotalForce;
private int yxldTotalForce1;
private int yxldTotalForce2;
private int yxldTotalForce3;
private int breakId;
private int starBreakId;
@ -215,4 +219,28 @@ public class SArenaRobotConfig implements BaseConfig {
public void setYxldTotalForce(int yxldTotalForce) {
this.yxldTotalForce = yxldTotalForce;
}
public int getYxldTotalForce1() {
return yxldTotalForce1;
}
public void setYxldTotalForce1(int yxldTotalForce1) {
this.yxldTotalForce1 = yxldTotalForce1;
}
public int getYxldTotalForce2() {
return yxldTotalForce2;
}
public void setYxldTotalForce2(int yxldTotalForce2) {
this.yxldTotalForce2 = yxldTotalForce2;
}
public int getYxldTotalForce3() {
return yxldTotalForce3;
}
public void setYxldTotalForce3(int yxldTotalForce3) {
this.yxldTotalForce3 = yxldTotalForce3;
}
}