跨服灵脉秘境

xuexinpeng 2021-11-18 18:27:33 +08:00
parent e7e12c7228
commit 1acf753951
5 changed files with 60 additions and 6 deletions

View File

@ -1427,7 +1427,8 @@ public class RedisUtil {
RedisKey.WORLD_ARENA_MY_PRON.equals(type)||RedisKey.WORLD_ARENA_RRECORD.equals(type)||
RedisKey.CROSS_YUXULUNDAO_RANK.equals(type)||RedisKey.CROSS_YUXULUNDAO_ROBOT_INFO.equals(type)||
RedisKey.CROSS_YUXULUNDAO_RECORD.equals(type)|| RedisKey.CROSS_YUXULUNDAO_RANK_PERSON.equals(type)
||RedisKey.CROSS_LINGMAISECRET_INFO.equals(type)
||RedisKey.CROSS_LINGMAISECRET_INFO.equals(type)||RedisKey.CROSS_LINGMAISECRET_RECORD.equals(type)
||RedisKey.CROSS_LINGMAI_RANK_PERSON.equals(type)
) {
return type + RedisKey.Delimiter_colon + key;
}

View File

@ -76,13 +76,18 @@ public class CrossLingmaiLogic {
if(config!=null){
int occupyTime = (int) map.getValue().getGetAwardTimeOrOccupyTime();
int difVal = (nowTime-occupyTime)/60>=10?10:(nowTime-occupyTime)/60;
difVal =1 ;
map.getValue().setOccupyTime(map.getValue().getOccupyTime()+difVal);
map.getValue().setGetAwardTimeOrOccupyTime(TimeUtils.nowInt());
LOGGER.error("玩家"+map.getValue().getUid()+"获得"+difVal);
RedisUtil.getInstence().putMapEntry(RedisKey.CROSS_LINGMAISECRET_INFO,
crossGroup + RedisKey.Delimiter_colon + group, map.getKey(),map.getValue());
AbstractRank rank = RankContext.getRankEnum(RankEnum.CROSS_LINGMAI_RANK_PERSON.getType());
int score =map.getValue().getOccupyTime()*1+map.getValue().getScore1();//TODO 乘以每分钟收益
double test =rank.getScoreById(user.getId(),crossGroup + RedisKey.Delimiter_colon + group);
LOGGER.error("之前是:"+test +"之后是:"+score);
rank.addRank(user.getId(), String.valueOf(crossGroup)+RedisKey.Delimiter_colon + group, score);
}
}

View File

@ -1,5 +1,16 @@
package com.ljsd.jieling.logic.rank.rankImpl;
import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.logic.GlobleSystemLogic;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import config.SMServerLodeSetting;
import org.springframework.data.redis.core.ZSetOperations;
import rpc.protocols.PlayerInfoProto;
import java.util.Set;
public class CrossLingmaiSecretRank extends AbstractRank {
public CrossLingmaiSecretRank(int type, String redisKey) {
@ -8,11 +19,48 @@ public class CrossLingmaiSecretRank extends AbstractRank {
@Override
public long[] getDataByScore(Double score) {
return new long[0];
return new long[]{score.intValue()};
}
@Override
public double getScore(double... data) {
return 0;
return data[0];
}
/**
*
* @param uid
* @param rkey
* @param page
* @param rankEndLine
* @return
* @throws Exception
*/
public PlayerInfoProto.RankResponse getCrossRank(int uid, String rkey, int page, int rankEndLine) throws Exception {
if(rankEndLine==-1){
rankEndLine = 100;
}
User user = UserManager.getUser(uid);
int group = SMServerLodeSetting.getGroupByLevel(user.getArenaManager().getCrossLingmaiFirstLevel());
if (page == 0) {
page = 1;
}
int start = (page - 1) * rankEndLine, end = page * rankEndLine - 1;
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
Set<ZSetOperations.TypedTuple<String>> scores =
RedisUtil.getInstence().getZsetreverseRangeWithScores(redisKey, String.valueOf(crossGroup)+ RedisKey.Delimiter_colon +group, start, end, false);
if(start % rankEndLine == 0){
start++;
}
PlayerInfoProto.RankResponse.Builder allUserResponse = getCrossAllUserResponse(scores,start);
//当前用户信息
getCrossMyInfo(user,rkey,allUserResponse);
return allUserResponse.build();
}
public String getCrossRedisKey(int group) {
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
return RedisUtil.getInstence().getKey(redisKey,String.valueOf(crossGroup)+ RedisKey.Delimiter_colon +group,false);
}
}

View File

@ -318,14 +318,14 @@ public class MinuteTask extends Thread {
if(w==0 || w ==2|| w==4 || w == 6){
//占领奖励
if(hour>9&&hour<21){
int mod = minute%10;
int mod = minute%2;
if(mod ==0 ){
CrossLingmaiLogic.getInstance().sendOccypyReward();
}
}
//结算每日排行奖励
if(hour ==21 && minute==0){
//删除数据
//删除数据 TODO
CrossLingmaiLogic.getInstance().sendOccypyReward();
}

View File

@ -53,7 +53,7 @@ public class SMServerLodeSetting implements BaseConfig {
if(level>=group[1][1]&&level<=group[1][2]){
return group[1][0];
}
return 0;
return 1;
}
public int getId() {