排行榜修改
parent
7de4d9bc9e
commit
262be7dde8
|
|
@ -137,6 +137,11 @@ public class TimeUtils {
|
|||
|
||||
public static final String Stand_CeHua_Data_format = "yyyyMMdd HHmmss";
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(Integer.MAX_VALUE);
|
||||
System.out.println((Integer.MAX_VALUE-now()/1000)/Math.pow(10,9));
|
||||
|
||||
}
|
||||
/**
|
||||
* 判断是否合法的时间格式(HH:mm:ss)
|
||||
*
|
||||
|
|
@ -1314,4 +1319,12 @@ public class TimeUtils {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回Integer最大值-now()之后变成小于一的小数;
|
||||
* @return
|
||||
*/
|
||||
public static double getDoubleTime(){
|
||||
return (Integer.MAX_VALUE-now()/1000)/Math.pow(10,9);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
package com.ljsd.jieling.handler;
|
||||
|
||||
import com.ljsd.jieling.handler.map.MapLogic;
|
||||
import com.ljsd.jieling.logic.rank.RankContext;
|
||||
import com.ljsd.jieling.logic.rank.RankLogic;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
|
|
@ -8,16 +10,16 @@ import com.ljsd.jieling.protocols.PlayerInfoProto;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class TowerRankHandler extends BaseHandler<PlayerInfoProto.RankRequest> {
|
||||
public class RankHandler extends BaseHandler<PlayerInfoProto.RankRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.GET_TOWER_RANK_BY_PAGE_REQUEST;
|
||||
return MessageTypeProto.MessageType.GET_ONE_RANK_REQUEST;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, PlayerInfoProto.RankRequest proto) throws Exception {
|
||||
MapLogic.getInstance().getTowerRank(iSession,proto.getType(),MessageTypeProto.MessageType.GET_TOWER_RANK_BY_PAGE_RESPONSE);
|
||||
|
||||
MapLogic.getInstance().getTowerRank(iSession,proto.getType(),MessageTypeProto.MessageType.GET_ONE_RANK_RESPONSE);
|
||||
// RankLogic.getInstance().getRank(iSession,proto.getType(),MessageTypeProto.MessageType.GET_ONE_RANK_RESPONSE);
|
||||
}
|
||||
}
|
||||
|
|
@ -29,7 +29,7 @@ import com.ljsd.jieling.logic.fight.result.FightResult;
|
|||
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.rank.AbstractRank;
|
||||
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||
import com.ljsd.jieling.logic.rank.RankContext;
|
||||
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||
import com.ljsd.jieling.logic.store.StoreLogic;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
package com.ljsd.jieling.handler.map.behavior;
|
||||
|
||||
import com.ljsd.jieling.logic.rank.AbstractRank;
|
||||
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||
import com.ljsd.jieling.logic.rank.RankContext;
|
||||
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||
import config.SChallengeConfig;
|
||||
import config.STrialConfig;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.handler.map.EventType;
|
||||
import com.ljsd.jieling.handler.map.MapLogic;
|
||||
import com.ljsd.jieling.handler.map.MapManager;
|
||||
|
|
@ -14,7 +12,6 @@ import com.ljsd.jieling.logic.dao.root.User;
|
|||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.protocols.MapInfoProto;
|
||||
import util.TimeUtils;
|
||||
import com.ljsd.jieling.util.TowerRankUtil;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.ljsd.jieling.logic.rank;
|
||||
|
||||
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2019/11/26
|
||||
|
|
|
|||
|
|
@ -1,6 +1,10 @@
|
|||
package com.ljsd.jieling.logic.rank;
|
||||
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||
import com.ljsd.jieling.logic.rank.rankImpl.ForceRank;
|
||||
import com.ljsd.jieling.logic.rank.rankImpl.RandomCardRank;
|
||||
import com.ljsd.jieling.logic.rank.rankImpl.TowerRank;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
|
|
@ -13,9 +17,9 @@ import java.util.function.BiFunction;
|
|||
* @discribe
|
||||
*/
|
||||
public enum RankEnum {
|
||||
TOWER_RANK(1,RedisKey.TOWER_RANK,TowerRank::new),
|
||||
FORCE_RANK(2,RedisKey.FORCE_RANK,ForceRank::new),
|
||||
RANDOM_CARD_RANK(10,RedisKey.RANDOM_CARD_RANK,RandomCardRank::new)
|
||||
TOWER_RANK(1,RedisKey.TOWER_RANK, TowerRank::new),
|
||||
FORCE_RANK(2,RedisKey.FORCE_RANK, ForceRank::new),
|
||||
RANDOM_CARD_RANK(10,RedisKey.RANDOM_CARD_RANK, RandomCardRank::new)
|
||||
;
|
||||
private int type;
|
||||
private String redisKey;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
package com.ljsd.jieling.logic.rank;
|
||||
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.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.rank.IRank;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
|
|
@ -47,7 +48,7 @@ public abstract class AbstractRank implements IRank {
|
|||
String key = RedisKey.getKey(redisKey,"",false);
|
||||
RedisUtil.getInstence().zsetAddOne(key,String.valueOf(uid), getScore(data));
|
||||
}
|
||||
AbstractRank(int type,String redisKey){
|
||||
public AbstractRank(int type,String redisKey){
|
||||
this.type = type;
|
||||
this.redisKey = redisKey;
|
||||
}
|
||||
|
|
@ -123,12 +124,12 @@ public abstract class AbstractRank implements IRank {
|
|||
if(startIndex < 0) {
|
||||
startIndex = 0;
|
||||
}
|
||||
int index = 0;
|
||||
int index = startIndex;
|
||||
for (T element : elements) {
|
||||
index++;
|
||||
if(index <= startIndex) {
|
||||
continue;
|
||||
}
|
||||
// if(index <= startIndex) {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
action.accept(index-1, element);
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.ljsd.jieling.logic.rank;
|
||||
package com.ljsd.jieling.logic.rank.rankImpl;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
|
|
@ -6,7 +6,7 @@ package com.ljsd.jieling.logic.rank;
|
|||
* @discribe
|
||||
*/
|
||||
public class ForceRank extends AbstractRank {
|
||||
ForceRank(int type, String redisKey) {
|
||||
public ForceRank(int type, String redisKey) {
|
||||
super(type, redisKey);
|
||||
}
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.ljsd.jieling.logic.rank;
|
||||
package com.ljsd.jieling.logic.rank.rankImpl;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
|
|
@ -6,7 +6,7 @@ package com.ljsd.jieling.logic.rank;
|
|||
* @discribe
|
||||
*/
|
||||
public class RandomCardRank extends AbstractRank {
|
||||
RandomCardRank(int type, String redisKey) {
|
||||
public RandomCardRank(int type, String redisKey) {
|
||||
super(type, redisKey);
|
||||
}
|
||||
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.ljsd.jieling.logic.rank;
|
||||
package com.ljsd.jieling.logic.rank.rankImpl;
|
||||
import com.ljsd.jieling.protocols.PlayerInfoProto;
|
||||
import config.SSpecialConfig;
|
||||
import util.TimeUtils;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -9,7 +10,7 @@ import config.SSpecialConfig;
|
|||
* @discribe 试炼排行榜
|
||||
*/
|
||||
public class TowerRank extends AbstractRank {
|
||||
TowerRank(Integer type,String redisKey){
|
||||
public TowerRank(Integer type,String redisKey){
|
||||
super(type,redisKey);
|
||||
}
|
||||
|
||||
|
|
@ -30,6 +31,7 @@ public class TowerRank extends AbstractRank {
|
|||
|
||||
@Override
|
||||
public double getScore(double... data) {
|
||||
return data[1]>3600?data[0]*3601:data[0]*3601+3600-data[1];
|
||||
double doubleTime = TimeUtils.getDoubleTime();
|
||||
return data[1]>3600?data[0]*3601+doubleTime:data[0]*3601+3600-data[1]+doubleTime;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue