跨服灵脉秘境
parent
d4daed3d65
commit
dc98b314ae
|
@ -66,13 +66,17 @@ public class CrossLingmaiSecretAreaInfoHandler extends BaseHandler<ArenaInfoProt
|
|||
Map<String, LingMaiSecretArea> lingMaiMap = RedisUtil.getInstence().getMapValues(RedisKey.CROSS_LINGMAISECRET_INFO, crossGroup + RedisKey.Delimiter_colon + group, String.class, LingMaiSecretArea.class);
|
||||
if (page == 0) {
|
||||
int id = lingMaiMap.values().stream().filter(n -> n.getUid() == uid).mapToInt(n -> n.getId()).sum();
|
||||
//lingMaiMap.values().stream().anyMatch(n -> n.getUid() == uid).
|
||||
if (SLodeConfig.lodeConfig.get(id) != null) {
|
||||
page = SLodeConfig.lodeConfig.get(id).getPageNo();
|
||||
} else {
|
||||
//找到第一个未被占领的灵脉
|
||||
//找到第一个未被占领的灵脉 所在的页
|
||||
for (Map.Entry<Integer, SLodeConfig> configEntry : SLodeConfig.lodeConfig.entrySet()) {
|
||||
if(configEntry.getValue().getGroup() != group){
|
||||
continue;
|
||||
}
|
||||
if (!lingMaiMap.containsKey(configEntry.getKey())) {
|
||||
page = SLodeConfig.lodeConfig.get(configEntry.getValue().getPageNo()).getPageNo();
|
||||
page = SLodeConfig.lodeConfig.get(configEntry.getKey()).getPageNo();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.ljsd.GameApplication;
|
|||
import com.ljsd.fight.LingMaiSecretArea;
|
||||
import com.ljsd.jieling.db.redis.RedisKey;
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.logic.GlobleSystemLogic;
|
||||
import com.ljsd.jieling.logic.activity.crossService.CrossServiceLogic;
|
||||
|
@ -14,18 +13,18 @@ import com.ljsd.jieling.logic.mail.MailLogic;
|
|||
import com.ljsd.jieling.logic.rank.RankContext;
|
||||
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import config.SErrorCodeEerverConfig;
|
||||
import config.SLodeConfig;
|
||||
import config.SLodeRankReward;
|
||||
import config.SMServerLodeSetting;
|
||||
import manager.STableManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import util.StringUtil;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
@ -39,50 +38,10 @@ public class CrossLingmaiLogic {
|
|||
public CrossLingmaiLogic() {
|
||||
}
|
||||
|
||||
public static class Instance {
|
||||
public final static CrossLingmaiLogic instance = new CrossLingmaiLogic();
|
||||
|
||||
}
|
||||
public static CrossLingmaiLogic getInstance() {
|
||||
return CrossLingmaiLogic.Instance.instance;
|
||||
}
|
||||
|
||||
|
||||
//功能是否开启 关闭、休战 、战斗
|
||||
public void functionIsOpen(int [] result){
|
||||
SMServerLodeSetting setting = SMServerLodeSetting.lodeConfig.get(1);
|
||||
int[][]restTime = setting.getRestTime();
|
||||
int[][]battleTime = setting.getBattleTime();
|
||||
long mondayZeroTime = TimeUtils.getWeekZero(1);
|
||||
//休战期
|
||||
for(int [] everyTime:restTime){
|
||||
if(TimeUtils.now()>=mondayZeroTime+everyTime[0]*1000 && TimeUtils.now()<=mondayZeroTime+everyTime[1]*1000){
|
||||
result[0]=2;
|
||||
result[1]=(int)(mondayZeroTime/1000)+everyTime[1];
|
||||
return;
|
||||
}
|
||||
}
|
||||
//抢夺期
|
||||
for(int [] everyTime:battleTime){
|
||||
if(TimeUtils.now()>mondayZeroTime+everyTime[0]*1000 && TimeUtils.now()<mondayZeroTime+everyTime[1]*1000){
|
||||
result[0]=1;
|
||||
result[1]=(int)(mondayZeroTime/1000)+everyTime[1];
|
||||
return;
|
||||
}
|
||||
}
|
||||
result[0]=0;
|
||||
result[1]=0;
|
||||
}
|
||||
|
||||
public int getLingmaiIdOccupy(int uid, Map<String, LingMaiSecretArea> lingMaiMap){
|
||||
for (Map.Entry<String, LingMaiSecretArea> data :lingMaiMap.entrySet()){
|
||||
if(data.getValue().getUid()==uid){
|
||||
return Integer.parseInt(data.getKey());
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static LingMaiSecretArea getLingaMaiData(int id, int uid, User user) {
|
||||
LingMaiSecretArea lingMaiSecretArea = new LingMaiSecretArea();
|
||||
lingMaiSecretArea.setId(id);
|
||||
|
@ -122,6 +81,42 @@ public class CrossLingmaiLogic {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//功能是否开启 0未开启 1抢夺 2休战
|
||||
public void functionIsOpen(int[] result) {
|
||||
SMServerLodeSetting setting = SMServerLodeSetting.lodeConfig.get(1);
|
||||
int[][] restTime = setting.getRestTime();
|
||||
int[][] battleTime = setting.getBattleTime();
|
||||
long mondayZeroTime = TimeUtils.getWeekZero(1);
|
||||
//休战期
|
||||
for (int[] everyTime : restTime) {
|
||||
if (TimeUtils.now() >= mondayZeroTime + everyTime[0] * 1000 && TimeUtils.now() <= mondayZeroTime + everyTime[1] * 1000) {
|
||||
result[0] = 2;
|
||||
result[1] = (int) (mondayZeroTime / 1000) + everyTime[1];
|
||||
return;
|
||||
}
|
||||
}
|
||||
//抢夺期
|
||||
for (int[] everyTime : battleTime) {
|
||||
if (TimeUtils.now() > mondayZeroTime + everyTime[0] * 1000 && TimeUtils.now() < mondayZeroTime + everyTime[1] * 1000) {
|
||||
result[0] = 1;
|
||||
result[1] = (int) (mondayZeroTime / 1000) + everyTime[1];
|
||||
return;
|
||||
}
|
||||
}
|
||||
result[0] = 0;
|
||||
result[1] = 0;
|
||||
}
|
||||
|
||||
public int getLingmaiIdOccupy(int uid, Map<String, LingMaiSecretArea> lingMaiMap) {
|
||||
for (Map.Entry<String, LingMaiSecretArea> data : lingMaiMap.entrySet()) {
|
||||
if (data.getValue().getUid() == uid) {
|
||||
return Integer.parseInt(data.getKey());
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 占领奖励 每十分钟发放一次
|
||||
*/
|
||||
|
@ -151,8 +146,22 @@ public class CrossLingmaiLogic {
|
|||
Set<String> arenaRank2 = RedisUtil.getInstence().getReverseZset(rkey2, 0, -1);
|
||||
sendMailReward(arenaRank1);
|
||||
sendMailReward(arenaRank2);
|
||||
}
|
||||
|
||||
public void initData(){
|
||||
//初始化数据
|
||||
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
if (crossGroup == -1) {
|
||||
return;
|
||||
}
|
||||
String rkey1 = RedisUtil.getInstence().getKey(RedisKey.CROSS_LINGMAI_RANK_PERSON, Integer.toString(crossGroup) + RedisKey.Delimiter_colon + "1");
|
||||
String rkey2 = RedisUtil.getInstence().getKey(RedisKey.CROSS_LINGMAI_RANK_PERSON, Integer.toString(crossGroup) + RedisKey.Delimiter_colon + "2");
|
||||
RedisUtil.getInstence().del(rkey1);
|
||||
RedisUtil.getInstence().del(rkey2);
|
||||
String inf1 = RedisUtil.getInstence().getKey(RedisKey.CROSS_LINGMAISECRET_INFO, Integer.toString(crossGroup) + RedisKey.Delimiter_colon + "1");
|
||||
String inf2 = RedisUtil.getInstence().getKey(RedisKey.CROSS_LINGMAISECRET_INFO, Integer.toString(crossGroup) + RedisKey.Delimiter_colon + "2");
|
||||
RedisUtil.getInstence().del(inf1);
|
||||
RedisUtil.getInstence().del(inf2);
|
||||
}
|
||||
|
||||
public void sendMailReward(Set<String> arenaRank) {
|
||||
|
@ -169,4 +178,9 @@ public class CrossLingmaiLogic {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class Instance {
|
||||
public final static CrossLingmaiLogic instance = new CrossLingmaiLogic();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -325,9 +325,11 @@ public class MinuteTask extends Thread {
|
|||
}
|
||||
//结算每日排行奖励
|
||||
if(hour ==21 && minute==0){
|
||||
//删除数据 TODO
|
||||
CrossLingmaiLogic.getInstance().sendMailReward();
|
||||
}
|
||||
if(hour == 9&& minute==0){
|
||||
CrossLingmaiLogic.getInstance().initData();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue