back_recharge
parent
f4209eb50a
commit
2d0a740b7c
|
@ -150,9 +150,10 @@ public class FightDataUtil {
|
|||
for(int i=2;i<length;i++){
|
||||
int passivityId = Integer.parseInt(unitSkill[i]);
|
||||
SPassiveSkillLogicConfig sPassiveSkillLogicConfig = SPassiveSkillLogicConfig.getConfig(passivityId);
|
||||
if(sPassiveSkillLogicConfig.getCoverID()!=0)
|
||||
if(sPassiveSkillLogicConfig.getCoverID()!=0){
|
||||
tempSet.add(sPassiveSkillLogicConfig.getCoverID());
|
||||
}
|
||||
}
|
||||
for(int i=2;i<length;i++){
|
||||
LuaValue detail = new LuaTable();
|
||||
int passivityId = Integer.parseInt(unitSkill[i]);
|
||||
|
|
|
@ -480,6 +480,9 @@ public class RedisKey {
|
|||
// 邮件奖励
|
||||
public static final String MAIL_REWARD_MARK = "MAIL_REWARD_MARK";
|
||||
|
||||
// 罗浮称号奖励标记
|
||||
public static final String LUOFU_TITLE_REWARD_MARK = "LUOFU_TITLE_REWARD_MARK";
|
||||
|
||||
public static Set<String> newAreaCacChe = new HashSet<>();//进程排行 合区统一
|
||||
|
||||
public static Set<String> rankCacChe = new HashSet<>();
|
||||
|
|
|
@ -75,9 +75,9 @@ public class GetWorldArenaInfoRequestHandler extends BaseHandler<WorldProto.GetW
|
|||
Set<ZSetOperations.TypedTuple<String>> rankByKey = rank.getRankByKey(String.valueOf(crossGroup), 0, 20);
|
||||
//处理第一次在休战期开启
|
||||
if(rankByKey.size()<1){
|
||||
builder.setStage(1);
|
||||
builder.setStage(ArenaLogic.NORMAL_STATE);
|
||||
}else{
|
||||
builder.setStage(ArenaLogic.getInstance().getState());
|
||||
builder.setStage(ArenaLogic.getState());
|
||||
}
|
||||
|
||||
if (diff > setting.getRestTime()[0] && diff < setting.getRestTime()[1]) {
|
||||
|
|
|
@ -5,8 +5,6 @@ import com.ljsd.common.mogodb.MongoBase;
|
|||
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
|
||||
import com.ljsd.jieling.core.FunctionIdEnum;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.db.mongo.MongoKey;
|
||||
import com.ljsd.jieling.db.mongo.MongoUtil;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.handler.mission.Mission;
|
||||
|
@ -18,8 +16,8 @@ import com.ljsd.jieling.logic.dao.PlayerManager;
|
|||
import com.ljsd.jieling.logic.dao.TimeControllerOfFunction;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import util.MathUtils;
|
||||
import manager.STableManager;
|
||||
import util.MathUtils;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -315,7 +313,7 @@ public class MapManager extends MongoBase {
|
|||
int addValue = (updateTime - lastUpdateEnergyTime) / 60 / energyRecoverSpeed[1] * energyRecoverSpeed[0];
|
||||
if (addValue != 0) {
|
||||
int curEnergy = MathUtils.setBetweenWithMax(itemNum + addValue, 0, playerInfoManager.getMaxStamina());
|
||||
item.setItemNum(curEnergy > playerInfoManager.getMaxStamina() ? playerInfoManager.getMaxStamina() : curEnergy);
|
||||
item.setItemNum(Math.min(curEnergy, playerInfoManager.getMaxStamina()));
|
||||
KtEventUtils.onKtEvent(user, ParamEventBean.UserItemEvent, BIReason.TIME_REWARD,GlobalsDef.addReason,item.getItemId(),addValue,item.getItemNum());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -441,6 +441,8 @@ public class GlobalDataManaager implements IManager {
|
|||
RidingSwardLogic.getInstance().zeroClearRidingSwardByUser(user);
|
||||
// 公会援助
|
||||
GuildLogic.getInstance().guildHelpDayHandler(user);
|
||||
// 罗浮称号
|
||||
ArenaLogic.getInstance().takeTitleReward(user);
|
||||
|
||||
WeekCardLogic.getInstance().weekCardInfoIndication(user,0,0);
|
||||
ChallengeLogic.getInstance().ChallengeInfoIndication(session);
|
||||
|
|
|
@ -53,8 +53,8 @@ import java.util.*;
|
|||
public class ArenaLogic {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ArenaLogic.class);
|
||||
|
||||
private ArenaLogic(){}
|
||||
|
||||
private ArenaLogic() {
|
||||
}
|
||||
|
||||
|
||||
public static class Instance {
|
||||
|
@ -68,8 +68,11 @@ public class ArenaLogic {
|
|||
private int curSeason;
|
||||
private int viewSeason;
|
||||
|
||||
//未开启
|
||||
public final static int NORMAL_STATE = 1;
|
||||
//战斗
|
||||
public final static int BATTLE_STATE = 2;
|
||||
//发奖
|
||||
public final static int RELAX_STATE = 3;
|
||||
|
||||
public int getCurSeason() {
|
||||
|
@ -228,8 +231,6 @@ public class ArenaLogic {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static int getFightResultByPersonToPerson(User mine, int myteamId, User defUser, int defTeamId, ArenaRecord arenaRecord, ArenaInfoProto.ArenaChallengeResponse.Builder builder) throws Exception {
|
||||
PVPFightEvent pvpFightEvent = new PVPFightEvent(mine.getId(), myteamId, SArenaSetting.getSArenaSetting().getMostTime(), "", GameFightType.ArenaPersonFight, defUser.getId(), defTeamId);
|
||||
int myforce = HeroLogic.getInstance().calTeamTotalForce(mine, TeamEnum.TEAM_ARENA_DEFENSE.getTeamId(), false);
|
||||
|
@ -263,7 +264,6 @@ public class ArenaLogic {
|
|||
}
|
||||
|
||||
|
||||
|
||||
public int getFightResultByPersonToRobot(User mine, int myteamId, int challengeUid, ArenaInfoProto.ArenaChallengeResponse.Builder builder) throws Exception {
|
||||
PVPFightEvent pvpFightEvent = new PVPFightEvent(mine.getId(), myteamId, SArenaSetting.getSArenaSetting().getMostTime(), "", GameFightType.ArenaRobotFight, challengeUid, -1);
|
||||
int myforce = HeroLogic.getInstance().calTeamTotalForce(mine, TeamEnum.TEAM_ARENA_DEFENSE.getTeamId(), false);
|
||||
|
@ -479,17 +479,15 @@ public class ArenaLogic {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
Sa: 实际胜负值, 胜 = 1 负=0
|
||||
|
||||
Ra: A选手比赛前的分 Rb: B选手比赛前的分数
|
||||
R'a: A选手比赛完的分数 R'b: B选手比赛完的分数
|
||||
|
||||
Ea:EA = 1/(1+10^[(Rb-Ra)/400])
|
||||
Eb: EB = 1/(1+10^[(Ra-Rb)/400])
|
||||
R'a = Ra + K(Sa-Ea)
|
||||
R'b = Rb + K(Sb-Eb)
|
||||
*
|
||||
* Sa: 实际胜负值, 胜 = 1 负=0
|
||||
* <p>
|
||||
* Ra: A选手比赛前的分 Rb: B选手比赛前的分数
|
||||
* R'a: A选手比赛完的分数 R'b: B选手比赛完的分数
|
||||
* <p>
|
||||
* Ea:EA = 1/(1+10^[(Rb-Ra)/400])
|
||||
* Eb: EB = 1/(1+10^[(Ra-Rb)/400])
|
||||
* R'a = Ra + K(Sa-Ea)
|
||||
* R'b = Rb + K(Sb-Eb)
|
||||
*/
|
||||
public int calScore(int myScore, int defScore, int result) {
|
||||
SArenaSetting sArenaSetting = SArenaSetting.getSArenaSetting();
|
||||
|
@ -705,6 +703,7 @@ public class ArenaLogic {
|
|||
|
||||
/**
|
||||
* 竞技场战斗胜利/失败奖励掉落
|
||||
*
|
||||
* @param user
|
||||
* @param fightResult
|
||||
* @return
|
||||
|
@ -722,34 +721,63 @@ public class ArenaLogic {
|
|||
return ItemUtil.drop(user, dropList, 1, 0, reason);
|
||||
}
|
||||
|
||||
public void worldSendReward(){
|
||||
checkState();
|
||||
//*****************************************罗浮争锋***************************************************
|
||||
|
||||
public void checkState() {
|
||||
TimeControllerOfFunction timeControllerOfFunction = GlobalDataManaager.getInstance().getTimeControllerOfFunctionByFunctinoType(FunctionIdEnum.World_Arena);
|
||||
if (null == timeControllerOfFunction) {
|
||||
return;
|
||||
}
|
||||
int now = TimeUtils.nowInt();
|
||||
int startTime = (int) (timeControllerOfFunction.getStartTime() / 1000);
|
||||
SMServerArenaSetting setting = STableManager.getConfig(SMServerArenaSetting.class).get(1);
|
||||
int diff = now - startTime;
|
||||
if (diff >= setting.getBattleTime()[0] && diff <= setting.getBattleTime()[1]) {
|
||||
e2b();
|
||||
} else if (diff > setting.getBattleTime()[1] && diff <= setting.getRestTime()[1]) {
|
||||
b2r();
|
||||
} else if (diff > setting.getRestTime()[1]) {
|
||||
r2e();
|
||||
}
|
||||
}
|
||||
|
||||
public int getState() {
|
||||
String key = RedisUtil.getInstence().getKey(RedisKey.CROSS_SERVICE_ARENA_STATE, "");
|
||||
return Optional.ofNullable(RedisUtil.getInstence().get(key))
|
||||
.map(v->Integer.valueOf(v.toString()))
|
||||
.orElse(0);
|
||||
public static int getState() {
|
||||
String key = RedisUtil.getInstence().getKey2(RedisKey.CROSS_SERVICE_ARENA_STATE, String.valueOf(GlobleSystemLogic.crossGroup));
|
||||
Object value = RedisUtil.getInstence().get(key);
|
||||
int state = 1;
|
||||
if (value == null){
|
||||
// 兼容老状态
|
||||
key = RedisUtil.getInstence().getKey(RedisKey.CROSS_SERVICE_ARENA_STATE, "");
|
||||
value = RedisUtil.getInstence().get(key);
|
||||
if (value != null){
|
||||
setState(state);
|
||||
state = (int) value;
|
||||
}
|
||||
}else {
|
||||
state = (int) value;
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(int state) {
|
||||
String key = RedisUtil.getInstence().getKey(RedisKey.CROSS_SERVICE_ARENA_STATE, "");
|
||||
public static void setState(int state) {
|
||||
String key = RedisUtil.getInstence().getKey2(RedisKey.CROSS_SERVICE_ARENA_STATE, String.valueOf(GlobleSystemLogic.crossGroup));
|
||||
RedisUtil.getInstence().set(key, String.valueOf(state));
|
||||
}
|
||||
|
||||
private void b2r(){
|
||||
if(getState() != RELAX_STATE){
|
||||
if(getState() == BATTLE_STATE){
|
||||
public void LuoFuSendReward() {
|
||||
LOGGER.info("罗浮争霸,开始发奖");
|
||||
Map<Integer, ISession> sessionMap = OnlineUserManager.sessionMap;
|
||||
for (Map.Entry<Integer, ISession> entry : sessionMap.entrySet()) {
|
||||
MessageUtil.sendIndicationMessage(entry.getValue(), 1, MessageTypeProto.MessageType.GetWorldArenaInfoIndication_VALUE, null, true);
|
||||
}
|
||||
LOGGER.info("罗浮争锋,发奖");
|
||||
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
if (crossGroup == -1) {
|
||||
return;
|
||||
}
|
||||
boolean lock = RedisUtil.getInstence().lock("WORLD_ARENA_SEND_REWARD_RANK:" + crossGroup, TimeUtils.ONE_MINUTE * 5);
|
||||
if (!lock) {
|
||||
return;
|
||||
}
|
||||
AbstractRank rank = RankContext.getRankEnum(RankEnum.CROSS_SERVICE_ARENA.getType());
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("mserverarena_reward_title");
|
||||
TreeMap<Integer, SMServerArenaReward> rewardMapByRank = SMServerArenaReward.rewardMapByRank;
|
||||
|
@ -757,61 +785,89 @@ public class ArenaLogic {
|
|||
Set<ZSetOperations.TypedTuple<String>> rankInfo = rank.getRankByKey(String.valueOf(crossGroup), 0, -1);
|
||||
int index = 0;
|
||||
for (ZSetOperations.TypedTuple<String> stringTypedTuple : rankInfo) {
|
||||
int uid = Integer.parseInt(stringTypedTuple.getValue());
|
||||
CSPlayer player = CrossServiceLogic.getPlayerByRedis(uid);
|
||||
index++;
|
||||
int uid = Integer.parseInt(stringTypedTuple.getValue());
|
||||
if (uid < 1000) {
|
||||
continue;
|
||||
}
|
||||
CSPlayer player = CrossServiceLogic.getPlayerByRedis(uid);
|
||||
if (player == null || TimeUtils.now() > (player.getOffLineTime() + TimeUtils.WEEK)) {
|
||||
LOGGER.error("罗浮争锋发奖,玩家未登陆时间超过七天,不予发奖,uid:{},rank:{}", uid, index);
|
||||
continue;
|
||||
}
|
||||
if (uid < 1000) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
User user = UserManager.getUserNotCache(uid);
|
||||
if (user == null) {
|
||||
continue;
|
||||
}
|
||||
Map.Entry<Integer, SMServerArenaReward> entry = rewardMapByRank.floorEntry(index);
|
||||
SMServerArenaReward value = entry.getValue();
|
||||
// 称号奖励
|
||||
int[][] titleReward = value.getTitleReward();
|
||||
if (titleReward != null) {
|
||||
for (int[] reward : titleReward) {
|
||||
long time = TimeUtils.getBeginOfDay(TimeUtils.now() + reward[1] * 1000L) + TimeUtils.DAY;
|
||||
user.getPlayerInfoManager().putUserTitleValidTime(reward[0], time);
|
||||
PlayerInfoProto.UserTitleAddIndication.Builder builder = PlayerInfoProto.UserTitleAddIndication.newBuilder().setDecorationId(reward[0]).setTime((int) (time / 1000));
|
||||
MessageUtil.sendIndicationMessage(OnlineUserManager.getSessionByUid(user.getId()), 1, MessageTypeProto.MessageType.USER_TITLE_ADD_INDICATION_VALUE, builder.build(), true);
|
||||
sendTitleReward(uid,titleReward);
|
||||
}
|
||||
}
|
||||
|
||||
// 基础奖励邮件
|
||||
String content = SErrorCodeEerverConfig.getI18NMessageNeedConvert("mserverarena_reward_content", new Object[]{index}, new int[]{0}, "#");
|
||||
MailLogic.getInstance().sendMail(uid, title, content, StringUtil.parseArrayToString(value.getSeasonReward()), TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
try {
|
||||
MongoUtil.getLjsdMongoTemplate().lastUpdate();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
LOGGER.info("罗浮争霸:转到休息状态,nowstate:{} to RELAX_STATE", getState());
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送标题奖励
|
||||
* @param uid
|
||||
* @param titleReward
|
||||
*/
|
||||
public void sendTitleReward(int uid, int[][] titleReward){
|
||||
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||
String key = redisUtil.getKey2(RedisKey.LUOFU_TITLE_REWARD_MARK, String.valueOf(uid));
|
||||
for (int[] reward : titleReward) {
|
||||
long time = TimeUtils.getBeginOfDay(TimeUtils.now() + reward[1] * 1000L) + TimeUtils.DAY;
|
||||
redisUtil.putMapEntry2(key,String.valueOf(reward[0]),time);
|
||||
}
|
||||
redisUtil.expire(key,TimeUtils.WEEK/1000);
|
||||
}
|
||||
|
||||
/**
|
||||
* 领取标题奖励
|
||||
* @param user
|
||||
*/
|
||||
public void takeTitleReward(User user){
|
||||
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||
String key = redisUtil.getKey2(RedisKey.LUOFU_TITLE_REWARD_MARK, String.valueOf(user.getId()));
|
||||
Map<String, Long> titleMap = redisUtil.getMapValues(key, String.class, Long.class);
|
||||
for (Map.Entry<String, Long> entry : titleMap.entrySet()) {
|
||||
int titleId = Integer.parseInt(entry.getKey());
|
||||
Long time = entry.getValue();
|
||||
user.getPlayerInfoManager().putUserTitleValidTime(titleId, time);
|
||||
PlayerInfoProto.UserTitleAddIndication.Builder builder = PlayerInfoProto.UserTitleAddIndication.newBuilder().setDecorationId(titleId).setTime((int) (time / 1000));
|
||||
MessageUtil.sendIndicationMessage(OnlineUserManager.getSessionByUid(user.getId()), 1, MessageTypeProto.MessageType.USER_TITLE_ADD_INDICATION_VALUE, builder.build(), true);
|
||||
}
|
||||
redisUtil.del(key);
|
||||
}
|
||||
|
||||
private void b2r() {
|
||||
if (getState() == BATTLE_STATE) {
|
||||
if (getState() != RELAX_STATE) {
|
||||
LuoFuSendReward();
|
||||
}
|
||||
LOGGER.info("罗浮争霸:转到休息状态,now state:{} to RELAX_STATE", getState());
|
||||
getInstance().setState(RELAX_STATE);
|
||||
setState(RELAX_STATE);
|
||||
}
|
||||
}
|
||||
|
||||
public void r2e() {
|
||||
if (getState() != NORMAL_STATE) {
|
||||
LOGGER.info("罗浮争霸:转到未开始状态,now state:{} to NORMAL_STATE", getState());
|
||||
getInstance().setState(NORMAL_STATE);
|
||||
setState(NORMAL_STATE);
|
||||
}
|
||||
}
|
||||
|
||||
public void e2b() {
|
||||
if (getState() != BATTLE_STATE) {
|
||||
LOGGER.info("罗浮争霸:转到战斗状态,now state:{} to BATTLE_STATE", getState());
|
||||
getInstance().setState(BATTLE_STATE);
|
||||
setState(BATTLE_STATE);
|
||||
initRank();
|
||||
Map<Integer, ISession> sessionMap = OnlineUserManager.sessionMap;
|
||||
for (Map.Entry<Integer, ISession> entry : sessionMap.entrySet()) {
|
||||
|
@ -820,22 +876,6 @@ public class ArenaLogic {
|
|||
}
|
||||
}
|
||||
|
||||
private void checkState(){
|
||||
TimeControllerOfFunction timeControllerOfFunction = GlobalDataManaager.getInstance().getTimeControllerOfFunctionByFunctinoType(FunctionIdEnum.World_Arena);
|
||||
if(null == timeControllerOfFunction){
|
||||
return;
|
||||
}
|
||||
long diff = (System.currentTimeMillis() - timeControllerOfFunction.getStartTime())/1000;
|
||||
SMServerArenaSetting setting = STableManager.getConfig(SMServerArenaSetting.class).get(1);
|
||||
if (diff >= setting.getBattleTime()[0] && diff <= setting.getBattleTime()[1]) {
|
||||
e2b();
|
||||
}else if (diff > setting.getBattleTime()[1] && diff <= setting.getRestTime()[1]) {
|
||||
b2r();
|
||||
} else if (diff > setting.getRestTime()[1]) {
|
||||
r2e();
|
||||
}
|
||||
}
|
||||
|
||||
static List<Integer> randomCrossRobot(int start, int end, int nums) {
|
||||
List<Integer> robotIds = new LinkedList<>();
|
||||
int index = 0;
|
||||
|
@ -877,7 +917,9 @@ public class ArenaLogic {
|
|||
List<Integer> groupList = new ArrayList<>(8);
|
||||
|
||||
groupValues.forEach((k, v) -> {
|
||||
if(v==crossGroup){ groupList.add(k);}
|
||||
if (v == crossGroup) {
|
||||
groupList.add(k);
|
||||
}
|
||||
});
|
||||
|
||||
int[] fightArea = STableManager.getConfig(SMServerArenaSetting.class).get(1).getFightArea();
|
||||
|
|
|
@ -172,7 +172,7 @@ public class MinuteTask extends Thread {
|
|||
}
|
||||
|
||||
try {
|
||||
ArenaLogic.getInstance().worldSendReward();
|
||||
ArenaLogic.getInstance().checkState();
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
LOGGER.error("Exception::=>{}",e.toString());
|
||||
|
|
|
@ -84,14 +84,13 @@ public class CBean2Proto {
|
|||
if(itemNum == -1){
|
||||
itemNum = item.getItemNum();
|
||||
}
|
||||
CommonProto.Item itemProto = CommonProto.Item
|
||||
return CommonProto.Item
|
||||
.newBuilder()
|
||||
.setItemId(item.getItemId())
|
||||
.setItemNum(itemNum)
|
||||
.setEndingTime(item.getEndingTime())
|
||||
.setNextFlushTime(item.getEndingTime() + getRecoverSpeedByItem(item.getItemId()))
|
||||
.build();
|
||||
return itemProto;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue