Merge branch 'master_test_gn_arena' into dev_dh_cross_rank
# Conflicts: # serverlogic/src/main/java/com/ljsd/GameApplication.java # serverlogic/src/main/java/com/ljsd/jieling/logic/activity/crossService/CrossServiceLogic.javaback_recharge
commit
ca861d0788
|
@ -7,7 +7,10 @@ import com.ljsd.jieling.db.redis.RedisKey;
|
|||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.logic.dao.ServerConfig;
|
||||
import com.ljsd.jieling.logic.family.CrossDeathPathLogic;
|
||||
<<<<<<< HEAD
|
||||
import com.ljsd.jieling.logic.rank.CrossRankManager;
|
||||
=======
|
||||
>>>>>>> master_test_gn_arena
|
||||
import com.ljsd.jieling.network.NetManager;
|
||||
import com.ljsd.jieling.util.ConfigurableApplicationContextManager;
|
||||
import config.SGameSetting;
|
||||
|
|
|
@ -12,11 +12,14 @@ import com.ljsd.jieling.exception.ErrorCode;
|
|||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.ktbeans.ReportEventEnum;
|
||||
import com.ljsd.jieling.ktbeans.ReportUtil;
|
||||
import com.ljsd.jieling.logic.GlobleSystemLogic;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.crossService.CrossServiceLogic;
|
||||
import com.ljsd.jieling.logic.dao.FriendManager;
|
||||
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.gm.ArenaOfUser;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.family.GuildLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
|
@ -30,6 +33,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -93,6 +97,16 @@ public class ChatLogic {
|
|||
RedisUtil.getInstence().del(GameApplication.serverId + RedisKey.CUser_Chat + uid);
|
||||
}
|
||||
break;
|
||||
|
||||
case 4:
|
||||
int group = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
if(group==-1){
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_CHAT_MESSAGE_REPONSE_VALUE, null, true);
|
||||
return;
|
||||
}
|
||||
chatInfoList = MessageCache.getCrossMsg(messageId,String.valueOf(group));
|
||||
|
||||
break;
|
||||
default:{
|
||||
LOGGER.info("getAllChatMessageInfo wrong chatType=>{} uid=>{}", chatType, uid);
|
||||
}
|
||||
|
@ -167,6 +181,9 @@ public class ChatLogic {
|
|||
case 3:
|
||||
result = ShieldedWordUtils.checkName(user,message,false,ChatContentType.PRIVATE_CHAT,UserManager.getUser(friendId));
|
||||
break;
|
||||
case 4:
|
||||
result = ShieldedWordUtils.checkName(user,message,false,ChatContentType.CROSS_CHAT);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -228,6 +245,20 @@ public class ChatLogic {
|
|||
RedisUtil.getInstence().hset(GameApplication.serverId + RedisKey.CUser_Chat + friendId, uid + "#" + nowTime, message, -1);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 4: //跨服
|
||||
int group = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
if(group==-1){
|
||||
throw new ErrorCodeException(ErrorCode.CHAT_NOT_CROSS);
|
||||
}
|
||||
|
||||
messageId = RedisUtil.getInstence().increment( RedisKey.CHAT_CROSS_MSG_ID + group);
|
||||
chatInfo = CBean2Proto.getCrossChatInfoBuilder(user,message,nowTime,messageId);
|
||||
MessageCache.addCrossMsg(chatInfo,messageId,String.valueOf(group));
|
||||
|
||||
checkSaveUser(user);
|
||||
|
||||
break;
|
||||
default: {
|
||||
break;
|
||||
|
@ -238,6 +269,14 @@ public class ChatLogic {
|
|||
MessageUtil.sendMessage(iSession, 1, msgId, null, true);
|
||||
}
|
||||
|
||||
private void checkSaveUser(User user) throws Exception {
|
||||
ArenaOfUser query = CrossServiceLogic.getInstance().query(user.getId());
|
||||
if (query == null){
|
||||
ArenaOfUser arenaOfUser = CrossServiceLogic.getInstance().buildArenaOfUser(user);
|
||||
CrossServiceLogic.getInstance().insert(arenaOfUser);
|
||||
}
|
||||
}
|
||||
|
||||
//记录聊天信息
|
||||
private void onSendChatSuccess(User user,int chatType,String message){
|
||||
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||
|
|
|
@ -1,9 +1,17 @@
|
|||
package com.ljsd.jieling.chat.messge;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import org.luaj.vm2.ast.Str;
|
||||
import rpc.protocols.ChatProto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class MessageCache {
|
||||
private static final int capuatiy =200;
|
||||
|
@ -13,7 +21,7 @@ public class MessageCache {
|
|||
public static LoopQueue worldMsg = new LoopQueue(capuatiy,perCaught,-1);
|
||||
public static LoopQueue sysMsg = new LoopQueue(capuatiy,perCaught,msgInterval);
|
||||
public static Map<Integer,LoopQueue> guildMsg = new ConcurrentHashMap();
|
||||
|
||||
private static Gson gson = new Gson();
|
||||
|
||||
public static void addWordMsg(ChatProto.ChatInfo chatInfo,long messageId){
|
||||
worldMsg.push(chatInfo,messageId);
|
||||
|
@ -29,4 +37,60 @@ public class MessageCache {
|
|||
guildMsg.get(guildId).push(chatInfo,messageId);
|
||||
}
|
||||
|
||||
public static void addCrossMsg(ChatProto.ChatInfo chatInfo,long messageId,String group){
|
||||
long index = messageId % capuatiy;
|
||||
String key = RedisKey.CHAT_CROSS_INFO_CACHE+group;
|
||||
|
||||
RedisUtil.getInstence().hset(key,String.valueOf(index),gson.toJson(chatInfo));
|
||||
}
|
||||
|
||||
public static List<ChatProto.ChatInfo> getCrossMsg(long messageId,String group){
|
||||
String key = RedisKey.CHAT_CROSS_INFO_CACHE+group;
|
||||
Map<Integer,ChatProto.ChatInfo> map = new HashMap<>();
|
||||
Map<Object, Object> collect = RedisUtil.getInstence().hmget(key);
|
||||
collect.entrySet().forEach(o -> map.put(Integer.parseInt(o.getKey().toString()),
|
||||
gson.fromJson(o.getValue().toString(),ChatProto.ChatInfo.class)));
|
||||
List<ChatProto.ChatInfo> objs = new ArrayList<>();
|
||||
Object obj = RedisUtil.getInstence().get(RedisKey.CHAT_CROSS_MSG_ID + group);
|
||||
if(obj==null){
|
||||
return objs;
|
||||
}
|
||||
int writeIndex = Integer.parseInt(String.valueOf(obj));
|
||||
|
||||
Integer nextIndex = writeIndex%capuatiy;
|
||||
|
||||
if(nextIndex==-1){
|
||||
nextIndex = capuatiy - 1;
|
||||
}
|
||||
if(collect.size()<=0){
|
||||
return objs;
|
||||
}
|
||||
boolean needCompareTime = (messageId == 0);
|
||||
|
||||
while(map.containsKey(nextIndex)){
|
||||
|
||||
ChatProto.ChatInfo o = map.get(nextIndex);
|
||||
if(!needCompareTime){
|
||||
//比较消息id
|
||||
if(messageId>=o.getMessageId()){
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
objs.add(0, o);
|
||||
if(objs.size()>perCaught){
|
||||
break;
|
||||
}
|
||||
nextIndex--;
|
||||
if(nextIndex == -1){
|
||||
nextIndex = capuatiy - 1;
|
||||
}
|
||||
}
|
||||
if(!needCompareTime && objs.size()>perCaught){
|
||||
return objs.subList(0,perCaught);
|
||||
}
|
||||
|
||||
return objs;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,8 @@ public enum ChatContentType {
|
|||
FAMILY_HEAD(11,"会长"),
|
||||
FAMILY_NAME(12,"公会名"),
|
||||
ROLE_NAME(13,"角色名"),
|
||||
ANNOUNCE(14,"公告");
|
||||
ANNOUNCE(14,"公告"),
|
||||
CROSS_CHAT(15,"跨服");
|
||||
|
||||
private Integer type;
|
||||
private String text;
|
||||
|
|
|
@ -125,10 +125,14 @@ public class RedisKey {
|
|||
|
||||
public static final String CHAT_GUILD_MSG_ID = ":ChatGuildMsgId:";
|
||||
|
||||
public static final String CHAT_CROSS_MSG_ID = "ChatCrossMsgId:";
|
||||
|
||||
public static final String CHAT_FRIEND_MSG_ID = ":ChatFriendMsgId:";
|
||||
|
||||
public static final String CUser_Chat = ":CUser_Chat:";
|
||||
|
||||
public static final String CHAT_CROSS_INFO_CACHE = "CHAT_CROSS_INFO_CACHE:";//跨服聊天缓存
|
||||
|
||||
public static final String USER_LOGIN_URL = "USER_LOGIN_URL:";
|
||||
|
||||
public static final String CAR_DEALY_PLAY = "CAR_DEALY_PLAY";
|
||||
|
@ -259,6 +263,8 @@ public class RedisKey {
|
|||
|
||||
public static final String CHAT_INFO_CACHE = "CHAT_INFO_CACHE";//聊天信息缓存,gm后台使用
|
||||
|
||||
|
||||
|
||||
public static final String MAIL_RED_POINT = "MAIL_RED_POINT";//全服红点加入
|
||||
|
||||
public static final String PLAYER_INFO_CACHE = "PLAYER_INFO_CACHE";
|
||||
|
|
|
@ -170,8 +170,8 @@ public enum ErrorCode implements IErrorCode {
|
|||
|
||||
LOCK_FILL(140,"锁定数量已满,无法刷新"),
|
||||
REDPACKET_DAILY_LIMIT(141,"今日福利红包已达领取上限"),
|
||||
CHAMPION_BET_GUESS_OVER_TIME(142,"巅峰赛竞猜超时,请重新进入页面")
|
||||
|
||||
CHAMPION_BET_GUESS_OVER_TIME(142,"巅峰赛竞猜超时,请重新进入页面"),
|
||||
CHAT_NOT_CROSS(143,"聊天检查 没有跨服分组"),
|
||||
;
|
||||
private static final Set<Integer> CodeSet = new HashSet<>();
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ import com.ljsd.jieling.netty.cocdex.Tea;
|
|||
import com.ljsd.jieling.network.server.ProtocolsManager;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.thread.task.RPCWorldServerTask;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
@ -347,7 +348,8 @@ public class GlobalDataManaager implements IManager {
|
|||
GuildLogic.getInstance().flushEveryDay(user,fBuilder);
|
||||
ExpeditionLogic.getInstance().flushUserdataEveryDay(user);
|
||||
MapLogic.getInstance().flushEndlessTreasure(user);
|
||||
|
||||
//检测下称号
|
||||
CBean2Proto.getUserTitleList(user);
|
||||
user.getUserMissionManager().onGameEvent(user, GameEvent.DAILY_REFRESH,0);
|
||||
// user.getUserMissionManager().onGameEvent(user, GameEvent.BLOODY_REFRESH,0);
|
||||
FriendLogic.getInstance().refreshState(session);
|
||||
|
|
|
@ -740,10 +740,10 @@ public class ArenaLogic {
|
|||
int[][] titleReward = value.getTitleReward();
|
||||
if(titleReward !=null&& titleReward.length>0){
|
||||
for(int[] reward:titleReward){
|
||||
int time = TimeUtils.nowInt() + reward[1];
|
||||
user.getPlayerInfoManager().putUserTitleValidTime(reward[0],(long)time*1000);
|
||||
PlayerInfoProto.UserTitleAddIndication.newBuilder().setDecorationId(reward[0]).setTime(time);
|
||||
MessageUtil.sendIndicationMessage(OnlineUserManager.getSessionByUid(user.getId()),1, MessageTypeProto.MessageType.USER_TITLE_ADD_INDICATION_VALUE,null,true);
|
||||
long time = TimeUtils.getBeginOfDay(TimeUtils.now() + reward[1]*1000)+TimeUtils.DAY;
|
||||
user.getPlayerInfoManager().putUserTitleValidTime(reward[0],time);
|
||||
PlayerInfoProto.UserTitleAddIndication.Builder builder = PlayerInfoProto.UserTitleAddIndication.newBuilder().setDecorationId(reward[0]).setTime((int) (time / 1000));
|
||||
MessageUtil.sendIndicationMessage(OnlineUserManager.getSessionByUid(user.getId()),1, MessageTypeProto.MessageType.USER_TITLE_ADD_INDICATION_VALUE,builder.build(),true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1659,7 +1659,7 @@ public class HeroLogic{
|
|||
// 聚合::根据openlevel倒序,输出list
|
||||
List<SCHeroRankUpConfig> collect = rankUpConfigs.stream().sorted(Comparator.comparing(SCHeroRankUpConfig::getOpenLevel).reversed()).collect(Collectors.toList());
|
||||
for(SCHeroRankUpConfig scHeroRankUpConfig : collect){
|
||||
if (heroLevel > scHeroRankUpConfig.getOpenLevel()){
|
||||
if (heroLevel >= scHeroRankUpConfig.getOpenLevel()){
|
||||
if (scHeroRankUpConfig.getOpenStar() > 10){
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -672,10 +672,13 @@ public class PlayerLogic {
|
|||
.setUid(id);
|
||||
CommonProto.TeamOneTeamInfo.Builder teamOneTeamInfo = CommonProto.TeamOneTeamInfo.newBuilder();
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = query.getHeroManager().getTeams().get(teamId);
|
||||
if(teamPosHeroInfos!=null){
|
||||
for (TeamPosHeroInfo heroInfo:teamPosHeroInfos) {
|
||||
ArenaOfHero hero = query.getHeroManager().getHeros().get(heroInfo.getHeroId());
|
||||
teamOneTeamInfo.addTeam(CBean2Proto.getCrossSimpleHero(hero,heroInfo.getPosition()));
|
||||
}
|
||||
}
|
||||
|
||||
for(Map.Entry<Integer,Pokemon> entry:query.getPokemons().entrySet()){
|
||||
teamOneTeamInfo.addPokemonInfos(CBean2Proto.getSimpleTeamInfoByPokeMon(entry.getValue(), entry.getKey()));
|
||||
}
|
||||
|
|
|
@ -154,33 +154,6 @@ public class MinuteTask extends Thread {
|
|||
|
||||
try {
|
||||
ArenaLogic.getInstance().worldSendReward();
|
||||
if(STableManager.getConfig(SRechargeCommodityNewConfig.class).size()!= SRechargeCommodityNewConfig.configMap.size()){
|
||||
|
||||
Map<Integer, SRechargeCommodityNewConfig> config = STableManager.getConfig(SRechargeCommodityNewConfig.class);
|
||||
Map<Integer,SRechargeCommodityNewConfig> tempConfigMap = new HashMap<>();
|
||||
Map<String,SRechargeCommodityNewConfig> tempSdkConfigMap = new HashMap<>();
|
||||
Map<Integer, List<Integer>> tempConfigTypeMap = new HashMap<>();
|
||||
for(SRechargeCommodityNewConfig newConfig : config.values()){
|
||||
newConfig.setCondition(newConfig.initConditon(newConfig));
|
||||
tempConfigMap.put(newConfig.getId(),newConfig);
|
||||
tempSdkConfigMap.put(newConfig.getRechargeId(),newConfig);
|
||||
tempSdkConfigMap.put(newConfig.getRechargeId2(),newConfig);
|
||||
tempSdkConfigMap.put(newConfig.getRechargeId3(),newConfig);
|
||||
if(tempConfigTypeMap.containsKey(newConfig.getType())){
|
||||
tempConfigTypeMap.get(newConfig.getType()).add(newConfig.getId());
|
||||
}else{
|
||||
List<Integer> list = new ArrayList<>();
|
||||
list.add(newConfig.getId());
|
||||
tempConfigTypeMap.put(newConfig.getType(),list);
|
||||
}
|
||||
}
|
||||
// if(configMap == null){
|
||||
SRechargeCommodityNewConfig.configMap = tempConfigMap;
|
||||
LOGGER.info("修复重新加载Recharge");
|
||||
SRechargeCommodityNewConfig.sdkconfigMap = tempSdkConfigMap;
|
||||
SRechargeCommodityNewConfig.configTypeMap = tempConfigTypeMap;
|
||||
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
LOGGER.error("Exception::=>{}",e.toString());
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.ljsd.jieling.util;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
|
@ -8,6 +9,7 @@ import com.ljsd.jieling.handler.map.Cell;
|
|||
import com.ljsd.jieling.handler.map.MapManager;
|
||||
import com.ljsd.jieling.handler.map.TowerBuff;
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.activity.crossService.CrossServiceLogic;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.gm.ArenaOfHero;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
|
@ -23,6 +25,7 @@ import util.TimeUtils;
|
|||
import com.ljsd.fight.ArenaRecord;
|
||||
import rpc.protocols.CommonProto;
|
||||
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
@ -149,7 +152,7 @@ public class CBean2Proto {
|
|||
}
|
||||
|
||||
/**
|
||||
* 获取玩家皮肤列表
|
||||
* 获取玩家称号列表
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
|
@ -158,13 +161,15 @@ public class CBean2Proto {
|
|||
// 获取玩家已使用头像框列表
|
||||
Map<Integer, Long> validTime = user.getPlayerInfoManager().getUserTitleValidTime();
|
||||
|
||||
long now = TimeUtils.now() / 1000;
|
||||
long now = TimeUtils.now();
|
||||
|
||||
int passId = 0;
|
||||
Iterator<Map.Entry<Integer, Long>> it = validTime.entrySet().iterator();
|
||||
while (it.hasNext()){
|
||||
Map.Entry<Integer, Long> next = it.next();
|
||||
// 过期的删除,其他返回给客户端
|
||||
if (next.getValue() != 0 && now >= next.getValue()){
|
||||
passId = next.getKey();
|
||||
it.remove();
|
||||
}else {
|
||||
CommonProto.UserTitleInfo.Builder build = CommonProto.UserTitleInfo.newBuilder();
|
||||
|
@ -172,6 +177,12 @@ public class CBean2Proto {
|
|||
userTitleLists.add(build.build());
|
||||
}
|
||||
}
|
||||
if(passId!=0){
|
||||
|
||||
PlayerInfoProto.UserTitleAddIndication.Builder builder = PlayerInfoProto.UserTitleAddIndication.newBuilder().setDecorationId(passId).setTime(-1);
|
||||
MessageUtil.sendIndicationMessage(OnlineUserManager.getSessionByUid(user.getId()),1, MessageTypeProto.MessageType.USER_TITLE_ADD_INDICATION_VALUE,builder.build(),true);
|
||||
|
||||
}
|
||||
// 数据库更新
|
||||
user.getPlayerInfoManager().setUserTitleValidTime(validTime);
|
||||
return userTitleLists;
|
||||
|
@ -524,6 +535,25 @@ public class CBean2Proto {
|
|||
return chatInfo.build();
|
||||
}
|
||||
|
||||
public static ChatProto.ChatInfo getCrossChatInfoBuilder(User user,String message,long time,long messageId){
|
||||
ChatProto.ChatInfo.Builder chatInfo = ChatProto.ChatInfo.newBuilder();
|
||||
PlayerManager playerInfoManager = user.getPlayerInfoManager();
|
||||
chatInfo.setSenderId(user.getId());
|
||||
chatInfo.setSenderName(playerInfoManager.getNickName());
|
||||
chatInfo.setSenderlevel(playerInfoManager.getLevel());
|
||||
chatInfo.setSendervip(playerInfoManager.getVipLevel());
|
||||
chatInfo.setTimes(time);
|
||||
chatInfo.setMsg(message);
|
||||
chatInfo.setHead(playerInfoManager.getHead());
|
||||
chatInfo.setFrame(playerInfoManager.getHeadFrame());
|
||||
chatInfo.setSoulVal(playerInfoManager.getMaxForce());
|
||||
chatInfo.setMessageId(messageId);
|
||||
chatInfo.setUserTitle(playerInfoManager.getUserTitle());
|
||||
chatInfo.setPracticeLevel(user.getHeroManager().getPracticeLevel());
|
||||
chatInfo.setServerName(CrossServiceLogic.getInstance().findServerName(GameApplication.serverId));
|
||||
return chatInfo.build();
|
||||
}
|
||||
|
||||
public static ChatProto.ChatInfo getSysChatInfoBuilder(String message,int messageType,String itemId,int type,int startTime, int endTime, int priorityLevel, int multiple,long messageId) {
|
||||
ChatProto.ChatInfo.Builder chatInfo = ChatProto.ChatInfo.newBuilder();
|
||||
chatInfo.setItemId(itemId);
|
||||
|
|
Loading…
Reference in New Issue