竞技场优化 赛季重置不清空积分,初始化为上赛季积分的百分比
parent
1b4a0f6386
commit
59b28c36e8
|
@ -27,6 +27,7 @@ import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||||
import com.ljsd.jieling.network.server.GlobalidHelper;
|
import com.ljsd.jieling.network.server.GlobalidHelper;
|
||||||
import com.ljsd.jieling.network.server.WorldHelper;
|
import com.ljsd.jieling.network.server.WorldHelper;
|
||||||
import com.ljsd.jieling.network.session.ISession;
|
import com.ljsd.jieling.network.session.ISession;
|
||||||
|
import org.luaj.vm2.lib.jse.JseMathLib;
|
||||||
import rpc.protocols.ArenaInfoProto;
|
import rpc.protocols.ArenaInfoProto;
|
||||||
import rpc.protocols.CommonProto;
|
import rpc.protocols.CommonProto;
|
||||||
import rpc.protocols.FightInfoProto;
|
import rpc.protocols.FightInfoProto;
|
||||||
|
@ -569,31 +570,43 @@ public class ArenaLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRewardByRank(int rank,int type){
|
public String getRewardByRank(int rank,int type){
|
||||||
Map<Integer, SArenaReward> config = STableManager.getConfig(SArenaReward.class);
|
// Map<Integer, SArenaReward> config = STableManager.getConfig(SArenaReward.class);
|
||||||
for(SArenaReward sArenaReward : config.values()){
|
// for(SArenaReward sArenaReward : config.values()){
|
||||||
int minRank = sArenaReward.getMinRank();
|
// int minRank = sArenaReward.getMinRank();
|
||||||
int maxRank = sArenaReward.getMaxRank();
|
// int maxRank = sArenaReward.getMaxRank();
|
||||||
if(rank>=minRank && rank<=maxRank){
|
// if(rank>=minRank && rank<=maxRank){
|
||||||
if(type == GlobalsDef.ARENA_DAILY_REWARD){
|
// if(type == GlobalsDef.ARENA_DAILY_REWARD){
|
||||||
int[][] dailyReward = sArenaReward.getDailyReward();
|
// int[][] dailyReward = sArenaReward.getDailyReward();
|
||||||
return StringUtil.parseArrayToString(dailyReward);
|
// return StringUtil.parseArrayToString(dailyReward);
|
||||||
}else{
|
// }else{
|
||||||
int[][] seasonReward = sArenaReward.getSeasonReward();
|
// int[][] seasonReward = sArenaReward.getSeasonReward();
|
||||||
return StringUtil.parseArrayToString(seasonReward);
|
// return StringUtil.parseArrayToString(seasonReward);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateArenaSeason(int curSeason){
|
public void updateArenaSeason(int curSeason){
|
||||||
this.curSeason = curSeason;
|
this.curSeason = curSeason;
|
||||||
|
//初始化竞技场新周期数据
|
||||||
|
if(curSeason>viewSeason){
|
||||||
|
String oldRedisKey = RedisUtil.getInstence().getKey(RedisKey.ARENA_RANK,String.valueOf(viewSeason));
|
||||||
|
String newRedisKey = RedisUtil.getInstence().getKey(RedisKey.ARENA_RANK,String.valueOf(curSeason));
|
||||||
|
Set<ZSetOperations.TypedTuple<String>> set= RedisUtil.getInstence().getAllZsetRange(oldRedisKey);
|
||||||
|
for(ZSetOperations.TypedTuple<String> item : set){
|
||||||
|
String id = item.getValue();
|
||||||
|
Double score = item.getScore();
|
||||||
|
double time = score - score.intValue();
|
||||||
|
double newScore =(int)(score.intValue()*0.8)+ time;
|
||||||
|
RedisUtil.getInstence().zsetAddOne(newRedisKey,id,newScore);
|
||||||
|
}
|
||||||
|
}
|
||||||
if(this.curSeason!=0){
|
if(this.curSeason!=0){
|
||||||
viewSeason = this.curSeason;
|
viewSeason = this.curSeason;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void playWithSb(ISession session,int challengeUid,int myteamId) throws Exception {
|
public void playWithSb(ISession session,int challengeUid,int myteamId) throws Exception {
|
||||||
User mine = UserManager.getUser(session.getUid());
|
User mine = UserManager.getUser(session.getUid());
|
||||||
User defUser = UserManager.getUser(challengeUid);
|
User defUser = UserManager.getUser(challengeUid);
|
||||||
|
|
Loading…
Reference in New Issue