战力排行 日志开关
parent
7b94b53fd9
commit
b5932dec2a
|
@ -20,6 +20,8 @@ public class ServerProperties {
|
|||
|
||||
private int num;
|
||||
|
||||
private boolean sendlog37;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
@ -68,6 +70,10 @@ public class ServerProperties {
|
|||
this.num = num;
|
||||
}
|
||||
|
||||
public boolean isSendlog37() {
|
||||
return sendlog37;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ServerProperties{" +
|
||||
|
@ -77,6 +83,7 @@ public class ServerProperties {
|
|||
", isLAN=" + isLAN +
|
||||
", openTime=" + openTime +
|
||||
", num=" + num +
|
||||
", sendlog37=" + sendlog37 +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.ljsd.jieling.config.reportData;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.common.mogodb.util.BlockingUniqueQueue;
|
||||
import com.ljsd.jieling.config.json.SDK37Constans;
|
||||
import com.ljsd.jieling.dataReport.reportBeans_37.Report37Param;
|
||||
|
@ -31,7 +32,7 @@ public class DataMessageUtils {
|
|||
public static void addLogQueue(Object info) {
|
||||
if (info instanceof KTParam) {
|
||||
logQueue.offer(info);
|
||||
} else if (info instanceof Report37Param) {
|
||||
} else if (info instanceof Report37Param && GameApplication.serverProperties.isSendlog37()) {
|
||||
logQueue_37.offer(info);
|
||||
}
|
||||
}
|
||||
|
@ -48,8 +49,7 @@ public class DataMessageUtils {
|
|||
HttpPool.sendPost(sendUrl, gson.toJson(sendBody));
|
||||
}
|
||||
|
||||
if (!sendData37List.isEmpty()) {
|
||||
|
||||
if (!sendData37List.isEmpty() && GameApplication.serverProperties.isSendlog37()) {
|
||||
for (Object object : sendData37List) {
|
||||
String sendToUrl;
|
||||
List<BasicNameValuePair> sendForm = new ArrayList<>();
|
||||
|
@ -64,11 +64,10 @@ public class DataMessageUtils {
|
|||
}
|
||||
try {
|
||||
HttpPool.sendPostForm(sendToUrl, new UrlEncodedFormEntity(sendForm, "utf-8"));
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (sendDataList.isEmpty() && sendData37List.isEmpty()) {
|
||||
|
|
|
@ -128,4 +128,7 @@ public interface BIReason {
|
|||
|
||||
int ADVENTURE_CALL_BOSS_CONSUME = 1032; //召唤外敌消耗
|
||||
|
||||
|
||||
int MONSTERATTACK_CONSUME = 1033; // 妖兽来袭开启战斗消耗
|
||||
|
||||
}
|
|
@ -2182,7 +2182,7 @@ public class MapLogic {
|
|||
return;
|
||||
}
|
||||
|
||||
ItemUtil.itemCost(user,cost, BIReason.START_DIFFICULT, fightId);
|
||||
ItemUtil.itemCost(user,cost, BIReason.MONSTERATTACK_CONSUME, fightId);
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserGameType, KTGameType.CHALLENGE_MONSTERATTACK.getIndex(), fightId);
|
||||
user.getTeamPosManager().setCurTeamPosId(teamId);
|
||||
String fightInfo = fightId + "#" + teamId;
|
||||
|
|
|
@ -49,6 +49,12 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityStart() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 子类重写
|
||||
*
|
||||
|
|
|
@ -31,6 +31,9 @@ import org.springframework.data.redis.core.ZSetOperations;
|
|||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class ActivityLogic {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ActivityLogic.class);
|
||||
|
||||
|
@ -918,7 +921,6 @@ public class ActivityLogic {
|
|||
ActivityMission activityMission = blessRefresh(user);
|
||||
activityMission.updateProgressInfo(BlessInfoConfig.LAST_REFRESH_TIME, new ActivityProgressInfo((int) (TimeUtils.now() / 1000), 0));
|
||||
PlayerInfoProto.blessRefresh res = PlayerInfoProto.blessRefresh.newBuilder().setReward(getBlessInfoResponse(activityMission).build()).build();
|
||||
|
||||
MessageUtil.sendMessage(session, 1, messageType.getNumber(), res, true);
|
||||
}
|
||||
|
||||
|
@ -945,7 +947,7 @@ public class ActivityLogic {
|
|||
}
|
||||
int start = (page - 1) * 20, end = page * 20 - 1;
|
||||
List<CommonProto.UseForceInfo> useForceInfoList = new ArrayList<>(20);
|
||||
Set<ZSetOperations.TypedTuple<String>> rankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.FORCE_RANK, Integer.toString(acitvityId), start, end);
|
||||
Set<ZSetOperations.TypedTuple<String>> rankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.FORCE_RANK,"", start, end);
|
||||
for (ZSetOperations.TypedTuple<String> item : rankInfo) {
|
||||
String value = item.getValue();
|
||||
int score = item.getScore().intValue();
|
||||
|
@ -963,8 +965,8 @@ public class ActivityLogic {
|
|||
}
|
||||
|
||||
int uid = session.getUid();
|
||||
int score = RedisUtil.getInstence().getZSetScore(RedisKey.FORCE_RANK, Integer.toString(acitvityId), Integer.toString(uid)).intValue();
|
||||
int myRank = RedisUtil.getInstence().getZSetreverseRank(RedisKey.FORCE_RANK, Integer.toString(acitvityId), Integer.toString(uid)).intValue();
|
||||
int score = RedisUtil.getInstence().getZSetScore(RedisKey.FORCE_RANK, "", Integer.toString(uid)).intValue();
|
||||
int myRank = RedisUtil.getInstence().getZSetreverseRank(RedisKey.FORCE_RANK, "", Integer.toString(uid)).intValue();
|
||||
|
||||
PlayerInfoProto.GetForceRankInfoResponse buildResponse = PlayerInfoProto.GetForceRankInfoResponse.newBuilder()
|
||||
.setMyRank(myRank)
|
||||
|
|
|
@ -26,6 +26,12 @@ class ForceRankActivity extends AbstractActivity {
|
|||
super(id);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onActivityStart() throws Exception {
|
||||
//上报所有玩家战力
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initActivity(User user) throws Exception {
|
||||
super.initActivity(user);
|
||||
|
@ -37,7 +43,7 @@ class ForceRankActivity extends AbstractActivity {
|
|||
//历史最高
|
||||
if (count > activityMission.getValue()) {
|
||||
activityMission.setValue(count);
|
||||
String key = RedisKey.getKey(RedisKey.FORCE_RANK, String.valueOf(id), false);
|
||||
String key = RedisKey.getKey(RedisKey.FORCE_RANK, "", false);
|
||||
RedisUtil.getInstence().zsetAddOne(key, String.valueOf(user.getId()), count);
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +71,7 @@ class ForceRankActivity extends AbstractActivity {
|
|||
}
|
||||
}
|
||||
|
||||
Set<ZSetOperations.TypedTuple<String>> rankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.FORCE_RANK, Integer.toString(id), 0, maxRank-1);
|
||||
Set<ZSetOperations.TypedTuple<String>> rankInfo = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.FORCE_RANK, "", 0, maxRank-1);
|
||||
int rank = 1;
|
||||
int nowTime = (int) (TimeUtils.now() / 1000);
|
||||
for (ZSetOperations.TypedTuple<String> item : rankInfo) {
|
||||
|
|
|
@ -19,6 +19,11 @@ public interface IActivity {
|
|||
*/
|
||||
void initActivity(User user) throws Exception;
|
||||
|
||||
/**
|
||||
* 绝对时间活动
|
||||
* @throws Exception
|
||||
*/
|
||||
void onActivityStart() throws Exception;
|
||||
/**
|
||||
* 活动重开
|
||||
*/
|
||||
|
|
|
@ -249,6 +249,8 @@ public class PlayerLogic {
|
|||
int teamForce = HeroLogic.getInstance().calTeamTotalForce(user, teamId, true);
|
||||
if(user.getPlayerInfoManager().getMaxForce() < teamForce){
|
||||
user.getPlayerInfoManager().setMaxForce(teamForce);
|
||||
String key = RedisKey.getKey(RedisKey.FORCE_RANK, "", false);
|
||||
RedisUtil.getInstence().zsetAddOne(key, String.valueOf(user.getId()), teamForce);
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.USER_FORCE_CHANGE);
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.FORCERANK,teamForce);
|
||||
ActivityLogic.getInstance().updateActivityMissionProgress(user, ActivityType.FORCESTANDARD,teamForce);
|
||||
|
|
|
@ -100,6 +100,11 @@ public class ThreadManager {
|
|||
scheduledExecutor.execute(dataReportTask);
|
||||
scheduledExecutor.execute(mongoDataHandlerTask);
|
||||
}
|
||||
|
||||
public static ScheduledThreadPoolExecutor getScheduledExecutor() {
|
||||
return scheduledExecutor;
|
||||
}
|
||||
|
||||
public static void reStart(){
|
||||
LOGGER.info("重启线程池!!");
|
||||
scheduledExecutor.shutdown();
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package com.ljsd.jieling.util;
|
||||
|
||||
import com.ljsd.jieling.core.HandlerLogicThread;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.network.server.ProtocolsManager;
|
||||
import com.ljsd.jieling.thread.ThreadManager;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class InnerMessageUtil {
|
||||
|
||||
public static void sendTo(User user, AyyncWorker ayyncWorker) {
|
||||
ProtocolsManager instance = ProtocolsManager.getInstance();
|
||||
HandlerLogicThread handlerThread = instance.handlerThreads[user.getId() % instance.HANDLER_THREAD_NUM];
|
||||
handlerThread.addAyyncWorker(ayyncWorker);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通知所有在线玩家 随机时间 /s
|
||||
*/
|
||||
public static void broadcastWithRandom(AyyncWorker ayyncWorker, List<Integer> sendId, int timeBound) {
|
||||
for (Integer id : sendId) {
|
||||
ThreadManager.getScheduledExecutor().schedule(() -> {
|
||||
ProtocolsManager instance = ProtocolsManager.getInstance();
|
||||
HandlerLogicThread handlerThread = instance.handlerThreads[id % instance.HANDLER_THREAD_NUM];
|
||||
handlerThread.addAyyncWorker(ayyncWorker);
|
||||
}, MathUtils.randomInt(timeBound), TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue