zhangshanxue 2020-08-17 02:42:05 +08:00
commit 7dd7e0523e
43 changed files with 1445 additions and 760 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

@ -0,0 +1,80 @@
package com.ljsd.jieling.chat;
/**
* @author lvxinran
* @date 2020/7/22
* @discribe
*/
public class ChatRedisEntity {
private int uid;
private String name;
private int type;
private String message;
private Long time;
private int status;
public ChatRedisEntity(){};
public ChatRedisEntity(int uid, String name, int type, String message, Long time, int status) {
this.uid = uid;
this.name = name;
this.type = type;
this.message = message;
this.time = time;
this.status = status;
}
public int getUid() {
return uid;
}
public void setUid(int uid) {
this.uid = uid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Long getTime() {
return time;
}
public void setTime(Long time) {
this.time = time;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}

View File

@ -1,7 +1,9 @@
package com.ljsd.jieling.chat.logic;
import com.google.gson.Gson;
import com.ljsd.GameApplication;
import com.ljsd.jieling.chat.ChatRedisEntity;
import com.ljsd.jieling.chat.messge.MessageCache;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.dataReport.reportBeans_37.ChatContentType;
@ -27,6 +29,7 @@ import com.ljsd.jieling.util.CBean2Proto;
import com.ljsd.jieling.util.MessageUtil;
import com.ljsd.jieling.util.SensitivewordFilter;
import com.ljsd.jieling.util.ShieldedWordUtils;
import util.TimeUtils;
import java.util.ArrayList;
import java.util.List;
@ -42,6 +45,8 @@ public class ChatLogic {
return ChatLogic.Instance.instance;
}
private Gson gson = new Gson();
/**
*
@ -196,10 +201,24 @@ public class ChatLogic {
break;
}
onSendChatSuccess(user,chatType,message);
ReportUtil.onReportEvent(user, ReportEventEnum.SEND_MESSAGE.getType(),String.valueOf(chatType),message);
MessageUtil.sendMessage(iSession, 1, msgId, null, true);
}
//记录聊天信息
private void onSendChatSuccess(User user,int chatType,String message){
RedisUtil redisUtil = RedisUtil.getInstence();
String key = RedisKey.getKey(RedisKey.CHAT_INFO_CACHE, String.valueOf(chatType), false);
ChatRedisEntity chatRedisEntity = new ChatRedisEntity(user.getId(), user.getPlayerInfoManager().getNickName(), chatType, message, TimeUtils.now(), user.getPlayerInfoManager().getSilence());
String chatInfo = gson.toJson(chatRedisEntity);
long l = redisUtil.lGetListSize(key);
if(l>1000){
redisUtil.lPop(key);
}
redisUtil.lSet(key,chatInfo);
}
/**
*

View File

@ -2,6 +2,7 @@ package com.ljsd.jieling.config.clazzStaticCfg;
import com.ljsd.jieling.core.GlobalsDef;
import config.SCHeroRankUpConfig;
import config.SHeroSacrifice;
import config.SLotterySetting;
import manager.AbstractClassStaticConfig;
import manager.STableManager;
@ -19,6 +20,7 @@ public class HeroStaticConfig extends AbstractClassStaticConfig {
private Map<Integer, Map<Integer, Map<Integer, SCHeroRankUpConfig>>> scHeroRankUpConfigByShow;
private Map<Integer, Map<Integer, Map<Integer, SCHeroRankUpConfig>>> scHeroRankUpConfigByType;
private Map<Integer,Map<Integer, SHeroSacrifice>> sHeroSacrificeMap;
private Set<Integer> randomHeroIds;
private Map<Integer,Integer> randomPoolByType;
@ -69,6 +71,12 @@ public class HeroStaticConfig extends AbstractClassStaticConfig {
}
scHeroRankUpConfigByShow = result;
scHeroRankUpConfigByType = calc;
Map<Integer,Map<Integer, SHeroSacrifice>> sHeroSacrificeMapTemp = new HashMap<>();
Map<Integer, SHeroSacrifice> sHeroSacrificeConfig = STableManager.getConfig(SHeroSacrifice.class);
for(SHeroSacrifice sacrificeconfig:sHeroSacrificeConfig.values()){
sHeroSacrificeMapTemp.computeIfAbsent(sacrificeconfig.getType(),n->new HashMap<>()).put(sacrificeconfig.getKey(),sacrificeconfig);
}
sHeroSacrificeMap = sHeroSacrificeMapTemp;
} catch (Exception e) {
LOGGER.error("SCHeroRankUpConfig init fail");
@ -98,6 +106,10 @@ public class HeroStaticConfig extends AbstractClassStaticConfig {
return scHeroRankUpConfigByType.get(type).get(heroInitStar);
}
public SHeroSacrifice getsHeroSacrificeMap(int type,int param) {
return sHeroSacrificeMap.get(type).get(param);
}
public Set<Integer> getRandomHeroIds() {
return randomHeroIds;
}

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";
@ -266,6 +269,7 @@ public class RedisKey {
public final static String USER_LEVEL_GUILD_INFO = "USER_LEVEL_GUILD_INFO"; //车迟玩法挑战记录
public static final String CHAT_INFO_CACHE = "CHAT_INFO_CACHE";//聊天信息缓存gm后台使用

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

@ -85,18 +85,20 @@ public class LoginRequestHandler extends BaseHandler<PlayerInfoProto.LoginReques
int pid = 0;
int gid = 0;
String channle_id = "";
String bundle_id = "";
String channelS = loginRequest.getChannelS();
String[] splitChannelS = channelS.split("#");
if(splitChannelS.length==1){
if(!StringUtil.isEmpty(splitChannelS[0])){
pid = Integer.valueOf(splitChannelS[0]);
}
// if(!StringUtil.isEmpty(splitChannelS[0])){
// pid = Integer.valueOf(splitChannelS[0]);
// }
}else if (splitChannelS.length>=2){
if(!StringUtil.isEmpty(splitChannelS[0])){
pid = Integer.valueOf(splitChannelS[0]);
channle_id = splitChannelS[0];
}
if(!StringUtil.isEmpty(splitChannelS[1])){
gid = Integer.valueOf(splitChannelS[1]);
bundle_id = splitChannelS[1];
}
}
@ -123,10 +125,10 @@ public class LoginRequestHandler extends BaseHandler<PlayerInfoProto.LoginReques
if(split.length>=2){
String openId = split[0];
String chanel = split[1];
user = UserManager.userLogin(userId,openId,chanel,pid,gid);
user = UserManager.userLogin(userId,openId,chanel,pid,gid,loginRequest.getPlatformS(),loginRequest.getIpS(),channle_id,bundle_id);
}else{
user = UserManager.userLogin(userId,openIdFront,"",pid,gid);
}
user = UserManager.userLogin(userId,openIdFront,"",pid,gid,loginRequest.getPlatformS(),loginRequest.getIpS(),channle_id,bundle_id);
// String newToken = UserManager.getNewToken(userId);

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

@ -14,9 +14,9 @@ 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"}),
LEVEL_UP(5,"level_up", new UserLevelUpEventHandler(),new String[]{"promotion_level","improved_level"}),
CREATE_ROLE(3,"create_role", new CreateRoleEventHandler(),new String[]{"role_name"}),
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"}),
JOIN_ACTIVITY(8,"join_activity", new CommonEventHandler(),new String[]{"activity_id","activity_name"}),
@ -39,12 +39,13 @@ public enum ReportEventEnum {
JOIN_GUILD(25,"join_guild", new CommonEventHandler(),new String[]{"guild_id","guild_name","guild_level","guild_people_num","guild_fighting_capacity","guild_create_time"}),
QUIT_GUILD(26,"quit_guild", new CommonEventHandler(),new String[]{"guild_id","guild_name","guild_level","guild_people_num","guild_fighting_capacity","guild_create_time"}),
CREATE_ORDER(27,"create_order", new CommonEventHandler(),new String[]{"order_id","order_money_amount","Bundle_id","entrance","item_id","item_name","goods_id","item_list"}),
ORDER_COMPLETE(28,"order_complete", new ChargeAmountEventHandler(),new String[]{"order_id","order_money_amount","Bundle_id","entrance","item_id","item_name","goods_id","item_list"}),
ORDER_COMPLETE(28,"order_complete", new ChargeAmountEventHandler(),new String[]{"order_id","order_money_amount","Bundle_id","channel_id","server_id","goods_id","goods_name","item_id","item_num"}),
CHECK_RANKING(29,"check_ranking", new CommonEventHandler(),new String[]{"ranking_type"}),
ASK_FOR_BEING_FRIENDS(30,"ask_for_being_friends", new CommonEventHandler(),new String[]{"target_id","target_name","target_level","entrance"}),
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[]{""}),
VIP_LEVEL_UP(100,"", new VipLevelUpEventHandler(),new String[]{""});

View File

@ -1,5 +1,6 @@
package com.ljsd.jieling.ktbeans.reportEvent;
import com.ljsd.GameApplication;
import com.ljsd.jieling.logic.dao.root.User;
import java.util.Date;
@ -20,6 +21,11 @@ public class CreateRoleEventHandler extends CommonEventHandler{
setProperties.put("role_name",user.getPlayerInfoManager().getNickName());
setOnceProperties.put("role_create_time",new Date());
setOnceProperties.put("server_id",String.valueOf(GameApplication.serverId));
setOnceProperties.put("channel_id",user.getPlayerInfoManager().getChannel_id());
setOnceProperties.put("platform_id",user.getPlayerInfoManager().getPlatform());
setOnceProperties.put("reg_ip",user.getPlayerInfoManager().getIp());
userProperties.put(1,setProperties);
userProperties.put(2,setOnceProperties);
return userProperties;

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

@ -22,6 +22,10 @@ public class PlayerManager extends MongoBase {
private int gid;
private String channel_id;
private String bundle_id;
private String nickName;
private int sex;
@ -108,6 +112,11 @@ public class PlayerManager extends MongoBase {
private int luckWheelLimitTime;
private int luckAdvanceWheelLimitTime;
private String platform;
private String ip;
public PlayerManager(){
this.setRootCollection(User._COLLECTION_NAME);
}
@ -727,4 +736,42 @@ public class PlayerManager extends MongoBase {
updateString("luckAdvanceWheelLimitTime",luckAdvanceWheelLimitTime);
this.luckAdvanceWheelLimitTime = luckAdvanceWheelLimitTime;
}
public String getPlatform() {
return platform;
}
public void setPlatform(String platform) {
this.platform = platform;
updateString("platform",platform);
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
updateString("ip",ip);
}
public String getChannel_id() {
return channel_id;
}
public void setChannel_id(String channel_id) {
this.channel_id = channel_id;
updateString("channel_id",channel_id);
}
public String getBundle_id() {
return bundle_id;
}
public void setBundle_id(String bundle_id) {
this.bundle_id = bundle_id;
updateString("bundle_id",bundle_id);
}
}

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,36 +18,65 @@ 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 User userLogin(int uid,String openId,String channel,int pid,int gid) throws Exception {
//离线清除逻辑
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);
if (user == null) {
user = registerUser(uid,openId,channel,pid,gid);
user = registerUser(uid,openId,channel,pid,gid,platform,ip,channle_id,bundle_id);
}
UserManager.addUser(user);
}else{
@ -58,17 +88,17 @@ public class UserManager {
}
private static User registerUser(int uid,String openId,String channel,int pid,int gid) throws Exception {
private static User registerUser(int uid,String openId,String channel,int pid,int gid,String platform,String ip,String channle_id,String bundle_id) throws Exception {
User user = new User(uid);
UserManager.addUser(user);
initPlayer(user,openId,channel,pid,gid);
initPlayer(user,openId,channel,pid,gid,platform,ip,channle_id,bundle_id);
MongoUtil.getInstence().getMyMongoTemplate().save(user);
PlayerLogic.getInstance().sendTestWelfareMail(user,1,1);
ReportUtil.onReportEvent(user, ReportEventEnum.CREATE_ROLE.getType());
return user;
}
private static void initPlayer(User user,String openId,String channel,int pid,int gid) throws Exception {
private static void initPlayer(User user,String openId,String channel,int pid,int gid,String platform,String ip,String channle_id,String bundle_id) throws Exception {
SGameSetting gameSetting = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting();
PlayerManager playerManager = user.getPlayerInfoManager();
long now = TimeUtils.now();
@ -89,6 +119,10 @@ public class UserManager {
playerManager.setChannel(channel);
playerManager.setPid(pid);
playerManager.setGid(gid);
playerManager.setPlatform(platform);
playerManager.setIp(ip);
playerManager.setChannel_id(channle_id);
playerManager.setBundle_id(bundle_id);
playerManager.setHeadFrame(STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getDefaultPicture());
SPlayerLevelConfig sPlayerLevelConfig = SPlayerLevelConfig.getsPlayerLevelConfigMap().get(1);
playerManager.setMaxStamina(sPlayerLevelConfig.getMaxEnergy());
@ -134,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);
@ -767,46 +767,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 +791,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,20 +2338,21 @@ 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);
}
heroManager.removeHero(uid,heroId);
// heroManager.removeHero(uid,heroId);
int[][] returnMaterials = sHeroReturn.getRankupReturn();
SHeroLevlConfig sHeroLevlConfig = SHeroLevlConfig.getsHeroLevlConfigMap().get(hero.getLevel());
int[][] levelReturn = ItemLogic.getInstance().itemReturnPercent(sHeroLevlConfig.getSumConsume(), returnPercent);
int returnHero = sHeroReturn.getHeroId();
// int returnHero = sHeroReturn.getHeroId();
//进阶材料返还乘万分比
Map<Integer,Integer> returnItemMap = new HashMap<>();
for(int i = 0 ; i <returnMaterials.length;i++){
@ -2360,7 +2361,7 @@ public class HeroLogic{
for(int i = 0 ; i <levelReturn.length;i++){
returnItemMap.put(levelReturn[i][0],returnItemMap.getOrDefault(levelReturn[i][0],0)+levelReturn[i][1]);
}
returnItemMap.put(returnHero,1);
// returnItemMap.put(returnHero,1);
int[][] resultDrop = new int[returnItemMap.size()][];
int index = 0;
for(Map.Entry<Integer,Integer> entry:returnItemMap.entrySet()){
@ -2368,12 +2369,14 @@ public class HeroLogic{
index++;
}
CommonProto.Drop.Builder drop = ItemUtil.drop(user, resultDrop, BIReason.HERO_BACK_REWARD);
CommonProto.Hero.Builder heroProto = drop.getHero(0).toBuilder();
String createHeroId = heroProto.getId();
heroProto.setStar(star);
drop.setHero(0,heroProto.build());
Hero newHero = user.getHeroManager().getHeroMap().get(createHeroId);
newHero.setStar(star);
hero.setLevel(user,1);
hero.setBreakId(0);
// CommonProto.Hero.Builder heroProto = drop.getHero(0).toBuilder();
// String createHeroId = heroProto.getId();
// heroProto.setStar(star);
// drop.setHero(0,heroProto.build());
// Hero newHero = user.getHeroManager().getHeroMap().get(createHeroId);
// newHero.setStar(star);
HeroInfoProto.HeroReturnResponse build = HeroInfoProto.HeroReturnResponse.newBuilder().setDrop(drop).build();
MessageUtil.sendMessage(session,1,responseMsgId,build,true);

View File

@ -2,6 +2,7 @@ package com.ljsd.jieling.logic.item;
import com.ljsd.jieling.chat.logic.ChatLogic;
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
import com.ljsd.jieling.config.clazzStaticCfg.HeroStaticConfig;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.globals.BIReason;
@ -367,7 +368,6 @@ public class ItemLogic {
CommonProto.Drop.Builder baseBuilder = CommonProto.Drop.newBuilder();
User user = UserManager.getUser(uid);
HeroManager heroManager = user.getHeroManager();
StringBuilder reward = new StringBuilder();
ErrorCode erroMags = checkHeroResolve(heroIdsList,user);
if (null!=erroMags){
throw new ErrorCodeException(erroMags);
@ -377,46 +377,27 @@ public class ItemLogic {
//1裸角色卡没有突破过的角色卡熔炼后返还的材料=当前等级返还升级材料+item表返还材料
//2有过突破的卡 =当前等级返还升级材料+突破表返还材料
Map<Integer, Integer> baseItemMap = new HashMap<>();
Map<Integer, Integer> baseCardMap = new HashMap<>();
Map<Integer, Integer> baseEquipMap = new HashMap<>();
Map<Integer,Integer> baseRandomMap = new HashMap<>();
int rankUpReturnPercent= SSpecialConfig.getIntegerValue(SSpecialConfig.HERO_SACRIFICE_PERCENT);
for (String heroId : heroIdsList) {
Hero hero = heroManager.getHeroMap().get(heroId);
heroManager.removeHero(uid,heroId);
int[][] sumConsume = SHeroLevlConfig.getsHeroLevlConfigMap().get(hero.getLevel()).getSumConsume();
SHeroSacrifice starSHeroSacrifice = STableManager.getFigureConfig(HeroStaticConfig.class).getsHeroSacrificeMap(1, hero.getStar());
int breakFloor = hero.getBreakId()==0?0:STableManager.getConfig(SCHeroRankUpConfig.class).get(hero.getBreakId()).getPhase()[1];
ItemUtil.combineReward(itemReturnPercent(sumConsume,rankUpReturnPercent),baseItemMap,baseCardMap,baseEquipMap,baseRandomMap);
int breakId = hero.getBreakId();
int starBreakId = hero.getStarBreakId();
if(breakId!=0 || starBreakId!=0){
SCHeroRankUpConfig scHeroRankUpConfig = STableManager.getConfig(SCHeroRankUpConfig.class).get(breakId);
if(scHeroRankUpConfig!=null){
int[][] levelUpReturn = scHeroRankUpConfig.getSumConsume();
ItemUtil.combineReward(itemReturnPercent(levelUpReturn,rankUpReturnPercent),baseItemMap,baseCardMap,baseEquipMap,baseRandomMap);
}
scHeroRankUpConfig = STableManager.getConfig(SCHeroRankUpConfig.class).get(starBreakId);
if(scHeroRankUpConfig!=null){
int[][] levelUpReturn = scHeroRankUpConfig.getSumConsume();
ItemUtil.combineReward(itemReturnPercent(levelUpReturn,rankUpReturnPercent),baseItemMap,baseCardMap,baseEquipMap,baseRandomMap);
}
continue;
SHeroSacrifice breakSHeroSacrifice = STableManager.getFigureConfig(HeroStaticConfig.class).getsHeroSacrificeMap(2, breakFloor);
for(int[] item:sumConsume){
baseItemMap.put(item[0],baseItemMap.getOrDefault(item[0],0)+item[1]);
}
SItem sItem = SItem.getsItemMap().get(hero.getTemplateId());
if(null==filterItem){
if (reward.length() == 0) {
reward = new StringBuilder(sItem.getResolveReward());
} else {
reward.append("#").append(sItem.getResolveReward());
}
for(int[] item:starSHeroSacrifice.getValue()){
baseItemMap.put(item[0],baseItemMap.getOrDefault(item[0],0)+item[1]);
}
for(int[] item:breakSHeroSacrifice.getValue()){
baseItemMap.put(item[0],baseItemMap.getOrDefault(item[0],0)+item[1]);
}
}
ItemUtil.combineReward(user,false, StringUtil.parseFiledInt(reward.toString()),1,baseItemMap,baseCardMap,baseEquipMap,baseRandomMap,-1);
int[][] itemArray = ItemUtil.mapToArray(baseItemMap);
int reson = BIReason.DECOMPOS_HERO_REWARD;
if(null!=filterItem){
reson= BIReason.UPHERO_DECOMPOS_HERO_REWARD;
@ -428,10 +409,7 @@ public class ItemLogic {
}else {
user.getUserMissionManager().onGameEvent(user,GameEvent.DESPOSE_HERO,heroIdsList.size());
}
ItemUtil.drop(user,baseBuilder,baseItemMap,baseCardMap,baseEquipMap,baseRandomMap, reson);
return baseBuilder;
return ItemUtil.drop(user,itemReturnPercent(itemArray,rankUpReturnPercent),reson);
}
/**

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,6 +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.GUIDE.getType(),String.valueOf(id));
}
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.SAVE_NEW_PLAYER_GUIDE_POINT_RESPONSE_VALUE,null,true);
}

View File

@ -1,5 +1,6 @@
package com.ljsd.jieling.logic.store;
import com.ljsd.GameApplication;
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
import com.ljsd.jieling.config.reportData.DataMessageUtils;
import com.ljsd.jieling.core.GlobalsDef;
@ -81,7 +82,6 @@ public class BuyGoodsLogic {
for(int[] item:sRechargeCommodityConfig.getBaseReward()){
itemList.add(item[0]);
}
ReportUtil.onReportEvent(user, ReportEventEnum.ORDER_COMPLETE.getType(),"",price,"","","","",String.valueOf(goodsId),itemList);
// KtEventUtils.onKtEvent(user, ParamEventBean.UserPayEvent,goodsId,System.currentTimeMillis()+"",result.getResultCode(),price*10);
}
@ -352,23 +352,25 @@ public class BuyGoodsLogic {
rechargeInfo.updateRefreshMapByKey(sRechargeCommodityConfig.getId(),TimeUtils.now()+sRechargeCommodityConfig.getDailyUpdate()*TimeUtils.DAY);
}
resultRes.setResultCode(1);
KtEventUtils.onKtEvent(user, ParamEventBean.UserPayEvent,goodsId,orderId,resultRes.getResultCode(),price);
// KtEventUtils.onKtEvent(user, ParamEventBean.UserPayEvent,goodsId,orderId,resultRes.getResultCode(),price);
notifyPaySuccessFul(uid,goodsId,amount != -999);
// 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

@ -672,7 +672,7 @@ public class ItemUtil {
}
playerInfoManager.setExp(curExp);
if (playerInfoManager.getLevel() > oldLevel) {
ReportUtil.onReportEvent(user, ReportEventEnum.LEVEL_UP.getType(),1,playerInfoManager.getLevel());
ReportUtil.onReportEvent(user, ReportEventEnum.LEVEL_UP.getType(),oldLevel,playerInfoManager.getLevel()-oldLevel,playerInfoManager.getLevel());
user.getUserMissionManager().onGameEvent(user, GameEvent.USER_LEVELUP,oldLevel+1,playerInfoManager.getLevel());
}
@ -1463,6 +1463,27 @@ public class ItemUtil {
}
return sourceNum;
}
public static int[][] mapToArray(Map<Integer,Integer> map){
int[][] itemArray = new int[map.size()][];
int i = 0 ;
for(Map.Entry<Integer,Integer> entry:map.entrySet()){
itemArray[i] = new int[]{entry.getKey(),entry.getValue()};
i++;
}
return itemArray;
}
public static Map<Integer,Integer> arrayToMap(int[][] array){
Map<Integer,Integer> map = new HashMap<>(array.length);
for(int[] itemArray:array ){
map.put(itemArray[0],map.getOrDefault(itemArray[0],0)+itemArray[1]);
}
return map;
}
private static int parseTheValueByPrivilegeMap(User user,int sourceNum,int privigeId){
int privigeValue = PlayerLogic.getInstance().getMaxCountByPrivilegeType(user,privigeId);

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;
}
}

View File

@ -0,0 +1,43 @@
package config;
import manager.STableManager;
import manager.Table;
import java.util.Map;
@Table(name ="HeroSacrifice")
public class SHeroSacrifice implements BaseConfig {
private int id;
private int type;
private int key;
private int[][] value;
@Override
public void init() throws Exception {
}
public int getId() {
return id;
}
public int getType() {
return type;
}
public int getKey() {
return key;
}
public int[][] getValue() {
return value;
}
}