优化世界等级起服计算
parent
d3c4ea921b
commit
aa938f7edb
|
|
@ -48,7 +48,7 @@ public class GameLogicService implements IService {
|
|||
public void init() throws Exception {
|
||||
RedisUtil.getInstence().init();
|
||||
MongoUtil.getLjsdMongoTemplate().getMongoTemplate(GameApplication.serverId).getCollection(User.getCollectionName()).createIndex("playerManager.level");
|
||||
GlobleSystemLogic.getInstence().calCulRank();
|
||||
GlobleSystemLogic.getInstence().calCulRank(true);
|
||||
registerServerInfoToRedis();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ public class GlobleSystemLogic implements IEventHandler {
|
|||
*
|
||||
* 2 高于50名
|
||||
*/
|
||||
public void calCulRank() {
|
||||
public void calCulRank(boolean isServerStart) {
|
||||
try {
|
||||
//开服前7天不开放跨服功能
|
||||
/*if(isOpenServer7()){
|
||||
|
|
@ -162,6 +162,13 @@ public class GlobleSystemLogic implements IEventHandler {
|
|||
if(!GameApplication.serverProperties.isArenaCross()){
|
||||
return;
|
||||
}
|
||||
// 如果是服务器启动,查redis中世界等级即可
|
||||
if (isServerStart) {
|
||||
int globalWorldLevelCache = getGlobalWorldLevelCache();
|
||||
if (globalWorldLevelCache > 0){
|
||||
return;
|
||||
}
|
||||
}
|
||||
SMServerArenaSetting setting = STableManager.getConfig(SMServerArenaSetting.class).get(1);
|
||||
int rankEndLine = setting.getWorldLevLimit();
|
||||
double sum=0;
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public class UserManager {
|
|||
private static Map<Integer,Long> userMapPutTime = new ConcurrentHashMap<>(); //离线读入
|
||||
private static AtomicInteger login_f_num = new AtomicInteger(0);//登陆计数
|
||||
private static final int LOGIN_F_LIMIT = 100;//报警界限
|
||||
private static final long LIVE_TIME = 12 * 60 * 60 * 1000L;
|
||||
private static final long LIVE_TIME = 2 * 60 * 60 * 1000L;
|
||||
|
||||
public static void addUser(User user) {
|
||||
userMap.put(user.getId(), user);
|
||||
|
|
@ -74,6 +74,7 @@ public class UserManager {
|
|||
userMapPutTime.remove(integerUserEntry.getId());
|
||||
}
|
||||
}
|
||||
LOGGER.info("checkOffline left count={}", userMap.keySet().size());
|
||||
}catch (Exception e){
|
||||
LOGGER.error("Exception离线清除逻辑err={}",e.toString());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ public class MinuteTask extends Thread {
|
|||
//保证每分钟线程
|
||||
try {
|
||||
// 计算世界等级
|
||||
GlobleSystemLogic.getInstence().calCulRank();
|
||||
GlobleSystemLogic.getInstence().calCulRank(false);
|
||||
//玉虚论道重置
|
||||
if(Calendar.getInstance().get(Calendar.DAY_OF_WEEK) == 2){
|
||||
CrossYuxulundaoLogic.getInstance().initRank();
|
||||
|
|
|
|||
Loading…
Reference in New Issue