血战邮件
parent
8129e8cb2c
commit
6030413d3f
|
@ -18,7 +18,7 @@ public class SBloodyRankConfig implements BaseConfig {
|
|||
|
||||
private int[][] reward;
|
||||
|
||||
private static Map<Integer, SBloodyRankConfig> sBloodyRankConfigMap;
|
||||
public static Map<Integer, SBloodyRankConfig> sBloodyRankConfigMap;
|
||||
|
||||
|
||||
@Override
|
||||
|
|
|
@ -36,7 +36,7 @@ public enum FunctionIdEnum {
|
|||
Store(20),
|
||||
|
||||
Endless(46),
|
||||
|
||||
Blood(47),
|
||||
ToBeStronger(48),
|
||||
WorkShopTech(101),
|
||||
WorkShopCreateEquip(102),
|
||||
|
|
|
@ -17,6 +17,7 @@ import com.ljsd.jieling.handler.map.MapLogic;
|
|||
import com.ljsd.jieling.handler.map.MapManager;
|
||||
import com.ljsd.jieling.logic.activity.ActivityLogic;
|
||||
import com.ljsd.jieling.logic.arena.ArenaLogic;
|
||||
import com.ljsd.jieling.logic.blood.BloodLogic;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.GlobalSystemControl;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
|
@ -170,6 +171,7 @@ public class GlobalDataManaager {
|
|||
MapLogic.getInstance().updateEndlessSeason(timeControllerOfFunction.getTimes());
|
||||
serverConfigTmp.setWorldLevel(calWorldLevel());
|
||||
MapLogic.getInstance().setEndlessMapId(getEndleeMapIdByLevel());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -188,6 +190,10 @@ public class GlobalDataManaager {
|
|||
break;
|
||||
case Endless:
|
||||
MapLogic.getInstance().resetEndlessInfo();
|
||||
BloodLogic.getInstance().bloodSeasonReward();
|
||||
break;
|
||||
case Blood:
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.ljsd.jieling.logic.blood;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.config.SBloodyRankConfig;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.logic.dao.*;
|
||||
|
@ -9,11 +11,14 @@ import com.ljsd.jieling.logic.fight.CombatLogic;
|
|||
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.logic.item.ItemLogic;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.protocols.CommonProto;
|
||||
import com.ljsd.jieling.protocols.MessageTypeProto;
|
||||
import com.ljsd.jieling.protocols.RoomProto;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import com.ljsd.jieling.util.StringUtil;
|
||||
import com.ljsd.jieling.util.TimeUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
|
@ -130,5 +135,34 @@ public class BloodLogic {
|
|||
}
|
||||
MessageUtil.sendMessage(session,1,messageType.getNumber(),response.build(),true);
|
||||
}
|
||||
public void bloodSeasonReward() throws Exception {
|
||||
Set<ZSetOperations.TypedTuple<String>> zsetreverseRangeWithScores = RedisUtil.getInstence().getZsetreverseRangeWithScores(RedisKey.BLOODY_RANK, "1", 0, RedisUtil.getInstence().getZsetSize(RedisKey.getKey(RedisKey.BLOODY_RANK, "1", true)));
|
||||
Map<Integer, PlayerInfoCache> players = RedisUtil.getInstence().getMapValues(RedisKey.PLAYER_INFO_CACHE, "", Integer.class, PlayerInfoCache.class);
|
||||
Map<Integer, SBloodyRankConfig> sBloodyRankConfigMap = SBloodyRankConfig.sBloodyRankConfigMap;
|
||||
int floor = 0 ;
|
||||
for(ZSetOperations.TypedTuple<String> rank:zsetreverseRangeWithScores){
|
||||
//是否为本服玩家
|
||||
if(players.get(Integer.parseInt(rank.getValue())).getServerId()!= GameApplication.serverId){
|
||||
continue;
|
||||
}
|
||||
int[][] reward;
|
||||
for(Map.Entry<Integer, SBloodyRankConfig> entry:sBloodyRankConfigMap.entrySet()){
|
||||
SBloodyRankConfig value = entry.getValue();
|
||||
if(rank.getScore()>value.getScore()){
|
||||
floor = entry.getKey();
|
||||
}else{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(floor==0){
|
||||
continue;
|
||||
}else{
|
||||
reward = sBloodyRankConfigMap.get(floor).getReward();
|
||||
MailLogic.getInstance().sendMail(Integer.parseInt(rank.getValue()),"血战排行奖励","恭喜",StringUtil.parseArrayToString(reward), (int)(TimeUtils.now()/1000),10);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue