Merge branch 'master' into master_test

back_recharge
lvxinran 2020-07-25 15:14:26 +08:00
commit 300e7e5d17
37 changed files with 1214 additions and 717 deletions

View File

@ -106,10 +106,10 @@ public class CheckFight {
int[] resultCache = new int[8];//对方阵容走配置 Todo 后面结构走配置
resultCache[0]=status;
resultCache[1]=duration;
LOGGER.info(" lua check test fight result : "+ status);
// LOGGER.info(" lua check test fight result : "+ status);
for (int i = 1; i <= result.length(); i++) {
resultCache[i+1] = result.rawget(i).toint();
LOGGER.info(i+" --> 单位剩余血量 : "+ resultCache[i+1]);
// LOGGER.info(i+" --> 单位剩余血量 : "+ resultCache[i+1]);
}
return resultCache;

View File

@ -84,6 +84,20 @@ function BattleLogic.Init(data, optionData, maxRound)
BattleLogManager.Init(fightData)
end
-- 检测先手阵营
function BattleLogic.CheckFirstCamp()
-- 默认我方先手
BattleLogic.FirstCamp = 0
-- 数据不存在时,兼容老战斗数据
if not fightData.playerData.firstCamp and not fightData.enemyData[BattleLogic.CurOrder].firstCamp then
return
end
-- 敌方先手
if fightData.playerData.firstCamp == 0 and fightData.enemyData[BattleLogic.CurOrder].firstCamp == 1 then
BattleLogic.FirstCamp = 1
end
end
function BattleLogic.StartOrder()
--
BattleLogic.CurOrder = BattleLogic.CurOrder + 1
@ -104,7 +118,8 @@ function BattleLogic.StartOrder()
RoleManager.AddRole(orderList[i], orderList[i].position)
end
end
-- 检测先后手
BattleLogic.CheckFirstCamp()
-- 开始战斗,延时一帧执行,避免战斗还没开始就释放了技能
BattleLogic.TurnRoundNextFrame()
end
@ -156,7 +171,7 @@ function BattleLogic.TurnRound(debugTurn)
-- 第一次进入 或者 本轮结束 初始化流程状态
if CurRound == 0 or (CurSkillPos[0] == 6 and CurSkillPos[1] == 6) then
CurRound = CurRound + 1
CurCamp = 0
CurCamp = BattleLogic.FirstCamp -- 判断先手阵营
CurSkillPos[0] = 0
CurSkillPos[1] = 0
--

View File

@ -7,11 +7,12 @@ import config.SWorkShopTechnology;
import manager.AbstractClassStaticConfig;
import manager.STableManager;
import manager.Table;
import util.MathUtils;
import java.util.*;
public class SArenaRobotStaticConfig extends AbstractClassStaticConfig {
private static TreeMap<Integer, Integer> force2robotId;
private static TreeMap<Integer, LinkedList<Integer>> force2robotId;
@Override
public void registConfigs(Set<String> registConfigs) {
registConfigs.add(SArenaRobotConfig.class.getAnnotation(Table.class).name());
@ -21,6 +22,7 @@ public class SArenaRobotStaticConfig extends AbstractClassStaticConfig {
public void figureConfigs() {
force2robotId = new TreeMap<>();
Map<Integer, SArenaRobotConfig> integerSArenaRobotConfigMap = SArenaRobotConfig.getsArenaRobotConfigMap();
for(SArenaRobotConfig sArenaRobotConfig : integerSArenaRobotConfigMap.values()){
List<Integer> heroList = sArenaRobotConfig.getHeroList();
int heroLevel = sArenaRobotConfig.getRobotLevel();
@ -36,7 +38,13 @@ public class SArenaRobotStaticConfig extends AbstractClassStaticConfig {
}
int totleForce = HeroLogic.getInstance().calRobotTotalForce(sArenaRobotConfig);
sArenaRobotConfig.setTotalForce(totleForce);
force2robotId.put(totleForce,sArenaRobotConfig.getId());
LinkedList<Integer> integers = force2robotId.get(totleForce);
if(integers==null){
integers =new LinkedList<>();
force2robotId.put(totleForce,integers);
}
integers.add(sArenaRobotConfig.getId());
force2robotId.put(totleForce,integers);
}
int[][] returnMaterials = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getReturnMaterials();
@ -53,10 +61,13 @@ public class SArenaRobotStaticConfig extends AbstractClassStaticConfig {
public static Integer getFloorForce2robotId(int force) {
Map.Entry<Integer,Integer> entry = force2robotId.ceilingEntry(force);
Map.Entry<Integer,LinkedList<Integer>> entry = force2robotId.ceilingEntry(force);
if(null==entry){
return force2robotId.firstEntry().getValue();
LinkedList<Integer> value = force2robotId.firstEntry().getValue();
int num = MathUtils.randomInt(value.size());
return value.get(num);
}
return entry.getValue();
}
LinkedList<Integer> value = entry.getValue();
int num = MathUtils.randomInt(value.size());
return value.get(num); }
}

View File

@ -92,6 +92,7 @@ public interface GlobalsDef {
int EXPEDITION_TEAM =1001; //
int CAR_DELAY_TEAM =1101; //车迟斗法
int DEATH_PATH_TEAM = 1201;//十绝阵
int CHAMPION_TEAM = 1301; //巅峰赛
//特权解锁类型
int LEVEL_UNLOCK_PRIVILEGE = 1;

View File

@ -16,6 +16,6 @@ public class ChampionFunction implements FunctionManager {
@Override
public void closeAction() throws Exception {
ChampionshipLogic.close();
// ChampionshipLogic.close();
}
}

View File

@ -219,6 +219,7 @@ public class RedisKey {
public final static String CHAMPION_FIGHT = "CHAMPION_FIGHT";
public final static String CHAMPION_RANK = "CHAMPION_RANK";
public final static String CHAMPION_JOIN = "CHAMPION_JOIN";
public final static String CHAMPION_JOIN_SELECT = "CHAMPION_JOIN_SELECT";
public final static String CHAMPION_ARENA_RECORD = "CHAMPION_ARENA_RECORD";
public final static String CHAMPION_CUR_JOIN_IDS = "CHAMPION_CUR_JOIN_IDS";
public final static String CHAMPION_FINAL32_JOIN_IDS = "CHAMPION_FINAL32_JOIN_IDS";
@ -235,10 +236,12 @@ public class RedisKey {
public final static String CHAMPION_BET_MINE = "CHAMPION_BET_MINE"; // 我的竞猜 selectIdForRedis value: winUid
public final static String CHAMPION_BET_DETAIL = "CHAMPION_BET_DETAIL"; // 我的竞猜 selectUid + ":" +winUid
public final static String CHAMPION_BET_ALL = "CHAMPION_BET_ALL"; // 竞猜信息 selectUid + ":" +winUid
public final static String CHAMPION_FINAL_RECODED_IDS = "CHAMPION_FINAL_RECODED_IDS"; // 巅峰赛決賽信息
public final static String CHAMPION_FINAL_RECODED_IDS = "CHAMPION_FINAL_RECODED_IDS"; // 巅峰赛決賽信息 //没发现什么用
public final static String CHAMPION_GUESSS_UIDS = "CHAMPION_GUESSS_UIDS"; // 巅峰赛发送竞猜币信息
public final static String CHAMPION_ARENA_RECORD_THREE = "CHAMPION_ARENA_RECORD_THREE";//三局两胜缓存
public final static String PIDGIDTEMP = "PIDGIDTEMP";
public final static String GUILDBOSS_ARENA_RECORD = "GUILDBOSS_ARENA_RECORD";

View File

@ -125,7 +125,7 @@ public class TakeLayRewardHandler extends BaseHandler<Expedition.TakeExpeditionB
user.getExpeditionManager().addScore(score);
Map<Integer, Integer> rewardStatusMap = user.getExpeditionManager().getWorldTreasureReward().getRewardStatusMap();
ExpeditionLogic.sendTreasureRewardUpdate(iSession,user.getExpeditionManager().getWorldTreasureReward().getScore(),rewardStatusMap);
ExpeditionLogic.sendTreasureRewardUpdate(iSession,user.getExpeditionManager().getWorldTreasureReward().getScore(),rewardStatusMap,user.getExpeditionManager().getWorldTreasureReward().getCreateTime());
Expedition.TakeExpeditionBoxRewardResponse builder = Expedition.TakeExpeditionBoxRewardResponse.newBuilder().setDrop(drop).addAllLeve(objects).build();
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.EXPEDITION_TAKE_BOXREWARD_RESONSE_VALUE, builder, true);

View File

@ -59,7 +59,7 @@ public class TakeTreasureRewardHandler extends BaseHandler<Expedition.Expedition
worldTreasureReward.updateMissionStatus(id,changeState);
Map<Integer,Integer> stateUpdateMap = new HashMap<>();
stateUpdateMap.put(id,changeState);
ExpeditionLogic.sendTreasureRewardUpdate(iSession,worldTreasureReward.getScore(),stateUpdateMap);
ExpeditionLogic.sendTreasureRewardUpdate(iSession,worldTreasureReward.getScore(),stateUpdateMap,worldTreasureReward.getCreateTime());
}else{
Map<Integer,Integer> stateUpdateMap = new HashMap<>();
Set<SWorldBossTreasureConfig> sWorldBossTreasureConfigs = idsByPeriods.get(round);
@ -76,7 +76,7 @@ public class TakeTreasureRewardHandler extends BaseHandler<Expedition.Expedition
throw new ErrorCodeException("无奖励可领取");
}
user.getExpeditionManager().onlyUpdateTreasureReward();
ExpeditionLogic.sendTreasureRewardUpdate(iSession,worldTreasureReward.getScore(),stateUpdateMap);
ExpeditionLogic.sendTreasureRewardUpdate(iSession,worldTreasureReward.getScore(),stateUpdateMap,worldTreasureReward.getCreateTime());
}
CommonProto.Drop.Builder drop = ItemUtil.drop(user, drops, BIReason.EXCEPTION_TREASURE_REWARD);
Expedition.ExpeditionTakeTreasureResponse build = Expedition.ExpeditionTakeTreasureResponse.newBuilder().setDrop(drop).build();

View File

@ -147,7 +147,7 @@ public class GetLuckWheelRandHandler extends BaseHandler<PlayerInfoProto.GetLuck
builder.setActivityId(proto.getActivityId());
builder.setDrop(drop);
builder.addAllPosInfos(rewardPosInfoList);
user.getUserMissionManager().onGameEvent(user, GameEvent.LUCK_WHEEL_TIMES,reson);
user.getUserMissionManager().onGameEvent(user, GameEvent.LUCK_WHEEL_TIMES,reson,time);
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_LUCKWHEEL_RANDREWARD_RESPONSE_VALUE, builder.build(), true);
}

View File

@ -1,5 +1,6 @@
package com.ljsd.jieling.handler.champion;
import com.google.gson.Gson;
import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.handler.BaseHandler;
@ -13,6 +14,8 @@ import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.util.MessageUtil;
import java.util.List;
/**
* *
* *
@ -32,6 +35,9 @@ public class ChampinGetHandler extends BaseHandler {
int progress = ChampionshipLogic.getProgress(); //阶段
int roundTimes = ChampionshipLogic.getRoundTimes(); //比赛进行第几轮
int endTime = ChampionshipLogic.getEndTime(); //比赛进行第几轮
int schedule = ChampionshipLogic.getSchedule();
int fightTime = ChampionshipLogic.getFightTime();
int realTimes = ChampionshipLogic.getRealTimes();
//组装数据
int myRank = RedisUtil.getInstence().getZSetreverseRank(RedisKey.CHAMPION_RANK, "", Integer.toString(uid)).intValue();
int topMaxRank = UserManager.getUser(uid).getArenaManager().getTopMaxRank();
@ -47,18 +53,82 @@ public class ChampinGetHandler extends BaseHandler {
builder.setJoinState(1);
String key = RedisUtil.getInstence().getKey(RedisKey.CHAMPION_MY_BATTLLE_IDS, Integer.toString(uid));
Object latestKey = RedisUtil.getInstence().lGetIndex(key, -1);
if(latestKey!=null){
if(latestKey!=null) {
ArenaRecord arenaRecord = RedisUtil.getInstence().getMapValue(RedisKey.CHAMPION_ARENA_RECORD, "", latestKey.toString(), ArenaRecord.class);
int enemyId = arenaRecord.getDefUid();
int attackId = arenaRecord.getAttackId();
int fightResult = arenaRecord.getFightResult();
int roundTims = arenaRecord.getRoundTims();
CommonProto.ChampionBattleInfo.Builder builder1 = CommonProto.ChampionBattleInfo.newBuilder();
if(roundTimes == arenaRecord.getRoundTims() && (progress%10%4 != 3 || fightResult==-2)){
fightResult =-1;
if(schedule==1){
if(roundTimes==roundTims&&(fightResult == -2 || !(progress % 10 == 3))){
fightResult = -1;
}
}else {
if ((realTimes+7) == arenaRecord.getRoundTims() && (fightResult == -2 || !(progress % 10 == 3))) {
fightResult = -1;
}
}
if(fightResult!=-1){
builder1.setFightData( CommonProto.FightData.parseFrom(arenaRecord.getFightData()));
if (fightResult != -1) {
builder1.setFightData(CommonProto.FightData.parseFrom(arenaRecord.getFightData()));
}
List<String> strings = RedisUtil.getInstence().lGet(RedisKey.CHAMPION_MY_BATTLLE_IDS, Integer.toString(uid), 0, -1);
int state = -1;
for (String redisId : strings) {
ArenaRecord record = RedisUtil.getInstence().getMapValue(RedisKey.CHAMPION_ARENA_RECORD, "", redisId, ArenaRecord.class);
if ((!record.getId().equals(arenaRecord.getId())) && record.getRoundTims() == roundTims) {
if (record.getFightResult() == 1) {
if (state == -1) {
state = 2;
} else if (state == 3) {
state = 5;
} else {
state = record.getFightResult();
}
} else {
if (state == -1) {
state = 3;
} else if (state == 2) {
state = 4;
} else {
state = record.getFightResult();
}
}
}
}
if(ChampionshipLogic.getProgress()==-2){
if(arenaRecord.getRoundTims()-7==5){
if(state==0&&attackId==uid){
builder.setLoser(true);
}else {
builder.setLoser(false);
}
}else {
builder.setLoser(true);
}
}else {
if(schedule==2){
if( roundTims - 7 != realTimes) {
builder.setLoser(true);
}else {
builder.setLoser(false);
}
}else if(schedule==1){
if(roundTims!=roundTimes){
builder.setLoser(true);
}else {
builder.setLoser(false);
}
}
}
builder.setProcess(state);
builder.setChampionBattleInfo(builder1
.setMyInfo(ChampionshipLogic.getChampionBattleInfo(attackId))
.setEnemyInfo(ChampionshipLogic.getChampionBattleInfo(enemyId))

View File

@ -14,6 +14,9 @@ import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.util.MessageUtil;
import util.StringUtil;
import java.util.List;
import java.util.Map;
/**
*
* 0 1 ChampionBetInfo
@ -27,10 +30,9 @@ public class ChampionBetInfoHandler extends BaseHandler<ArenaInfoProto.ChampionG
@Override
public void processWithProto(ISession session, ArenaInfoProto.ChampionGetBetRequest proto) throws Exception {
int progress = ChampionshipLogic.getProgress(); //阶段
int roundTimes = ChampionshipLogic.getRoundTimes(); //比赛进行第几轮
int schedule = ChampionshipLogic.getSchedule();
int realTimes = ChampionshipLogic.getRealTimes();
int uid = session.getUid();
if(progress==-1 || schedule==1){
if(progress==-1){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
String selectIdForRedis = ChampionshipLogic.getSelectIdForRedis();
@ -40,16 +42,67 @@ public class ChampionBetInfoHandler extends BaseHandler<ArenaInfoProto.ChampionG
ArenaRecord arenaRecord = RedisUtil.getInstence().getMapValue(RedisKey.CHAMPION_ARENA_RECORD, "", selectIdForRedis, ArenaRecord.class);
if(proto.getType() == 0){
int fightResult=arenaRecord.getFightResult();
if(arenaRecord.getRoundTims() == roundTimes && progress%10%4 != 3){
fightResult =-1;
}
if(fightResult == -2){
fightResult=-1;
if( ChampionshipLogic.getSchedule()==1){
if(arenaRecord.getRoundTims() == ChampionshipLogic.getRoundTimes()&&(fightResult == -2 || !(progress % 10 == 3))){
fightResult = -1;
}
}else {
if ((realTimes+7) == arenaRecord.getRoundTims() && (fightResult == -2 || !(progress % 10 == 3))) {
fightResult = -1;
}
}
int myGuessID = 0;
Integer mineBetCoins = 0;
// Map<String, Integer> states = RedisUtil.getInstence().getMapValues(RedisKey.CHAMPION_ARENA_RECORD_THREE, "", String.class, Integer.class);
// String key = String.valueOf(v.getAttackId() * 2222 + String.valueOf(v.getDefUid()));
int state =-1;
// Integer stateInteger = states.get(key);
// if (null!=stateInteger) {
// state =stateInteger
// }
//
List<String> strings = RedisUtil.getInstence().lGet(RedisKey.CHAMPION_MY_BATTLLE_IDS, Integer.toString(arenaRecord.getAttackId()), 0,-1);
//
for (String redisId:strings) {
ArenaRecord record = RedisUtil.getInstence().getMapValue(RedisKey.CHAMPION_ARENA_RECORD, "", redisId, ArenaRecord.class);
if(record.getTurn()==-1){
continue;
}
if((!record.getId().equals(arenaRecord.getId()))&&record.getRoundTims()==(arenaRecord.getRoundTims())){
if (record.getFightResult() == 1) {
if (state == -1) {
state = 2;
} else if (state == 3) {
state = 5;
} else {
state = record.getFightResult();
}
} else {
if (state == -1) {
state = 3;
} else if (state == 2) {
state = 4;
} else {
state = record.getFightResult();
}
}
}
}
// if(state<2){
// }else {
// fightResult= -1;
// }
String guessUidStr = RedisUtil.getInstence().getMapEntry(RedisKey.CHAMPION_BET_MINE, Integer.toString(uid), selectIdForRedis, String.class);
if(!StringUtil.isEmpty(guessUidStr)) {
myGuessID = Integer.parseInt(guessUidStr);
mineBetCoins = RedisUtil.getInstence().getMapEntry(RedisKey.CHAMPION_BET_DETAIL, arenaRecord.getId() + ":" + guessUidStr, Integer.toString(uid), Integer.class);
}
CommonProto.ChampionBattleInfo.Builder builder1 = CommonProto.ChampionBattleInfo.newBuilder()
.setMyInfo( ChampionshipLogic.getChampionBattleInfo(arenaRecord.getAttackId()))
@ -58,9 +111,14 @@ public class ChampionBetInfoHandler extends BaseHandler<ArenaInfoProto.ChampionG
if(fightResult!=-1){
builder1.setFightData( CommonProto.FightData.parseFrom(arenaRecord.getFightData()));
}
builder.setProcess(state);
builder.setChampionBattleInfo(builder1
.build());
builder.setWinUid(myGuessID);
builder.setMyBetCoins(mineBetCoins);
}
}
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.CHAMPION_BET_INFO_RESPONSE_VALUE,builder.build(),true);

View File

@ -1,10 +1,24 @@
package com.ljsd.jieling.handler.champion;
import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.arena.ArenaLogic;
import com.ljsd.jieling.logic.championship.ChampionshipLogic;
import com.ljsd.jieling.logic.dao.ArenaRecord;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.ArenaInfoProto;
import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.util.MessageUtil;
import config.SArenaRobotConfig;
import manager.STableManager;
import util.StringUtil;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class ChampionGetMyAllBetHandler extends BaseHandler {
@Override
@ -13,7 +27,78 @@ public class ChampionGetMyAllBetHandler extends BaseHandler {
}
@Override
public void process(ISession iSession, PacketNetData netData) throws Exception {
ChampionshipLogic.viewMGuessHistory(iSession);
public void process(ISession session, PacketNetData netData) throws Exception {
int uid = session.getUid();
int progress = ChampionshipLogic.getProgress(); //阶段
int fightTime = ChampionshipLogic.getFightTime(); //阶段
int schedule = ChampionshipLogic.getSchedule();
int roundTimes = ChampionshipLogic.getRoundTimes(); //比赛进行第几轮
Map<String, String> betHistorys = RedisUtil.getInstence().getMapValues(RedisKey.CHAMPION_BET_MINE, Integer.toString(uid), String.class, String.class);
ArenaInfoProto.ChampionGetAllMyBetInfoResponse.Builder builder = ArenaInfoProto.ChampionGetAllMyBetInfoResponse.newBuilder();
if (!betHistorys.isEmpty()) {
List<Object> ids = new ArrayList<>(betHistorys.keySet());
List<ArenaRecord> arenaRecords = RedisUtil.getInstence().getMapEntrys(RedisKey.CHAMPION_ARENA_RECORD, "", ids, ArenaRecord.class);
Map<Integer, SArenaRobotConfig> arenaRobotConfigMap = STableManager.getConfig(SArenaRobotConfig.class);
for (ArenaRecord arenaRecord : arenaRecords) {
int attactkUidType = arenaRobotConfigMap.containsKey(arenaRecord.getAttackId()) ? 0 : 1;
int defUidType = arenaRobotConfigMap.containsKey(arenaRecord.getDefUid()) ? 0 : 1;
CommonProto.ArenaEnemy attackEnemy = ArenaLogic.getInstance().getArenaEnemy(arenaRecord.getAttackId(), attactkUidType);
CommonProto.ArenaEnemy defEnemy = ArenaLogic.getInstance().getArenaEnemy(arenaRecord.getDefUid(), defUidType);
int fightResult = arenaRecord.getFightResult();
int guessState = 0;
if (schedule == 1) {
if (arenaRecord.getRoundTims() == roundTimes) {
if (progress % 10 != 3) {
fightResult = -1;
}
if (progress % 10 == 1) {
guessState = 1;
}
}
} else {
if ((ChampionshipLogic.getRealTimes() + 7) == arenaRecord.getRoundTims()) {
if (!(progress % 10 == 3 && fightTime == 3)) {
fightResult = -1;
}
if (progress % 10 == 1&&fightTime == 1) {
guessState = 1;
}
}
}
if (fightResult == -2) {
fightResult = -1;
}
ArenaInfoProto.ChampionMyBetDetail.Builder betDetailBuilder = ArenaInfoProto.ChampionMyBetDetail.newBuilder();
String guessUid = betHistorys.get(arenaRecord.getId());
Integer mineBetCoins = RedisUtil.getInstence().getMapEntry(RedisKey.CHAMPION_BET_DETAIL, arenaRecord.getId() + ":" + guessUid, Integer.toString(uid), Integer.class);
int myWinCoins = 0;
if (fightResult >= 0) {
int winner = arenaRecord.getAttackId();
int loseer = arenaRecord.getDefUid();
if (fightResult == 0) {
winner = arenaRecord.getDefUid();
loseer = arenaRecord.getAttackId();
}
guessState = StringUtil.isEmpty(guessUid)?loseer:Integer.parseInt(guessUid);
if (!StringUtil.isEmpty(guessUid) && Integer.parseInt(guessUid) == winner) {
myWinCoins = (int) (1.5 * mineBetCoins);
}
}
builder.addChampionMyBetDetails(betDetailBuilder.setBetResult(guessState)
.setEnemyPairInfo(ArenaInfoProto.ChampionTwoEnemInfo.newBuilder().setRedEnemy(defEnemy).setBlueEnemy(attackEnemy).setFightResult(fightResult).setId(arenaRecord.getId()).setRoundTimes(arenaRecord.getRoundTims()))
.setMyBetCoins(mineBetCoins)
.setMyWinCoins(myWinCoins)
);
}
}
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.CHAMPION_GET_MYALL_BET_RESPONSE_VALUE, builder.build(), true);
}
}

View File

@ -1,11 +1,27 @@
package com.ljsd.jieling.handler.champion;
import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.arena.ArenaLogic;
import com.ljsd.jieling.logic.championship.ChampionshipLogic;
import com.ljsd.jieling.logic.dao.ArenaRecord;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.ArenaInfoProto;
import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.util.MessageUtil;
import config.SArenaRobotConfig;
import manager.STableManager;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* //查看我的战斗记录
*/
public class ChampionGetMyHistoryHandler extends BaseHandler {
@Override
public MessageTypeProto.MessageType getMessageCode() {
@ -13,7 +29,61 @@ public class ChampionGetMyHistoryHandler extends BaseHandler {
}
@Override
public void process(ISession iSession, PacketNetData netData) throws Exception {
ChampionshipLogic.viewAllMyBattleInfo(iSession);
public void process(ISession session, PacketNetData netData) throws Exception {
int uid = session.getUid();
int progress = ChampionshipLogic.getProgress(); //阶段
int schedule = ChampionshipLogic.getSchedule();
int roundTimes = ChampionshipLogic.getRoundTimes(); //比赛进行第几轮
List<String> myArenaIds = RedisUtil.getInstence().lGet(RedisKey.CHAMPION_MY_BATTLLE_IDS, Integer.toString(uid), 0, -1);
ArenaInfoProto.ChanpionGetAllMyBattleHistoryResponse.Builder builder = ArenaInfoProto.ChanpionGetAllMyBattleHistoryResponse.newBuilder();
if (myArenaIds != null) {
List<Object> ids = new ArrayList<>(myArenaIds);
List<ArenaRecord> myArenaRecordInfos = RedisUtil.getInstence().getMapEntrys(RedisKey.CHAMPION_ARENA_RECORD, "", ids, ArenaRecord.class);
Map<Integer, SArenaRobotConfig> robotConfigMap = STableManager.getConfig(SArenaRobotConfig.class);
for (ArenaRecord arenaRecord : myArenaRecordInfos) {
if(arenaRecord.getTurn()==-1){
//3局两胜 跳过
continue;
}
int attackUid = arenaRecord.getAttackId();
int enemyId = arenaRecord.getDefUid();
int fightResult = arenaRecord.getFightResult();
int roundTims = arenaRecord.getRoundTims();
if(schedule==1){
if(roundTimes==roundTims){
fightResult = -1;
}
}else {
if ((ChampionshipLogic.getRealTimes()+7) == arenaRecord.getRoundTims() &&ChampionshipLogic.getFightTime()==arenaRecord.getTurn()) {
fightResult = -1;
}
}
if(roundTimes == arenaRecord.getRoundTims()&&arenaRecord.getId().equals(myArenaIds.get(myArenaIds.size()-1))){
if(progress%10%4 != 3 || fightResult==-2){
fightResult =-1;
}
}
if (fightResult == -2) {
fightResult = -1;
}
int enemyType = robotConfigMap.containsKey(enemyId) ? 0 : 1;
int attackType = robotConfigMap.containsKey(attackUid) ? 0 : 1;
CommonProto.ArenaEnemy arenaEnemy = ArenaLogic.getInstance().getArenaEnemy(enemyId, enemyType);
CommonProto.ArenaEnemy attackInfo = ArenaLogic.getInstance().getArenaEnemy(attackUid, attackType);
ArenaInfoProto.ChampionTwoEnemInfo build = ArenaInfoProto.ChampionTwoEnemInfo.newBuilder()
.setBlueEnemy(attackInfo)
.setRedEnemy(arenaEnemy)
.setRoundTimes(arenaRecord.getRoundTims())
.setFightResult(fightResult)
.setId(arenaRecord.getId())
.build();
builder.addEnemyPairInfo(build);
}
}
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.CHAMPION_GET_MYHISTORY_RESPONSE_VALUE, builder.build(), true);
}
}

View File

@ -1,10 +1,21 @@
package com.ljsd.jieling.handler.champion;
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.championship.ChampionshipLogic;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.ArenaInfoProto;
import com.ljsd.jieling.protocols.CommonProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.util.MessageUtil;
import manager.STableManager;
import org.springframework.data.redis.core.ZSetOperations;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
public class ChampionGetWorldRankHandler extends BaseHandler<ArenaInfoProto.ChampionGetWorldRankRequest> {
@Override
@ -13,7 +24,55 @@ public class ChampionGetWorldRankHandler extends BaseHandler<ArenaInfoProto.Cham
}
@Override
public void processWithProto(ISession iSession, ArenaInfoProto.ChampionGetWorldRankRequest proto) throws Exception {
ChampionshipLogic.getWorldRankByPage(iSession,proto.getType(),proto.getPage());
public void processWithProto(ISession session, ArenaInfoProto.ChampionGetWorldRankRequest proto) throws Exception {
// ChampionshipLogic.getWorldRankByPage(iSession,proto.getPage());
int type=proto.getType();
int page=proto.getPage();
if (type == 1) {
ChampionshipLogic.getMyTeamInfo(session);
return;
}
if (page == 0) {
page = 1;
}
int start = (page - 1) * 20, end = page * 20 - 1;
List<CommonProto.ArenaEnemy> arenaRankMemberInfo = new ArrayList<>(20);
int rankEndLine = STableManager.getFigureConfig(CommonStaticConfig.class).getsChampionshipSetting().getChampionshipPlayer();
int myUid = session.getUid();
CommonProto.ArenaEnemy myInfo = null;
ArenaInfoProto.ChampionGetWorldRankResponse.Builder builder = ArenaInfoProto.ChampionGetWorldRankResponse.newBuilder();
if (start <= rankEndLine) {
Set<ZSetOperations.TypedTuple<String>> arenaRankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.CHAMPION_RANK, "", start, end);
for (ZSetOperations.TypedTuple<String> item : arenaRankInfo) {
String value = item.getValue();
int uid = Integer.parseInt(value);
start++;
CommonProto.ArenaEnemy enemyInfo = ChampionshipLogic.getEnemyInfo(uid, start, 0, 0);
if (enemyInfo == null) {
start--;
continue;
}
arenaRankMemberInfo.add(enemyInfo);
if (uid == myUid) {
myInfo = enemyInfo;
}
}
}
if (myInfo == null && start <= rankEndLine) {
int myRank = RedisUtil.getInstence().getZSetreverseRank(RedisKey.CHAMPION_RANK, "", Integer.toString(myUid)).intValue();
if (myRank != -1) {
myInfo = ChampionshipLogic.getEnemyInfo(myUid, myRank, 0, 0);
}
}
if (myInfo != null) {
builder.setMyInfo(myInfo);
}
ArenaInfoProto.ChampionGetWorldRankResponse buildResponse = builder.addAllRankInfos(arenaRankMemberInfo).build();
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.CHAMPION_GET_RANK_RESPONSE_VALUE, buildResponse, true);
}
}

View File

@ -42,9 +42,15 @@ public class ChampionGuessHandler extends BaseHandler<ArenaInfoProto.ChampionBet
int winUid = proto.getWinUid();
int chip = proto.getCoins();
int progress = ChampionshipLogic.getProgress(); //阶段
int schedule = ChampionshipLogic.getSchedule();
int fightTime = ChampionshipLogic.getFightTime();
int uid = session.getUid();
String selectUid = ChampionshipLogic.getSelectIdForRedis();
if(progress%10%4!=1 || StringUtil.isEmpty(selectUid)){
if(progress%10!=1 || StringUtil.isEmpty(selectUid)){
LOGGER.error("the uid={} not in time",uid);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
if(schedule==2 &&fightTime!=1 ){
LOGGER.error("the uid={} not in time",uid);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}

View File

@ -34,6 +34,7 @@ public class ChampionViewFinalHandler extends BaseHandler<ArenaInfoProto.Champio
int type = proto.getType();
int progress = ChampionshipLogic.getProgress(); //阶段
int roundTimes = ChampionshipLogic.getRoundTimes(); //比赛进行第几轮
int realTimes = ChampionshipLogic.getRealTimes(); //比赛进行第几轮
int schedule = ChampionshipLogic.getSchedule();
if (schedule != 2) {
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
@ -41,30 +42,53 @@ public class ChampionViewFinalHandler extends BaseHandler<ArenaInfoProto.Champio
Type valueType = new TypeToken<List<Integer>>() {
}.getType();
// if (page == 0) {
// page = 1;
// }
int start =0, end = - 1;
Map<Integer, List<Integer>> finalmemberOfTeam = RedisUtil.getInstence().getMapValues(RedisKey.CHAMPION_FINAL_TEAM_INFO, "", Integer.class, valueType);
Map<Integer, Integer> memberPerOfTeam = new HashMap<>();
List<String> arenaRecodeds =null;
if(type == 1){
arenaRecodeds = RedisUtil.getInstence().lGet(RedisKey.CHAMPION_FINAL32_JOIN_IDS, "", 0, -1);
arenaRecodeds = RedisUtil.getInstence().lGet(RedisKey.CHAMPION_FINAL32_JOIN_IDS, "", start, end);
finalmemberOfTeam.forEach((k,v)->{
v.forEach(memberId->{
memberPerOfTeam.put(memberId,k);
});
});
}else{
arenaRecodeds = RedisUtil.getInstence().lGet(RedisKey.CHAMPION_FINAL4_JOIN_IDS, "", 0, -1);
arenaRecodeds = RedisUtil.getInstence().lGet(RedisKey.CHAMPION_FINAL4_JOIN_IDS, "", start, end);
}
List<Object> arenaIds = new ArrayList<>(arenaRecodeds);
List<ArenaRecord> arenaRecords = RedisUtil.getInstence().getMapEntrys(RedisKey.CHAMPION_ARENA_RECORD, "", arenaIds, ArenaRecord.class);
ArenaInfoProto.ChampionViewFinalResponse.Builder builder = ArenaInfoProto.ChampionViewFinalResponse.newBuilder();
String selectIdForRedis = ChampionshipLogic.getSelectIdForRedis();
for (ArenaRecord arenaRecord : arenaRecords) {
if(arenaRecord.getTurn()==-1){
continue;
}
int attackId = arenaRecord.getAttackId();
int defUid = arenaRecord.getDefUid();
System.out.println("attackId = " + attackId+"defUid = " + defUid);
int fightResult = arenaRecord.getFightResult();
if (arenaRecord.getRoundTims() == roundTimes && progress % 10 % 4 != 3) {
fightResult = -1;
if(schedule==1){
if(arenaRecord.getRoundTims() == roundTimes&&(fightResult == -2 || !(progress % 10 == 3))){
fightResult = -1;
}
}else {
if ((realTimes+7) == arenaRecord.getRoundTims() && (fightResult == -2 || !(progress % 10 == 3))) {
fightResult = -1;
}
}
if(fightResult == -2){
fightResult = -1;
}
@ -73,9 +97,19 @@ public class ChampionViewFinalHandler extends BaseHandler<ArenaInfoProto.Champio
teamId = memberPerOfTeam.get(attackId) +1;
}
int isGuess = 0;
if(arenaRecord.getId().equals(selectIdForRedis)){
isGuess = 1;
if(schedule==1){
if(arenaRecord.getId().equals(selectIdForRedis)){
isGuess = 1;
}
}else {
if(arenaRecord.getTurn() ==1&&progress%10 ==1&&arenaRecord.getId().equals(selectIdForRedis)){
isGuess = 1;
}
}
// if(progress%10 ==1&&arenaRecord.getId().equals(selectIdForRedis)){
// isGuess = 1;
// }
builder.addChampionBattlePairInfo(CommonProto.ChampionBattlePairInfo.newBuilder()
.setAttackInfo(ChampionshipLogic.getChampionBattleInfo(attackId))
@ -87,7 +121,11 @@ public class ChampionViewFinalHandler extends BaseHandler<ArenaInfoProto.Champio
.setIsGUess(isGuess)
.setPosition(arenaRecord.getNums()+1)
);
}
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.CHAMPION_VIEW_FINAL_RESPONSE_VALUE,builder.build(),true);
}
}

View File

@ -15,7 +15,7 @@ public enum ReportEventEnum {
CREATE_ACCOUNT(1,"create_account", new CreateRoleEventHandler(),new String[]{""}),
APP_LOGIN(2,"app_login", new LoginEventHandler(),new String[]{""}),
CREATE_ROLE(3,"create_role", new CreateRoleEventHandler(),new String[]{"role_name"}),
GUILD(4,"guild", new CommonEventHandler(),new String[]{"step_id","step_name","rewards_list","guild_start_time"}),
// GUIDE(4,"guide", new CommonEventHandler(),new String[]{"step_id"}),
LEVEL_UP(5,"level_up", new UserLevelUpEventHandler(),new String[]{"level","promotion_level","improved_level"}),
MISSION_START(6,"mission_start", new CommonEventHandler(),new String[]{"mission_id","mission_name"}),
MISSION_COMPLETE(7,"mission_complete", new CommonEventHandler(),new String[]{"mission_id","mission_name","reward_list","mission_start_time"}),
@ -45,7 +45,6 @@ public enum ReportEventEnum {
ALLOW_FRIENDS_ASK(31,"allow_friends_ask", new CommonEventHandler(),new String[]{"target_id","target_name","target_level","entrance"}),
SEND_MESSAGE(32,"send_message", new CommonEventHandler(),new String[]{"message_type","message_content"}),
OPEN_MAIL(33,"open_mail", new CommonEventHandler(),new String[]{""}),
GUIDE(34,"guide", new CommonEventHandler(),new String[]{"step_id"}),
VIP_LEVEL_UP(100,"", new VipLevelUpEventHandler(),new String[]{""});

View File

@ -1,5 +1,6 @@
package com.ljsd.jieling.logic;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.network.session.ISession;
import org.springframework.data.redis.support.collections.DefaultRedisMap;
@ -15,6 +16,10 @@ public class OnlineUserManager {
public static Map<Integer, ISession> sessionMap = new ConcurrentHashMap<>();
public static void checkOnline(){
UserManager.checkOffline();
}
public static void userOffline(int uid) {
sessionMap.remove(uid);

View File

@ -71,7 +71,8 @@ public class BloodLogic {
heroAttributeMap = CombatLogic.getInstance().bufferOneHeroAttrAfterEat(heroAttributeMap,buffInfo[i]);
}
}
heroAllAttribute.put(heroInfo.getHeroId(), new FamilyHeroInfo(hero.getTemplateId(), hero.getLevel(),hero.getStar(), heroAttributeMap));
int position = heroInfo.getPosition();
heroAllAttribute.put(heroInfo.getHeroId(), new FamilyHeroInfo(hero.getTemplateId(), hero.getLevel(),hero.getStar(), heroAttributeMap,position));
}
return heroAllAttribute;
}
@ -117,7 +118,7 @@ public class BloodLogic {
.setUnitId(Integer.toString(entry.getValue().getTempleteId()))
.setUnitSkillIds(heroSkill)//.substring(0, heroSkill.length() - 1)
.setProperty(property.substring(0, property.length() - 1))
.setPosition(++index)
.setPosition(entry.getValue().getPosition())
.setStar(entry.getValue().getStar())
.build();
heroDefendFightInfos.add(heroFightInfo);

View File

@ -14,8 +14,6 @@ public class ArenaRecord {
private int attackForce; //战力
private byte[] fightData;
private int createTime;
private int fightResult = -2; //表示进行中
@ -26,6 +24,10 @@ public class ArenaRecord {
private int nums =1;
private int turn =1;
private byte[] fightData;
public ArenaRecord(){}
public int getAttackId() {
@ -115,4 +117,12 @@ public class ArenaRecord {
public void setNums(int nums) {
this.nums = nums;
}
public int getTurn() {
return turn;
}
public void setTurn(int turn) {
this.turn = turn;
}
}

View File

@ -9,6 +9,7 @@ public class FamilyHeroInfo {
private int level;
private int star;
private Map<Integer,Integer> attribute;
private int position;
public int getTempleteId() {
return templeteId;
@ -38,7 +39,24 @@ public class FamilyHeroInfo {
this.attribute = attribute;
}
public FamilyHeroInfo(int templeteId, int level, int star,Map<Integer, Integer> attribute) {
public int getPosition() {
return position;
}
public void setPosition(int position) {
this.position = position;
}
public FamilyHeroInfo(int templeteId, int level, int star, Map<Integer, Integer> attribute, int position) {
this.templeteId = templeteId;
this.level = level;
this.star = star;
this.attribute = attribute;
this.position = position;
}
public FamilyHeroInfo(int templeteId, int level, int star, Map<Integer, Integer> attribute) {
this.templeteId = templeteId;
this.level = level;
this.attribute = attribute;

View File

@ -9,6 +9,7 @@ import com.ljsd.jieling.ktbeans.KtEventUtils;
import com.ljsd.jieling.ktbeans.ReportEventEnum;
import com.ljsd.jieling.ktbeans.ReportUtil;
import com.ljsd.jieling.ktbeans.parmsBean.ParamEventBean;
import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.activity.ActivityLogic;
import com.ljsd.jieling.logic.activity.event.NewWelfareEvent;
import com.ljsd.jieling.logic.activity.event.NewWelfareTypeEnum;
@ -17,31 +18,60 @@ import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.network.server.SessionManager;
import com.ljsd.jieling.util.ItemUtil;
import config.SGameSetting;
import config.SPlayerLevelConfig;
import manager.STableManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import util.TimeUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
public class UserManager {
private static final Logger LOGGER = LoggerFactory.getLogger(UserManager.class);
private static Map<Integer, User> userMap = new ConcurrentHashMap<>();
private static Map<Integer,Long> userMapPutTime = new ConcurrentHashMap<>(); //离线读入
public static void addUser(User user) {
userMap.put(user.getId(), user);
userMapPutTime.put(user.getId(),TimeUtils.now());
}
public static boolean isUserExist(int uid) {
return userMap.containsKey(uid);
}
//离线清除逻辑
public static void checkOffline(){
try {
Set<User> collect = userMap.entrySet().stream().filter(integerUserEntry -> !OnlineUserManager.checkUidOnline(integerUserEntry.getKey())).map(Map.Entry::getValue).collect(Collectors.toSet());
long l = System.currentTimeMillis();
collect.forEach(integerUserEntry -> {
long offLineTime = integerUserEntry.getPlayerInfoManager().getOffLineTime();
if(offLineTime<integerUserEntry.getPlayerInfoManager().getOnlineTime()){
return;
}
if(l-offLineTime>7*60*1000&& userMapPutTime.getOrDefault(integerUserEntry.getId(),0L)>7*60*100){
userMap.remove(integerUserEntry.getId());
userMapPutTime.remove(integerUserEntry.getId());
}
});
}catch (Exception e){
LOGGER.error(e.toString());
}
}
public static User userLogin(int uid,String openId,String channel,int pid,int gid,String platform,String ip,String channle_id,String bundle_id) throws Exception {
User user = null;
if (!UserManager.isUserExist(uid)){
user = MongoUtil.getInstence().getMyMongoTemplate().findById(User.getCollectionName(), uid, User.class);
@ -138,7 +168,7 @@ public class UserManager {
if(canNull){
return null;
}
throw new Exception("UserManager::getUser null exception");
throw new Exception("UserManager::getUser null exception"+uid);
}
UserManager.addUser(user);
return user;

View File

@ -21,6 +21,7 @@ import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.mail.MailLogic;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.store.BuyGoodsLogic;
import com.ljsd.jieling.logic.store.StoreLogic;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.protocols.CommonProto;
@ -85,7 +86,7 @@ public class ExpeditionLogic {
ExpeditionManager manager = user.getExpeditionManager();
TimeControllerOfFunction openTimeOfFuntionCacheByType = GlobalDataManaager.getInstance().getOpenTimeOfFuntionCacheByType(FunctionIdEnum.Expedition);
checkAndResetTreasure(user);
if(openTimeOfFuntionCacheByType==null||manager.getCurrentTime()==openTimeOfFuntionCacheByType.getTimes()){
return;
}
@ -104,7 +105,6 @@ public class ExpeditionLogic {
// manager.clearEquip();
manager.getEffectItems().clear();
manager.setFreshTime((int)(openTimeOfFuntionCacheByType.getStartTime()/1000));
checkAndResetTreasure(user);
SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(FunctionIdEnum.Expedition.getFunctionType());
SExpeditionSetting sExpeditionSetting = STableManager.getConfig(SExpeditionSetting.class).get(1);
@ -315,7 +315,13 @@ public class ExpeditionLogic {
int minFoce = sExpeditionSetting.getMatchForce()[leve-1][0];
int manFoce = sExpeditionSetting.getMatchForce()[leve-1][1];
int standerFoce = (int) (user.getPlayerInfoManager().getMaxForce() * ((minFoce / 10000f) + ((float) nodeInfo.getLay()) / size * ((float) (manFoce - minFoce)/10000f)));
float v = user.getPlayerInfoManager().getMaxForce() * ((minFoce / 10000f));
System.out.println("v = " + v);
float v1 = (minFoce / 10000f) + ((float) nodeInfo.getLay()) / 11 * ((float) (manFoce - minFoce) / 10000f);
System.out.println("v1 = " + v1);
int standerFoce = (int) (user.getPlayerInfoManager().getMaxForce() * ((minFoce / 10000f) + ((float) nodeInfo.getLay()) / 11 * ((float) (manFoce - minFoce)/10000f)));
float randomForce = (standerFoce * ((sExpeditionSetting.getMatchForceRange()[0] + (int) (Math.random() * (sExpeditionSetting.getMatchForceRange()[1] - sExpeditionSetting.getMatchForceRange()[0]))) / 10000f));
if(nodeInfo.getType()==NODETYPE_ADVANCE){
@ -325,7 +331,7 @@ public class ExpeditionLogic {
}
Set<ZSetOperations.TypedTuple<String>> typedTuples = RedisUtil.getInstence().rangeByScoreWithScores(RedisKey.AREDEF_TEAM_FORCE_RANK, "", 0, randomForce);
if (typedTuples.size() == 0) {
// if (typedTuples.size() == 0) {
//战力没有获取到 从机器人中选
// Set<Integer> set = ArenaLogic.randomRobot(SArenaSetting.getSArenaSetting().getScore(), 1);
//// if (set.size() == 0) {
@ -336,10 +342,10 @@ public class ExpeditionLogic {
int robotId= SArenaRobotStaticConfig.getFloorForce2robotId((int)randomForce);
SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(robotId);
snapOneFightInfo(nodeInfo, sArenaRobotConfig);
} else {
String serarchIdFromRank = typedTuples.iterator().next().getValue();
snapOneFightInfo(user, nodeInfo, Integer.valueOf(serarchIdFromRank));
}
// } else {
// String serarchIdFromRank = typedTuples.iterator().next().getValue();
// snapOneFightInfo(user, nodeInfo, Integer.valueOf(serarchIdFromRank));
// }
}
if(nodeInfo.getType()==ExpeditionLogic.NODETYPE_GREED||nodeInfo.getType() ==ExpeditionLogic.NODETYPE_TRY){
@ -767,46 +773,18 @@ public class ExpeditionLogic {
}
}
public static void checkAndResetTreasure(User user){
public static void checkAndResetTreasure(User user) throws Exception {
WorldTreasureReward worldTreasureReward = user.getExpeditionManager().getWorldTreasureReward();
int createTime =worldTreasureReward.getCreateTime();
if(createTime==0){
return;
}
// SExpeditionSetting sExpeditionSetting = STableManager.getConfig(SExpeditionSetting.class).get(1);
// int[][] treasureTime = sExpeditionSetting.getTreasureTime();
// int differentDays = TimeUtils.differentDays(createTime * 1000, TimeUtils.now());
// int sumPeriod = 0;
// int newRound = 0;
// int round = worldTreasureReward.getRound();
// boolean needReset = false;
// for(int[] item : treasureTime){
// sumPeriod+=item[1];
// if(round>item[0]){
// continue;
// }
// differentDays-=item[1];
// if(differentDays<0){
// newRound = item[0];
// needReset =true;
// break;
// }
// }
// if(!needReset){
// differentDays=differentDays % sumPeriod;
// for(int[] item : treasureTime){
// differentDays-=item[1];
// if(differentDays<0){
// newRound = item[0];
// break;
// }
// }
// needReset=true;
// }
//重置
if(TimeUtils.nowInt()>=worldTreasureReward.getCreateTime()){
user.getExpeditionManager().resetTreasureReward(1);
sendAllTreasureInfo(user);
BuyGoodsLogic.sendGiftGooodsIndication(user.getId());
user.getPlayerInfoManager().getRechargeInfo().updateBuyGoodsTimes(106,0);
}
}
@ -819,15 +797,16 @@ public class ExpeditionLogic {
Map<Integer, Set<SWorldBossTreasureConfig>> idsByPeriods = worldBossTreasureStaticConfig.getIdsByPeriods();
Map<Integer,Integer> changeStateMap = new HashMap<>(rewardStatusMap);
idsByPeriods.get(worldTreasureReward.getRound()).forEach(item->changeStateMap.putIfAbsent(item.getId(),0));
sendTreasureRewardUpdate(session,0,changeStateMap);
sendTreasureRewardUpdate(session,0,changeStateMap,worldTreasureReward.getCreateTime());
}
}
public static void sendTreasureRewardUpdate(ISession iSession,int score,Map<Integer,Integer> changeStatusMap ){
public static void sendTreasureRewardUpdate(ISession iSession,int score,Map<Integer,Integer> changeStatusMap,int time){
Expedition.TreasureStateIndicaion.Builder builder = Expedition.TreasureStateIndicaion.newBuilder().setScore(score);
builder.setResetTime(time);
changeStatusMap.forEach((id,status)-> builder.addTreasureRewardState(Expedition.TreasureRewardState.newBuilder().setId(id).setState(status).build()));
MessageUtil.sendMessage(iSession,1, MessageTypeProto.MessageType.EXPEDITION_TREASURE_STATE_INDICATION_VALUE,builder.build(),true);
MessageUtil.sendIndicationMessage(iSession,1, MessageTypeProto.MessageType.EXPEDITION_TREASURE_STATE_INDICATION_VALUE,builder.build(),true);
}

View File

@ -15,17 +15,51 @@ public class AreFightPro implements EndFightProcessor {
public void endfightProcess(FightResult fightResult) {
int result = fightResult.getCheckResult()[0];
arenaRecord.setFightResult(fightResult.getCheckResult()[0]);
int winnerUid = arenaRecord.getAttackId();
int failerUid = arenaRecord.getDefUid();
if(result == 0){
winnerUid = arenaRecord.getDefUid();
failerUid = arenaRecord.getAttackId();
if(ChampionshipLogic.getSchedule()==2){
String key = String.valueOf(arenaRecord.getAttackId() * 2222 + String.valueOf(arenaRecord.getDefUid()));
//胜负结果出了之后 选择一局记分
boolean jump=false;
Integer state = RedisUtil.getInstence().getMapValue(RedisKey.CHAMPION_ARENA_RECORD_THREE, "", key, Integer.class);
if(null ==state){
state=0;
}else if(state<2){
if(arenaRecord.getTurn()==3){
arenaRecord.setTurn(-1);
}
jump =true;
}
if(!jump){
if(result==1){
if(state==0){
state=2;
}else if(state==3){
state=5;
}else {
state=result;
}
}else {
if(state==0){
state=3;
}else if(state==2){
state=4;
}else{
state=result;}
}
System.out.println("keykeykeykeykeykeykey"+key+": "+arenaRecord.getId()+": "+arenaRecord.getTurn()+" : "+arenaRecord.getAttackId()+"AreFightPro state = " + state);
RedisUtil.getInstence().putMapEntry(RedisKey.CHAMPION_ARENA_RECORD_THREE,"",key,state);
}
}
ChampionshipLogic.setScoreForSuccess(winnerUid,failerUid);
int warTime = STableManager.getFigureConfig(CommonStaticConfig.class).getsChampionshipSetting().getWarTime();
CommonProto.FightData build = CommonProto.FightData.newBuilder().setFightType(9).setHeroFightInfos(fightResult.getFightTeamInfo()).addMonsterList(fightResult.getDefFightTeamInfo()).setFightSeed(fightResult.getSeed()).setFightMaxTime(warTime).build();
arenaRecord.setFightData(build.toByteArray());
RedisUtil.getInstence().putMapEntry(RedisKey.CHAMPION_ARENA_RECORD,"",arenaRecord.getId(),arenaRecord);
}
public ArenaRecord getArenaRecord() {

View File

@ -828,9 +828,9 @@ public class CombatLogic {
propertiesMap.put(propertyName,propertiesMap.getOrDefault(propertyName,0)+1);
}
propertiesMap = sortByValueDescending(propertiesMap);
for(Map.Entry<Integer,Integer> entry :propertiesMap.entrySet()){
LOGGER.info("{}系类型数量为{}",entry.getKey(),entry.getValue());
}
// for(Map.Entry<Integer,Integer> entry :propertiesMap.entrySet()){
// LOGGER.info("{}系类型数量为{}",entry.getKey(),entry.getValue());
// }
int[] normalProperties = new int[6];
//普通属性判断
int nomalIndex = 0;
@ -854,7 +854,7 @@ public class CombatLogic {
user.getTeamPosManager().updateTeamPos(teamId, new int[0][]);
return null;
}
LOGGER.info("触发光环的ID为{}",elementId);
// LOGGER.info("触发光环的ID为{}",elementId);
int[][] resultElement = configMap.get(elementId).getContent();
user.getTeamPosManager().updateTeamPos(teamId, resultElement);
return resultElement;

View File

@ -40,7 +40,8 @@ public class FightDispatcher {
//fight - gs
public static void dispatcherAsyncToGs(FightResult fightResult) throws Exception {
map.get(fightResult.getId()).endfightProcess(fightResult);
EndFightProcessor remove = map.remove(fightResult.getId());
remove.endfightProcess(fightResult);
}
public static long getFIghtId(){

View File

@ -138,7 +138,14 @@ public class FightUtil {
}
LuaValue getFightData = FightDataUtil.getFinalPlayerFightData(fightTeamInfo, deffightTeamInfo);
LuaValue getFightData ;
if(((PVPFightEvent) fightEvent).isRever()){
deffightTeamInfo = CommonProto.FightTeamInfo.newBuilder().mergeFrom(deffightTeamInfo).setFirstCamp(1).build();
getFightData = FightDataUtil.getFinalPlayerFightData(fightTeamInfo, deffightTeamInfo,true);//对方先手
}else {
getFightData = FightDataUtil.getFinalPlayerFightData(fightTeamInfo, deffightTeamInfo);
}
LuaValue getOptionData = FightDataUtil.getOptionData(fightEvent.getFrames());
int[] fightResult = CheckFight.getInstance().checkFight(fightSeed, fightEvent.getMostTime(), getFightData, getOptionData, fightEvent.getFightType().getFightType());

View File

@ -3,6 +3,7 @@ package com.ljsd.jieling.logic.fight;
public class PVPFightEvent extends FightEvent {
private int defUid;
private int defTeamId;
private boolean rever; //反转先后手
@ -40,4 +41,12 @@ public class PVPFightEvent extends FightEvent {
public void setAttackFightSnapData(DefFightSnapData attackFightSnapData) {
this.attackFightSnapData = attackFightSnapData;
}
public boolean isRever() {
return rever;
}
public void setRever(boolean rever) {
this.rever = rever;
}
}

View File

@ -2338,10 +2338,11 @@ public class HeroLogic{
int templateId = hero.getTemplateId();
int star = hero.getStar();
Map<Integer, SHeroReturn> sHeroReturnMap = SHeroReturn.sheroReturnMap.get(templateId);
if(sHeroReturnMap == null || !sHeroReturnMap.containsKey(breakId)){
int breakFloor = breakId==0?0:STableManager.getConfig(SCHeroRankUpConfig.class).get(breakId).getPhase()[1];
if(sHeroReturnMap == null || !sHeroReturnMap.containsKey(breakFloor)){
throw new ErrorCodeException(ErrorCode.newDefineCode("not satisfy"));
}
SHeroReturn sHeroReturn = sHeroReturnMap.get(breakId);
SHeroReturn sHeroReturn = sHeroReturnMap.get(breakFloor);
boolean b = ItemUtil.itemCost(user, sHeroReturn.getReturnConsume(), BIReason.HERO_BACK_CONSUME, templateId * 100 + star);
if(!b){
throw new ErrorCodeException(ErrorCode.HERO_ITEM_NOT);

View File

@ -383,7 +383,9 @@ public class ItemLogic {
heroManager.removeHero(uid,heroId);
int[][] sumConsume = SHeroLevlConfig.getsHeroLevlConfigMap().get(hero.getLevel()).getSumConsume();
SHeroSacrifice starSHeroSacrifice = STableManager.getFigureConfig(HeroStaticConfig.class).getsHeroSacrificeMap(1, hero.getStar());
SHeroSacrifice breakSHeroSacrifice = STableManager.getFigureConfig(HeroStaticConfig.class).getsHeroSacrificeMap(2, hero.getBreakId());
int breakFloor = hero.getBreakId()==0?0:STableManager.getConfig(SCHeroRankUpConfig.class).get(hero.getBreakId()).getPhase()[1];
SHeroSacrifice breakSHeroSacrifice = STableManager.getFigureConfig(HeroStaticConfig.class).getsHeroSacrificeMap(2, breakFloor);
for(int[] item:sumConsume){
baseItemMap.put(item[0],baseItemMap.getOrDefault(item[0],0)+item[1]);
}

View File

@ -8,8 +8,9 @@ public class LuckyWheelTimesManager implements BaseDataManager{
@Override
public CumulationData.Result updateData(CumulationData data, MissionType missionType, Object... parm) {
int type = (int) parm[0];
int mum = (int)parm[1];
type = type == BIReason.LUCK_WHEEL?1:2;
data.luckyWheelTimes.put(type,data.luckyWheelTimes.getOrDefault(type,0)+1);
data.luckyWheelTimes.put(type,data.luckyWheelTimes.getOrDefault(type,0)+mum);
return new CumulationData.Result(missionType);
}
}

View File

@ -104,9 +104,9 @@ public class PlayerLogic {
int uid = session.getUid();
User user = UserManager.getUser(uid);
user.getPlayerInfoManager().updateGuidePoint(type,id);
if(type==1){
ReportUtil.onReportEvent(user,ReportEventEnum.GUILD.getType(),String.valueOf(id));
}
// if(type==1){//打点改为前端
// ReportUtil.onReportEvent(user,ReportEventEnum.GUIDE.getType(),String.valueOf(id));
// }
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.SAVE_NEW_PLAYER_GUIDE_POINT_RESPONSE_VALUE,null,true);
}

View File

@ -357,20 +357,20 @@ public class BuyGoodsLogic {
// Poster.getPoster().dispatchEvent(new NewWelfareEvent(user, NewWelfareTypeEnum.RECHARGE_BUY.getType(),goodsId));
MongoUtil.getLjsdMongoTemplate().lastUpdate();
sendGiftGooodsIndication(uid);
onChargeSuccess(uid,sRechargeCommodityConfig.getPrice(),0);//充值成功上报
onChargeSuccess(uid,sRechargeCommodityConfig.getPrice(),0,orderId);//充值成功上报
Map<Integer, Integer> mapReward = ItemUtil.arrayToMap(baseReward);
ReportUtil.onReportEvent(user, ReportEventEnum.ORDER_COMPLETE.getType(),orderId,price,user.getPlayerInfoManager().getBundle_id(),user.getPlayerInfoManager().getChannel_id(),String.valueOf(GameApplication.serverId),String.valueOf(goodsId),sRechargeCommodityConfig.getName(),mapReward.keySet(),mapReward.values());
return resultRes;
}
private static void onChargeSuccess(int uid,int amount,int virtualAmount){
private static void onChargeSuccess(int uid,int amount,int virtualAmount,String orderId){
RechargeEvent rechargeEvent = new RechargeEvent();
rechargeEvent.setModule("GameAnalysis");
rechargeEvent.setIp("");
rechargeEvent.setName("charge");
rechargeEvent.setIndex("wjtsq7xrwb48t2uw");
rechargeEvent.setIdentify(String.valueOf(uid));
rechargeEvent.setProperties(new RechargeEventProp("",amount,virtualAmount,"CNY","",""));
rechargeEvent.setProperties(new RechargeEventProp(orderId,amount,virtualAmount,"CNY","",""));
String s = DataMessageUtils.sendRechargePost(rechargeEvent);
if(s.equals("1")){
LOGGER.info("{}充值上报成功,价格为{}",uid,amount);

View File

@ -88,6 +88,7 @@ public class MinuteTask extends Thread {
DeathPathLogic.getInstance().statusCheck();
GuildFightLogic.minuteCheckForCarFight();
reportUserOnline();
OnlineUserManager.checkOnline();
LOGGER.info("MinuteTask end...");
} catch (Exception e) {
LOGGER.error("e",e);

View File

@ -46,11 +46,15 @@ public class FightDataUtil {
}
public static LuaValue getFinalPlayerFightData(CommonProto.FightTeamInfo heroTeam, CommonProto.FightTeamInfo enemyHeroTeam) {
return getFinalPlayerFightData(heroTeam,enemyHeroTeam,false);
}
public static LuaValue getFinalPlayerFightData(CommonProto.FightTeamInfo heroTeam, CommonProto.FightTeamInfo enemyHeroTeam,boolean firstCamp) {
LuaValue LuaTable = new LuaTable();
LuaTable.set("playerData", getPlayerData(heroTeam,0));
LuaValue enemyData = new LuaTable();
enemyData.rawset( 1, getPlayerData(enemyHeroTeam,1));
enemyData.rawset( 1, getPlayerData(enemyHeroTeam,1,firstCamp));
LuaTable.set("enemyData", enemyData);
return LuaTable;
@ -168,8 +172,11 @@ public class FightDataUtil {
return property;
}
public static LuaValue getPlayerData(CommonProto.FightTeamInfo heroTeam,int position) {
return getPlayerData(heroTeam, position,false);
}
public static LuaValue getPlayerData(CommonProto.FightTeamInfo heroTeam,int position,boolean first) {
LuaValue playerData = new LuaTable();
for (int i = 1; i <= heroTeam.getFightUnitListCount(); i++) {
playerData.rawset(i, getHeroFightUnit(heroTeam.getFightUnitList(i - 1),position));
@ -177,6 +184,7 @@ public class FightDataUtil {
playerData.set("teamSkill", getTeamSkill(heroTeam.getTeamSkillList()));
playerData.set("teamPassive", getTeamPassive(heroTeam.getTeamPassiveList()));
playerData.set("outData",heroTeam.getSpecialPassive());
playerData.set("firstCamp",first?1:0);
return playerData;
}

View File

@ -29,6 +29,8 @@ public class SCHeroRankUpConfig implements BaseConfig{
private int judgeClass;
private int[] phase;
@Override
public void init() throws Exception {
}
@ -79,4 +81,8 @@ public class SCHeroRankUpConfig implements BaseConfig{
public int[][] getSumConsume() {
return sumConsume;
}
public int[] getPhase() {
return phase;
}
}