轩辕宝镜排行发奖
parent
cf3704b456
commit
6dfd305c73
|
@ -0,0 +1,44 @@
|
|||
package com.ljsd.jieling.config.clazzStaticCfg;
|
||||
|
||||
import config.SExpeditionFloorConfig;
|
||||
import config.SRaceTowerRewardConfig;
|
||||
import manager.AbstractClassStaticConfig;
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2020/9/7
|
||||
* @discribe
|
||||
*/
|
||||
public class RewardStaticConfig extends AbstractClassStaticConfig {
|
||||
|
||||
private static Map<Integer,SRaceTowerRewardConfig> raceRewardConfigMap;
|
||||
|
||||
@Override
|
||||
public void registConfigs(Set<String> registConfigs) {
|
||||
registConfigs.add(SRaceTowerRewardConfig.class.getAnnotation(Table.class).name());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void figureConfigs() {
|
||||
Map<Integer,SRaceTowerRewardConfig> raceRewardConfigMapTemp = new HashMap<>();
|
||||
for(SRaceTowerRewardConfig value:STableManager.getConfig(SRaceTowerRewardConfig.class).values()){
|
||||
int[] section = value.getSection();
|
||||
for(int i = section[0];i<=section[1];i++){
|
||||
raceRewardConfigMapTemp.put(i,value);
|
||||
}
|
||||
}
|
||||
raceRewardConfigMap = raceRewardConfigMapTemp;
|
||||
|
||||
}
|
||||
|
||||
public static Map<Integer, SRaceTowerRewardConfig> getRaceRewardConfigMap() {
|
||||
return raceRewardConfigMap;
|
||||
}
|
||||
}
|
|
@ -2,11 +2,15 @@ package com.ljsd.jieling.logic;
|
|||
|
||||
|
||||
import com.ljsd.fight.CheckFight;
|
||||
import com.ljsd.jieling.config.clazzStaticCfg.RewardStaticConfig;
|
||||
import com.ljsd.jieling.core.FunctionIdEnum;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.ktbeans.ReportEventEnum;
|
||||
import com.ljsd.jieling.ktbeans.ReportUtil;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
|
@ -16,6 +20,7 @@ import com.ljsd.jieling.logic.dao.UserManager;
|
|||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.fight.*;
|
||||
import com.ljsd.jieling.logic.fight.result.FightResult;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.logic.rank.RankContext;
|
||||
|
@ -33,6 +38,7 @@ import com.ljsd.jieling.util.MonsterUtil;
|
|||
import config.*;
|
||||
import manager.STableManager;
|
||||
import org.luaj.vm2.LuaValue;
|
||||
import org.springframework.data.redis.core.ZSetOperations;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -103,9 +109,14 @@ public class SituationLogic {
|
|||
if(isIndication){
|
||||
//周一刷新
|
||||
boolean remove = false;
|
||||
if(TimeUtils.getDayOfWeek()==1){
|
||||
if(TimeUtils.getDayOfWeek()==1&&TimeUtils.getHourOfDay()==5&&TimeUtils.getMiunte()==0){
|
||||
remove = true;
|
||||
}
|
||||
if(remove){
|
||||
//发排行奖励,删除排行信息
|
||||
Runnable runnable = this::rankReward;
|
||||
runnable.run();
|
||||
}
|
||||
try {
|
||||
Map<Integer, ISession> sessionMap = OnlineUserManager.sessionMap;
|
||||
for(Map.Entry<Integer, ISession> entry:sessionMap.entrySet()){
|
||||
|
@ -132,11 +143,42 @@ public class SituationLogic {
|
|||
}
|
||||
}
|
||||
|
||||
public void rankReward() {
|
||||
AbstractRank rank = RankContext.getRankEnum(RankEnum.SITUATION_RANK.getType());
|
||||
Map<Integer, SRaceTowerRewardConfig> rewardConfigMap = RewardStaticConfig.getRaceRewardConfigMap();
|
||||
Set<ZSetOperations.TypedTuple<String>> rankInfos = rank.getRankByKey("", 0, rewardConfigMap.size());
|
||||
if(rankInfos.size()<1){
|
||||
return;
|
||||
}
|
||||
try{
|
||||
int index = 1;
|
||||
for(ZSetOperations.TypedTuple<String> rankInfo:rankInfos){
|
||||
System.out.println("fasong11111111111");
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("xuanyuan_Ranking_reward_title");
|
||||
String content = SErrorCodeEerverConfig.getI18NMessage("xuanyuan_Ranking_reward_txt", new Object[]{index});
|
||||
SRaceTowerRewardConfig sRaceTowerRewardConfig = rewardConfigMap.get(index);
|
||||
if(sRaceTowerRewardConfig==null){
|
||||
continue;
|
||||
}
|
||||
String mailReward = ItemUtil.getMailReward(sRaceTowerRewardConfig.getReward());
|
||||
MailLogic.getInstance().sendMail(Integer.parseInt(rankInfo.getValue()), title, content, mailReward, TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME);
|
||||
index++;
|
||||
}
|
||||
RedisUtil.getInstence().del(RedisKey.getKey(rank.getRedisKey(),"",false));
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void getAllSituationStatus(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
MapInfoProto.GetAllSituationInfoResponse.Builder response = MapInfoProto.GetAllSituationInfoResponse.newBuilder();
|
||||
Map<Integer, Integer> situationPass = user.getPlayerInfoManager().getSituationPass();
|
||||
if(status==null){
|
||||
checkStatus();
|
||||
}
|
||||
for(int i = 0 ; i < status.length;i++){
|
||||
if(status[i]==0){
|
||||
continue;
|
||||
|
@ -158,7 +200,10 @@ public class SituationLogic {
|
|||
SRaceTowerConfig sRaceTowerConfig = STableManager.getConfig(SRaceTowerConfig.class).get(id);
|
||||
Map<Integer,Integer> situationPass = playerInfoManager.getSituationPass();
|
||||
|
||||
|
||||
boolean check = PlayerLogic.getInstance().check(user, sRaceTowerConfig.getPrivilege()[0], 1);
|
||||
if(!check){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
|
||||
boolean consumeCount = false;
|
||||
if(type==2){
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="RaceTowerRewardConfig")
|
||||
public class SRaceTowerRewardConfig implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int[] section;
|
||||
|
||||
private int[][] reward;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int[] getSection() {
|
||||
return section;
|
||||
}
|
||||
|
||||
public int[][] getReward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue