【新功能】主角修为

【新功能】山河社稷图增加每日扫荡
back_recharge
jiahuiwen 2021-10-19 17:10:06 +08:00
parent 591ebd34e8
commit 302a8a0f2d
14 changed files with 156 additions and 104 deletions

View File

@ -1,44 +0,0 @@
package com.ljsd.jieling.config.json;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
public class ConfMessage {
private static String currVerion;
private static final Logger LOGGER = LoggerFactory.getLogger(ConfMessage.class);
//加载配置开关
public static void doWork() throws IOException {
File file = new File("conf/plat-configure.json");
// File file = new File("C://ljsd/gameserver_new/conf/plat-configure.json");
if (!file.exists()) {
// LOGGER.error("the file plat-configure.json is not exists");
return;
}
InputStream in = new FileInputStream(file);
ObjectMapper mapper = new ObjectMapper();
mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
PlatConfigure platConfigure = mapper.readValue(in, PlatConfigure.class);
in.close();
String version = platConfigure.getVersion();
if (version.equalsIgnoreCase(currVerion)) {
return;
}
GlobalPlatConfigure.platConfigure = platConfigure;
currVerion = version;
LOGGER.info("PlatConfigure ->{}", GlobalPlatConfigure.platConfigure.toString());
LOGGER.debug("doWork update PlatConfigure->currVerion={},version={}", currVerion, version);
}
}

View File

@ -348,7 +348,9 @@ public interface BIReason {
int SIXIANG_UP_STAR_COST=1106;//四象心法进阶消耗
int CROSS_YUXULUNDAO_DAILYREWARD = 1107;//玉虚论道
int HERO_UP_LIKEBLE_COST=1107;//英雄提升好感度消耗
int HERO_UP_LIKEBLE_COST=1108;//英雄提升好感度消耗
int TAKE_YUHENLONGDAN = 1109;// 山河社稷每日领取玉衡龙魂
int FOUR_CHALLENGE_FIRST = 1201;//四灵试炼首通
int FOUR_CHALLENGE_SWEEP = 1202;//四灵试炼扫荡

View File

@ -228,6 +228,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
.addAllHelpFightList(CBean2Proto.getHelpFightList(user))
.addAllSixiangInfos(sixiangxinfaInfos)
.setServerOpenTime((int) (openTime / 1000))
.setXiuweiLevel(heroManager.getXiuweiLevel())
.build();
ReportUtil.onReportEvent(user, ReportEventEnum.APP_LOGIN.getType());
try {

View File

@ -6,10 +6,12 @@ import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.hardStage.HardStageLogic;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.util.MessageUtil;
import org.springframework.stereotype.Component;
import rpc.protocols.CommonProto;
import rpc.protocols.MessageTypeProto;
import rpc.protocols.PlayerInfoProto;
@Component
public class HardStageInfoRequestHandler extends BaseHandler<PlayerInfoProto.HardStageRequest> {
@Override
@ -23,6 +25,7 @@ public class HardStageInfoRequestHandler extends BaseHandler<PlayerInfoProto.Har
CommonProto.HardStageInfo.Builder info = HardStageLogic.getInfo(user);
PlayerInfoProto.HardStageResponse.Builder response = PlayerInfoProto.HardStageResponse.newBuilder();
response.setInfo(info);
response.setIsTake(user.getHardStageManager().isTakeReward());
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.HARD_STAGE_INFO_RESPONSE.getNumber(), response.build(), true);
}
}

View File

@ -0,0 +1,26 @@
package com.ljsd.jieling.handler.hardStage;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.hardStage.HardStageLogic;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.util.MessageUtil;
import org.springframework.stereotype.Component;
import rpc.protocols.CommonProto;
import rpc.protocols.MessageTypeProto;
import rpc.protocols.PlayerInfoProto;
@Component
public class HardStageTakeDailyRewarRequestHandler extends BaseHandler<PlayerInfoProto.HardStageRequest> {
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.HARD_STAGE_TAKE_DAILY_REWAR_REQUEST;
}
@Override
public void processWithProto(ISession iSession, PlayerInfoProto.HardStageRequest proto) throws Exception {
HardStageLogic.takeDailyReward(iSession, MessageTypeProto.MessageType.HARD_STAGE_TAKE_DAILY_REWAR_RESPONSE);
}
}

View File

@ -30,6 +30,7 @@ import com.ljsd.jieling.logic.expedition.ExpeditionLogic;
import com.ljsd.jieling.logic.family.GuildFightLogic;
import com.ljsd.jieling.logic.family.GuildLogic;
import com.ljsd.jieling.logic.friend.FriendLogic;
import com.ljsd.jieling.logic.hardStage.HardStageLogic;
import com.ljsd.jieling.logic.help.HelpHeroLogic;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.mission.GameEvent;
@ -462,7 +463,9 @@ public class GlobalDataManaager implements IManager {
byte[] byteBuf = MessageUtil.wrappedBuffer(session.getUid(), session.getToken(), indicationIndex,1, MessageTypeProto.MessageType.FIVE_PLAYER_REFLUSH_INDICATION_VALUE, fBuilder.build());
session.setFiveByteBuf(byteBuf);
}
// 山河社稷图 每日奖励领取状态设为false
user.getHardStageManager().setTakeReward(false);
HardStageLogic.sendHardStageIndication(user);
}else {
user.getPlayerInfoManager().setIsdayFirst(0);
}
@ -479,7 +482,6 @@ public class GlobalDataManaager implements IManager {
user.getArenaManager().setCrossYuxulundaoDailyRewad(new ArrayList<>(Arrays.asList(0,0,0)));
///清空当天推送的礼包次数
user.getPlayerInfoManager().getNewRechargeInfo().ClearDayPushMap();
}
user.getPlayerInfoManager().setLoginTime(TimeUtils.now());
}

View File

@ -21,6 +21,12 @@ public class HardStageManager extends MongoBase {
private List<Integer> noOpenId = Lists.newArrayList();//因等级限制未开的关卡
/**
*
*/
private boolean isTakeReward;
public HardStageManager() {
}
@ -139,4 +145,13 @@ public class HardStageManager extends MongoBase {
this.chapterMap = chapterMap;
updateString("chapterMap", chapterMap);
}
public boolean isTakeReward() {
return isTakeReward;
}
public void setTakeReward(boolean takeReward) {
updateString("takeReward", takeReward);
isTakeReward = takeReward;
}
}

View File

@ -66,6 +66,11 @@ public class HeroManager extends MongoBase {
*
*/
private int practiceLevel;
/**
* ()
*/
private int xiuweiLevel;
/**
*
*/
@ -572,6 +577,13 @@ public class HeroManager extends MongoBase {
return likaLv;
}
public int getXiuweiLevel() {
return xiuweiLevel;
}
public void setXiuweiLevel(int xiuweiLevel) {
this.xiuweiLevel = xiuweiLevel;
updateString("xiuweiLevel", xiuweiLevel);
}
}

View File

@ -1,15 +1,19 @@
package com.ljsd.jieling.logic.hardStage;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.activity.event.HardStageExerciseEvent;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.dao.HardStageManager;
import com.ljsd.jieling.logic.dao.Hero;
import com.ljsd.jieling.logic.dao.TeamPosHeroInfo;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.fight.specialparm.SpecialForTeamBuildEnum;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.item.ItemLogic;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.util.ItemUtil;
import com.ljsd.jieling.util.MessageUtil;
@ -349,6 +353,7 @@ public class HardStageLogic {
CommonProto.HardStageInfo.Builder info = getInfo(user);
PlayerInfoProto.HardStageResponse.Builder response = PlayerInfoProto.HardStageResponse.newBuilder();
response.setInfo(info);
response.setIsTake(user.getHardStageManager().isTakeReward());
ISession session = OnlineUserManager.getSessionByUid(user.getId());
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.HARD_STAGE_INFO_RESPONSE.getNumber(), response.build(), true);
}
@ -474,4 +479,35 @@ public class HardStageLogic {
}
//user.getHardStageManager().updateString("", user.getHardStageManager());
}
/**
*
* @param session
* @param messageType
*/
public static void takeDailyReward(ISession session, MessageTypeProto.MessageType messageType) throws Exception {
User user = UserManager.getUser(session.getUid());
if (user == null) {
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
HardStageManager hardStageManager = user.getHardStageManager();
if (hardStageManager.isTakeReward()) {
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
int dailyNumForStarsOfHardStage = SSpecialConfig.getIntegerValue(SSpecialConfig.DailyNumForStarsOfHardStage);
int basicNumOfHardStage = SSpecialConfig.getIntegerValue(SSpecialConfig.BasicNumOfHardStage);
int hardStageStarsSum = getHardStageStarsSum(user);
int count = basicNumOfHardStage + dailyNumForStarsOfHardStage * hardStageStarsSum;
int[][] drop = new int[1][];
drop[0] = new int[2];
drop[0][0] = 1226;
drop[0][1] = count;
hardStageManager.setTakeReward(true);
CommonProto.Drop.Builder dropProto = ItemUtil.drop(user, drop, BIReason.TAKE_YUHENLONGDAN);
PlayerInfoProto.HardStageDailyRewardResponse hardStageDailyRewardResponse = PlayerInfoProto.HardStageDailyRewardResponse.newBuilder()
.setDrop(dropProto)
.build();
MessageUtil.sendMessage(session, 1, messageType.getNumber(), hardStageDailyRewardResponse, true);
}
}

View File

@ -2834,6 +2834,23 @@ public class HeroLogic{
}
}
// 主角修为属性加成
int xiuweiLevel = user.getHeroManager().getXiuweiLevel();
SXiuXian sXiuXian = xiuXianMap.get(practiceLevel);
if (xiuweiLevel > 0 && sXiuXian != null) {
SXiuXian shuxingTable = SXiuXian.sXiuXianMap.get(sXiuXian.getRealmId()).get(0);
if (shuxingTable != null) {
int[][] proRank = shuxingTable.getProRank();
float[][] proLevel = shuxingTable.getProLevel();
Map<Integer, Long> otherAttriMaop = new HashMap<>(5);
for (int i = 0; i < proRank.length; i++) {
float addValue = proRank[i][1] + proLevel[i][1] * xiuweiLevel;
otherAttriMaop.put(proRank[i][0], (long) addValue);
}
combinedAttribute(otherAttriMaop, heroAllAttribute);
}
}
// //皮肤、称号加成 -- 前端未实现,暂时注释
// int decoration = user.getPlayerInfoManager().getDecoration();
// int designation = user.getPlayerInfoManager().getDesignation();

View File

@ -7,11 +7,6 @@ import com.ljsd.jieling.util.ConfigurableApplicationContextManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.*;
@ -24,12 +19,9 @@ public class ThreadManager implements IManager {
private static final Logger LOGGER = LoggerFactory.getLogger(ThreadManager.class);
private static PlatConfigureTask platConfigureTask;
private static DataReportTask dataReportTask;
private static MongoDataHandlerTask mongoDataHandlerTask;
private static ItemLogTask itemLogTask;
public static int SLEEP_INTEVAL_TIME = 60; //每1分钟检查一次
//private static OnlineUserTapTask onlineUserTapTask;//5分钟上报一次
private static Set<Future<?>> scheduledFutureSets = new HashSet<>();
@ -38,17 +30,14 @@ public class ThreadManager implements IManager {
public void init() {
platConfigureTask = ConfigurableApplicationContextManager.getBean(PlatConfigureTask.class);
mongoDataHandlerTask = ConfigurableApplicationContextManager.getBean(MongoDataHandlerTask.class);
dataReportTask = ConfigurableApplicationContextManager.getBean(DataReportTask.class);
itemLogTask = ConfigurableApplicationContextManager.getBean(ItemLogTask.class);
//onlineUserTapTask = ConfigurableApplicationContextManager.getBean(OnlineUserTapTask.class);
new RetrySendIndicationThread("retry-indi").start();
mongoDataHandlerTask.start();
dataReportTask.start();
itemLogTask.start();
//onlineUserTapTask.start();
scheduledExecutor = new ScheduledThreadPoolExecutor(8, new ScheduleThreadFactory());
scheduledExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
@ -97,24 +86,24 @@ public class ThreadManager implements IManager {
}
}
public static void main(String[] args) {
int now = (int)(System.currentTimeMillis()/1000);
// testTask 已秒为单位 延迟10s, 间隔30s为周期执行
int delayForMinute = 60 - (now%60);
ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(8, new ScheduleThreadFactory());
scheduledThreadPoolExecutor.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
System.out.println(new Date());
try {
Thread.sleep(20000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.printf(Thread.currentThread().getName());
}
},0,2, TimeUnit.SECONDS);
}
// public static void main(String[] args) {
// int now = (int)(System.currentTimeMillis()/1000);
// // testTask 已秒为单位 延迟10s, 间隔30s为周期执行
// int delayForMinute = 60 - (now%60);
// ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(8, new ScheduleThreadFactory());
// scheduledThreadPoolExecutor.scheduleAtFixedRate(new Runnable() {
// @Override
// public void run() {
// System.out.println(new Date());
// try {
// Thread.sleep(20000);
// } catch (InterruptedException e) {
// e.printStackTrace();
// }
// System.out.printf(Thread.currentThread().getName());
// }
// },0,2, TimeUnit.SECONDS);
// }
public static void go() {
@ -123,7 +112,6 @@ public class ThreadManager implements IManager {
int delayForMinute = 60 - (now%60);
LOGGER.info("delayForMinute---->>>>{}" ,delayForMinute);
scheduledFutureSets.add(scheduledExecutor.scheduleAtFixedRate(platConfigureTask, 10, SLEEP_INTEVAL_TIME, TimeUnit.SECONDS));
scheduledFutureSets.add( scheduledExecutor.scheduleAtFixedRate(new MinuteTask(), delayForMinute, 60, TimeUnit.SECONDS));
scheduledFutureSets.add( scheduledExecutor.scheduleAtFixedRate(new SecondsTask(), 0, 1, TimeUnit.SECONDS));
// scheduledFutureSets.add( scheduledExecutor.scheduleAtFixedRate(new FetchBloodyEndDataThread(), 0, 1, TimeUnit.SECONDS));

View File

@ -1,26 +0,0 @@
package com.ljsd.jieling.thread.task;
import com.ljsd.jieling.config.json.ConfMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.io.IOException;
@Component
public class PlatConfigureTask implements Runnable {
private static final Logger LOGGER = LoggerFactory.getLogger(PlatConfigureTask.class);
@Override
public void run() {
doLogic();
}
private void doLogic() {
try {
ConfMessage.doWork();
} catch (IOException e) {
e.printStackTrace();
}
}
}

View File

@ -37,6 +37,11 @@ public class SSpecialConfig implements BaseConfig {
public static final String Level_RankingShowNum = "Level_RankingShowNum";//关卡排行
public static final String FriendBlackAmount_limit = "FriendBlackAmount_limit";//黑名单上限
public static final String MaxXiuweiLevel = "MaxXiuweiLevel";//修为等级最大值
public static final String FightForPerXiuweiLevel = "FightForPerXiuweiLevel";//修为单级别所需战力
public static final String DailyNumForStarsOfHardStage = "DailyNumForStarsOfHardStage";//每有1困难关卡星级每日可领取玉衡龙魂丹数量
public static final String BasicNumOfHardStage = "BasicNumOfHardStage";//每日领取玉衡龙魂丹基础数量
public static final String lamp_lottery_content_parm = "lamp_lottery_content_parm";//资质13及以上——系统消息
public static final String lamp_rankup_hero_content_parm = "lamp_rankup_hero_content_parm";//10星及以上——系统消息
public static final String lamp_awaken_hero_content_parm = "lamp_awaken_hero_content_parm";//英雄觉醒——系统消息

View File

@ -3,6 +3,8 @@ package config;
import manager.STableManager;
import manager.Table;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@Table(name ="XiuXian")
@ -30,9 +32,22 @@ public class SXiuXian implements BaseConfig {
private float[][] proLevel;
// 目前只为主角修行等级属性使用
public static Map<Integer, Map<Integer, SXiuXian>> sXiuXianMap;
@Override
public void init() throws Exception {
sXiuXianMap = new HashMap<>();
Map<Integer, SXiuXian> config = STableManager.getConfig(SXiuXian.class);
for (Map.Entry<Integer, SXiuXian> integerSXiuXianEntry : config.entrySet()) {
SXiuXian value = integerSXiuXianEntry.getValue();
if (!sXiuXianMap.containsKey(value.getRealmId())) {
sXiuXianMap.put(value.getRealmId(), new HashMap<>(1));
}
if (value.getRealmLevel() == 0) {
sXiuXianMap.get(value.getRealmId()).put(value.getRealmLevel(), value);
}
}
}