第一版
(cherry picked from commit 12c3d5d1ba0766fc17b69959690a656dabf14fc6)back_recharge
parent
01457210b5
commit
18f91727e4
|
@ -26,6 +26,7 @@ public enum FightType {
|
|||
HardStage(20),//山河社稷图
|
||||
|
||||
FourChallenge(21),//四灵试炼
|
||||
QIJIE_FIGHT(23), //七界试炼
|
||||
;
|
||||
|
||||
private int type;
|
||||
|
|
|
@ -1327,8 +1327,7 @@ public class TimeUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* 获取周几, 周日 0; 其他正常
|
||||
*
|
||||
* 获取周几
|
||||
* @return
|
||||
*/
|
||||
public static int getDayOfWeek() {
|
||||
|
|
|
@ -69,6 +69,7 @@ public enum FunctionIdEnum {
|
|||
GodTree(84,null),
|
||||
HongMeng(86,null),
|
||||
CrossYuxulundao(87,null),//跨服-玉虚论道
|
||||
CrossSevenWorld(112,null),//七界试炼
|
||||
WeekGood(9091,null),
|
||||
|
||||
;
|
||||
|
|
|
@ -387,6 +387,11 @@ public class RedisKey {
|
|||
*/
|
||||
public final static String HELP_FIGHT_DELETE = "HELP_FIGHT_DELETE";
|
||||
|
||||
/**
|
||||
* 七届积分排行
|
||||
*/
|
||||
public static final String SEVEN_WORLD_INTEGRAL_RANK = "SEVEN_WORLD_INTEGRAL_RANK";
|
||||
|
||||
public static Set<String> familyKey = new HashSet<>();
|
||||
|
||||
public static Set<String> newAreaCacChe = new HashSet<>();//进程排行 合区统一
|
||||
|
|
|
@ -347,4 +347,8 @@ public interface BIReason {
|
|||
int FOUR_CHALLENGE_FIRST = 1201;//四灵试炼首通
|
||||
int FOUR_CHALLENGE_SWEEP = 1202;//四灵试炼扫荡
|
||||
|
||||
int SEVEN_WORLD_ACTIVATION_RELIC = 1210;//七界,解锁遗物
|
||||
int SEVEN_WORLD_CHALLENGE = 1211;//七界,挑战
|
||||
|
||||
|
||||
}
|
|
@ -21,7 +21,6 @@ import org.springframework.stereotype.Component;
|
|||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@Component
|
||||
public class GetArenaRecordHandler extends BaseHandler {
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
package com.ljsd.jieling.handler.sevenworld;
|
||||
|
||||
import com.google.protobuf.GeneratedMessage;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.sevenworld.SevenWorldLogic;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/9/7 16:47:13
|
||||
* @Description: 七届试炼,挑战协议
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Component
|
||||
public class SevenWorldChallengeHandler extends BaseHandler<PlayerInfoProto.SevenWorldChallengeRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.SevenWorldChallengeRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneratedMessage processWithProto(int uid, PlayerInfoProto.SevenWorldChallengeRequest proto) throws Exception {
|
||||
return SevenWorldLogic.getInstance().sevenWorldChallenge(uid,proto);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.ljsd.jieling.handler.sevenworld;
|
||||
|
||||
import com.google.protobuf.GeneratedMessage;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
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.rank.RankContext;
|
||||
import com.ljsd.jieling.logic.rank.RankEnum;
|
||||
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
|
||||
import com.ljsd.jieling.logic.sevenworld.SevenWorldLogic;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/9/7 16:48:09
|
||||
* @Description: 获取七界试炼信息界面
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Component
|
||||
public class SevenWorldInfoHandler extends BaseHandler<PlayerInfoProto.SevenWorldInfoRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.SevenWorldInfoRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneratedMessage processWithProto(int uid, PlayerInfoProto.SevenWorldInfoRequest proto) throws Exception {
|
||||
return SevenWorldLogic.getInstance().getSevenWorldInfo(uid,proto);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.ljsd.jieling.handler.sevenworld;
|
||||
|
||||
import com.google.protobuf.GeneratedMessage;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
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.sevenworld.SevenWorldLogic;
|
||||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import config.SQijieHolyConfig;
|
||||
import manager.STableManager;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/9/8 13:53:14
|
||||
* @Description: 七界试炼,遗物信息处理
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Component
|
||||
public class SevenWorldRelicInfoHandler extends BaseHandler<PlayerInfoProto.SevenWorldRelicRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.SevenWorldRelicRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GeneratedMessage processWithProto(int uid, PlayerInfoProto.SevenWorldRelicRequest proto) throws Exception {
|
||||
return SevenWorldLogic.getInstance().getSevenWorldRelicInfo(uid,proto);
|
||||
}
|
||||
|
||||
}
|
|
@ -174,6 +174,19 @@ public class PlayerManager extends MongoBase {
|
|||
// 是否是首次开启四灵
|
||||
private boolean openFourChallenge = false;
|
||||
|
||||
/**
|
||||
* 七界层数, key: 周几 value: 层id
|
||||
*/
|
||||
private Map<Integer,Integer> sevenWorldTier = new HashMap<>();
|
||||
/**
|
||||
* 开启的七界层数, key: 七届类型, value: 每种类型对应开启的层id列表
|
||||
*/
|
||||
private Map<Integer,List<Integer>> sevenWorldOpenTier = new HashMap<>();
|
||||
/**
|
||||
* 七界试炼遗物信息,只存储激活的遗物信息, key:遗物id, value:遗物状态,0:未激活,1:已激活
|
||||
*/
|
||||
private Map<Integer,Integer> sevenWorldRelic = new HashMap<>();
|
||||
|
||||
public PlayerManager(){
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
}
|
||||
|
@ -1214,4 +1227,59 @@ public class PlayerManager extends MongoBase {
|
|||
this.openFourChallenge = openFourChallenge;
|
||||
updateString("openFourChallenge",openFourChallenge);
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getSevenWorldTier() {
|
||||
return sevenWorldTier;
|
||||
}
|
||||
|
||||
public int getSevenWorldTier(int week) {
|
||||
return sevenWorldTier.getOrDefault(week,0);
|
||||
}
|
||||
|
||||
public void setSevenWorldTier(Map<Integer, Integer> sevenWorldTier) {
|
||||
this.sevenWorldTier = sevenWorldTier;
|
||||
updateString("sevenWorldTier",sevenWorldTier);
|
||||
}
|
||||
|
||||
public void putSevenWorldTier(int week, int tierId) {
|
||||
this.sevenWorldTier.put(week,tierId);
|
||||
updateString("sevenWorldTier",sevenWorldTier);
|
||||
}
|
||||
|
||||
public Map<Integer, List<Integer>> getSevenWorldOpenTier() {
|
||||
return sevenWorldOpenTier;
|
||||
}
|
||||
|
||||
public List<Integer> getSevenWorldOpenTier(int key) {
|
||||
return sevenWorldOpenTier.getOrDefault(key,new ArrayList<>());
|
||||
}
|
||||
|
||||
public void setSevenWorldOpenTier(Map<Integer, List<Integer>> sevenWorldOpenTier) {
|
||||
this.sevenWorldOpenTier = sevenWorldOpenTier;
|
||||
updateString("sevenWorldOpenTier",sevenWorldOpenTier);
|
||||
}
|
||||
|
||||
public void putSevenWorldOpenTier(int key,List<Integer> list) {
|
||||
this.sevenWorldOpenTier.put(key,list);
|
||||
updateString("sevenWorldOpenTier",sevenWorldOpenTier);
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getSevenWorldRelic() {
|
||||
return sevenWorldRelic;
|
||||
}
|
||||
|
||||
public boolean sevenWorldRelicIsOpen(int id) {
|
||||
Integer integer = sevenWorldRelic.get(id);
|
||||
return integer != null;
|
||||
}
|
||||
|
||||
public void setSevenWorldRelic(Map<Integer, Integer> sevenWorldRelic) {
|
||||
this.sevenWorldRelic = sevenWorldRelic;
|
||||
updateString("sevenWorldRelic",sevenWorldRelic);
|
||||
}
|
||||
|
||||
public void putSevenWorldRelic(int id, int status) {
|
||||
this.sevenWorldRelic.put(id,status);
|
||||
updateString("sevenWorldRelic",sevenWorldRelic);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public enum TeamEnum {
|
|||
FOURCHALLENGE_PEOPLE_TEAM(3001,"四灵试炼-人"),
|
||||
FOURCHALLENGE_BUDDHA_TEAM(3002,"四灵试炼-佛"),
|
||||
FOURCHALLENGE_MONSTER_TEAM(3003,"四灵试炼-妖"),
|
||||
FOURCHALLENGE_MORALITY_TEAM(3004,"四灵试炼-道"),
|
||||
SEVEN_WORLD_TEAM(2101,"七届试炼编队",1,0),
|
||||
;
|
||||
|
||||
/**
|
||||
|
|
|
@ -508,8 +508,8 @@ public class DeathPathLogic {
|
|||
for (ZSetOperations.TypedTuple<String> n : allGuild) {
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(Integer.parseInt(n.getValue()));
|
||||
if(guildInfo!=null){
|
||||
GuildCache crossGuild = CrossDeathPathLogic.getCrossGuild(guildInfo.getId());
|
||||
String name = CrossDeathPathLogic.getInstance().getServerName(crossGuild.getServerId());
|
||||
GuildCache crossGuild = CrossServiceLogic.getCrossGuild(guildInfo.getId());
|
||||
String name = CrossServiceLogic.simplifyServerName(crossGuild.getServerId());
|
||||
String serverName = getGroupId()>0?name:"";
|
||||
Family.DeathPathInfo info = Family.DeathPathInfo.newBuilder()
|
||||
.setGuildName(guildInfo.getName()).setGid(currFirstGuildId)
|
||||
|
|
|
@ -52,6 +52,7 @@ public enum GameFightType {
|
|||
TowerMap(FightType.TowerMap,new DefaultWithoutHandFightHandler(),null),
|
||||
|
||||
FourChallenge(FightType.FourChallenge,new DefaultWithoutHandFightHandler(),null),
|
||||
SEVENWORLD(FightType.QIJIE_FIGHT,new DefaultWithoutHandFightHandler(),null),
|
||||
;
|
||||
|
||||
|
||||
|
|
|
@ -56,7 +56,8 @@ public enum RankEnum {
|
|||
CROSS_SHAN_HE_SHE_JI_STAR_RANK(35,RedisKey.SHAN_HE_SHE_JI_STAR_RANK,ForceRank::new,true),//山河社稷星星排行榜
|
||||
CROSS_GUILD_FORCE_RANK(36,RedisKey.GUILD_FORCE_RANK,CrossGuildForceRank::new,true),//跨服公会总战力排行
|
||||
|
||||
CROSS_YUXULUNDAO_RANK(37,RedisKey.CROSS_YUXULUNDAO_RANK,CrossYuXuLunDaoRank::new,true)//跨服玉虚论道
|
||||
CROSS_YUXULUNDAO_RANK(37,RedisKey.CROSS_YUXULUNDAO_RANK,CrossYuXuLunDaoRank::new,true),//跨服玉虚论道
|
||||
CROSS_SEVEN_WORLD_RANK(39,RedisKey.SEVEN_WORLD_INTEGRAL_RANK,CrossRank::new,true)//跨服七届试炼
|
||||
;
|
||||
|
||||
private int type;
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package com.ljsd.jieling.logic.rank.rankImpl;
|
||||
|
||||
import com.ljsd.jieling.db.redis.RedisUtil;
|
||||
|
||||
/**
|
||||
* @author hj
|
||||
* @date 2019/11/27
|
||||
* @discribe 跨服排行
|
||||
*/
|
||||
public class CrossRank extends AbstractRank {
|
||||
public CrossRank(int type, String redisKey) {
|
||||
super(type, redisKey);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRank(int uid, String rkey, double... data){
|
||||
String key = RedisUtil.getInstence().getKey(redisKey,rkey,false);
|
||||
RedisUtil.getInstence().incrementZsetScore(key,"",String.valueOf(uid), getScore(data));
|
||||
}
|
||||
|
||||
@Override
|
||||
public long[] getDataByScore(Double score) {
|
||||
return new long[]{score.intValue()};
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getScore(double... data) {
|
||||
return data[0];
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,254 @@
|
|||
package com.ljsd.jieling.logic.sevenworld;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.core.FunctionIdEnum;
|
||||
import com.ljsd.jieling.core.GlobalsDef;
|
||||
import com.ljsd.jieling.core.HandlerLogicThread;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.logic.GlobleSystemLogic;
|
||||
import com.ljsd.jieling.logic.dao.TeamEnum;
|
||||
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.FightDispatcher;
|
||||
import com.ljsd.jieling.logic.fight.GameFightType;
|
||||
import com.ljsd.jieling.logic.fight.PVEFightEvent;
|
||||
import com.ljsd.jieling.logic.fight.result.FightResult;
|
||||
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.CBean2Proto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import config.*;
|
||||
import manager.STableManager;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/9/6 17:53:18
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Component
|
||||
public class SevenWorldLogic {
|
||||
/**
|
||||
* 获取单例
|
||||
* @return
|
||||
*/
|
||||
public static SevenWorldLogic instance = new SevenWorldLogic();
|
||||
private SevenWorldLogic(){}
|
||||
public static SevenWorldLogic getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动开启状态
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
public static boolean open(User user){
|
||||
SGlobalSystemConfig systemConfig = SGlobalSystemConfig.getConfigById(FunctionIdEnum.CrossSevenWorld.getFunctionType());
|
||||
// 等级验证
|
||||
boolean checkOpen = HandlerLogicThread.checkOpen(user, systemConfig);
|
||||
if (!checkOpen){
|
||||
return false;
|
||||
}
|
||||
// 跨服验证
|
||||
int crossGroup = GlobleSystemLogic.getInstence().getCrossGroup();
|
||||
if (crossGroup < 0){
|
||||
return false;
|
||||
}
|
||||
// 时间验证
|
||||
int week = STableManager.getConfig(SMServerArenaSetting.class).get(3).getOpenWeek()-1;
|
||||
long before = TimeUtils.stringToTimeLong2(GameApplication.serverConfig.getOpenTime());
|
||||
return TimeUtils.isAfterTimeByWeek(before, TimeUtils.now(), week);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证客户端信息,返回用户
|
||||
* @param uid
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
private User verify(int uid) throws Exception {
|
||||
// 用户信息
|
||||
User user = UserManager.getUser(uid);
|
||||
if (user == null) {
|
||||
throw new ErrorCodeException(ErrorCode.UNKNOWN);
|
||||
}
|
||||
// 开关
|
||||
boolean open = SevenWorldLogic.open(user);
|
||||
if (!true){
|
||||
throw new ErrorCodeException(ErrorCode.ACTIVITY_NOT_OPEN,"功能未开启");
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作七界试炼界面信息
|
||||
* @param uid
|
||||
* @param proto
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public PlayerInfoProto.SevenWorldInfoResponse getSevenWorldInfo(int uid, PlayerInfoProto.SevenWorldInfoRequest proto) throws Exception {
|
||||
User user = verify(uid);
|
||||
// 当前周几
|
||||
int week = TimeUtils.getDayOfWeek();
|
||||
// 客户端传层数不为0,表示切换层数
|
||||
int tierId = proto.getTierId();
|
||||
if (tierId > 0){
|
||||
List<Integer> list = user.getPlayerInfoManager().getSevenWorldOpenTier().get(week);
|
||||
if (list == null || !list.contains(tierId)){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"层数不存在");
|
||||
}
|
||||
// 赋值
|
||||
user.getPlayerInfoManager().putSevenWorldTier(week,tierId);
|
||||
}else {
|
||||
tierId = user.getPlayerInfoManager().getSevenWorldTier(week);
|
||||
}
|
||||
|
||||
// 默认值
|
||||
if (tierId == 0){
|
||||
tierId = Collections.min(SQijieStage.dateMap.get(week));
|
||||
}
|
||||
|
||||
// 从排行榜获取信息
|
||||
AbstractRank rankEnum = RankContext.getRankEnum(RankEnum.CROSS_SEVEN_WORLD_RANK.getType());
|
||||
PlayerInfoProto.RankResponse.Builder builder = PlayerInfoProto.RankResponse.newBuilder();
|
||||
rankEnum.getCrossMyInfo(user,"",builder);
|
||||
|
||||
// 层数,排名,积分
|
||||
int ranking = builder.getMyRankInfo().getRank();
|
||||
int integral = builder.getMyRankInfo().getParam2();
|
||||
int count = user.getPlayerInfoManager().getSevenWorldOpenTier().values().stream().mapToInt(List::size).sum();
|
||||
|
||||
return PlayerInfoProto.SevenWorldInfoResponse.newBuilder()
|
||||
.setId(tierId).setRanking(ranking).setIntegral(integral).setTotalTier(40).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作七界试炼遗物信息
|
||||
* @param uid
|
||||
* @param proto
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public PlayerInfoProto.SevenWorldRelicResponse getSevenWorldRelicInfo(int uid, PlayerInfoProto.SevenWorldRelicRequest proto) throws Exception {
|
||||
User user = verify(uid);
|
||||
// 开启层数验证
|
||||
int value = SSpecialConfig.getIntegerValue(SSpecialConfig.QIJIEHOLYCONFIG);
|
||||
int count = user.getPlayerInfoManager().getSevenWorldOpenTier().values().stream().mapToInt(List::size).sum();
|
||||
if (value > count){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"未达到层数");
|
||||
}
|
||||
|
||||
// 客户端传id不为0,表示操作遗物
|
||||
int relicId = proto.getRelicId();
|
||||
if (relicId > 0){
|
||||
Integer relic = user.getPlayerInfoManager().getSevenWorldRelic().get(relicId);
|
||||
// null表示遗物未解锁
|
||||
if (relic == null){
|
||||
SQijieHolyConfig config = STableManager.getConfig(SQijieHolyConfig.class).get(relic);
|
||||
if (config == null){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL,"遗物信息未找到");
|
||||
}
|
||||
// 消耗道具
|
||||
int[][] cost = new int[][]{config.getCost()};
|
||||
boolean itemCost = ItemUtil.itemCost(user, cost, BIReason.SEVEN_WORLD_ACTIVATION_RELIC, 0);
|
||||
if (!itemCost){
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH,"道具不足");
|
||||
}
|
||||
user.getPlayerInfoManager().putSevenWorldRelic(relicId,1);
|
||||
}
|
||||
else {
|
||||
// 已解锁遗物,修改状态
|
||||
int status = relic == 0?1:0;
|
||||
user.getPlayerInfoManager().putSevenWorldRelic(relicId,status);
|
||||
}
|
||||
}
|
||||
|
||||
List<CommonProto.Relic> relicList = CBean2Proto.getSevenWorldRelicList(user);
|
||||
return PlayerInfoProto.SevenWorldRelicResponse.newBuilder().addAllInfo(relicList).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 七界试炼,挑战
|
||||
* @param uid
|
||||
* @param proto
|
||||
* @return
|
||||
*/
|
||||
public PlayerInfoProto.SevenWorldChallengeResponse sevenWorldChallenge(int uid, PlayerInfoProto.SevenWorldChallengeRequest proto) throws Exception {
|
||||
User user = verify(uid);
|
||||
// 今天周几
|
||||
int week = TimeUtils.getDayOfWeek();
|
||||
// 当前天数挑战过的层
|
||||
List<Integer> openTier = user.getPlayerInfoManager().getSevenWorldOpenTier(week);
|
||||
// 层数id
|
||||
int tierId = proto.getTierId();
|
||||
Map<Integer, SQijieStage> stageMap = STableManager.getConfig(SQijieStage.class);
|
||||
Set<Integer> set = SQijieStage.dateMap.get(week);
|
||||
// 是否是今天开启的层
|
||||
SQijieStage stage = stageMap.get(tierId);
|
||||
if (stage == null || !set.contains(tierId)){
|
||||
throw new ErrorCodeException(ErrorCode.CFG_NULL,"层数信息错误");
|
||||
}
|
||||
// 上一层
|
||||
SQijieStage stageNext = stageMap.get(stage.getNextID());
|
||||
// null表示第一层,上一层没有挑战不能挑战当前层
|
||||
if (stageNext != null && !openTier.contains(stageNext.getId())){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"当前层未解锁");
|
||||
}
|
||||
// 队伍验证
|
||||
List<TeamPosHeroInfo> heroInfos = user.getTeamPosManager().getTeamPosForHero().get(TeamEnum.SEVEN_WORLD_TEAM.getTeamId());
|
||||
if (heroInfos == null || heroInfos.isEmpty()){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"编队不能为空");
|
||||
}
|
||||
|
||||
PlayerInfoProto.SevenWorldChallengeResponse.Builder builder = PlayerInfoProto.SevenWorldChallengeResponse.newBuilder();
|
||||
// 战斗逻辑
|
||||
PVEFightEvent pveFightEvent = new PVEFightEvent(user.getId(), TeamEnum.SEVEN_WORLD_TEAM.getTeamId(), 20, "", GameFightType.SEVENWORLD, stage.getMonsterGroup(), 3);
|
||||
FightResult fightResult = FightDispatcher.dispatcher(pveFightEvent);
|
||||
// 战斗返回结果
|
||||
long[] checkResult = fightResult.getCheckResult();
|
||||
|
||||
// 挑战成功,计算奖励
|
||||
if (checkResult[0] == 1){
|
||||
int[][] reward = rewardBuff(user, fightResult, stage);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, reward, BIReason.SEVEN_WORLD_CHALLENGE);
|
||||
builder.setDrop(drop);
|
||||
}
|
||||
// 战斗数据
|
||||
builder.setResult((int)checkResult[0]);
|
||||
builder.setFightData(fightResult.getFightData());
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
private int[][] rewardBuff(User user, FightResult fightResult, SQijieStage stage){
|
||||
List<TeamPosHeroInfo> heroInfos = user.getTeamPosManager().getTeamPosForHero().get(TeamEnum.SEVEN_WORLD_TEAM.getTeamId());
|
||||
Map<Integer, SQijieUpgrade> upgradeMap = STableManager.getConfig(SQijieUpgrade.class);
|
||||
// 队伍加成
|
||||
int[] conditionValue = stage.getConditionValue();
|
||||
for (int v : conditionValue) {
|
||||
SQijieUpgrade upgrade = upgradeMap.get(v);
|
||||
if (upgrade.getPropertyName() != -1){
|
||||
|
||||
}
|
||||
if (upgrade.getProfession() != -1){
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -1097,10 +1097,27 @@ public class CBean2Proto {
|
|||
*/
|
||||
public static List<CommonProto.beautyBagCardInfo> getBeautyBagCardInfo(User user){
|
||||
List<CommonProto.beautyBagCardInfo> list = new ArrayList<>();
|
||||
user.getHeroManager().getBeautyBagCardInfoMap().entrySet().forEach(v->{
|
||||
user.getHeroManager().getBeautyBagCardInfoMap().forEach((key, value) -> {
|
||||
CommonProto.beautyBagCardInfo builder = CommonProto.beautyBagCardInfo.newBuilder()
|
||||
.setId(v.getKey())
|
||||
.setEquip(v.getValue())
|
||||
.setId(key)
|
||||
.setEquip(value)
|
||||
.build();
|
||||
list.add(builder);
|
||||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取七界试炼,遗物信息
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
public static List<CommonProto.Relic> getSevenWorldRelicList(User user){
|
||||
List<CommonProto.Relic> list = new ArrayList<>();
|
||||
user.getPlayerInfoManager().getSevenWorldRelic().forEach((key,value)->{
|
||||
CommonProto.Relic builder = CommonProto.Relic.newBuilder()
|
||||
.setId(key)
|
||||
.setStatus(value)
|
||||
.build();
|
||||
list.add(builder);
|
||||
});
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="MServerRankConfig")
|
||||
public class SMServerRankConfig implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int rankId;
|
||||
|
||||
private int rankGrade;
|
||||
|
||||
private int rankLevel;
|
||||
|
||||
private int[][] firstReward;
|
||||
|
||||
private int[][] dailyReward;
|
||||
|
||||
private int scoreLow;
|
||||
|
||||
private int scoreUp;
|
||||
|
||||
private int resetRankID;
|
||||
|
||||
private int[] fitRobotPool;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getRankId() {
|
||||
return rankId;
|
||||
}
|
||||
|
||||
public int getRankGrade() {
|
||||
return rankGrade;
|
||||
}
|
||||
|
||||
public int getRankLevel() {
|
||||
return rankLevel;
|
||||
}
|
||||
|
||||
public int[][] getFirstReward() {
|
||||
return firstReward;
|
||||
}
|
||||
|
||||
public int[][] getDailyReward() {
|
||||
return dailyReward;
|
||||
}
|
||||
|
||||
public int getScoreLow() {
|
||||
return scoreLow;
|
||||
}
|
||||
|
||||
public int getScoreUp() {
|
||||
return scoreUp;
|
||||
}
|
||||
|
||||
public int getResetRankID() {
|
||||
return resetRankID;
|
||||
}
|
||||
|
||||
public int[] getFitRobotPool() {
|
||||
return fitRobotPool;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="MServerRankReward")
|
||||
public class SMServerRankReward implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int minRank;
|
||||
|
||||
private int maxRank;
|
||||
|
||||
private int[][] seasonReward;
|
||||
|
||||
private int[][] titleReward;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getMinRank() {
|
||||
return minRank;
|
||||
}
|
||||
|
||||
public int getMaxRank() {
|
||||
return maxRank;
|
||||
}
|
||||
|
||||
public int[][] getSeasonReward() {
|
||||
return seasonReward;
|
||||
}
|
||||
|
||||
public int[][] getTitleReward() {
|
||||
return titleReward;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="QijieHolyConfig")
|
||||
public class SQijieHolyConfig implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int quality;
|
||||
|
||||
private int[][] attri;
|
||||
|
||||
private int[] cost;
|
||||
|
||||
private int[] addition;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getQuality() {
|
||||
return quality;
|
||||
}
|
||||
|
||||
public int[][] getAttri() {
|
||||
return attri;
|
||||
}
|
||||
|
||||
public int[] getCost() {
|
||||
return cost;
|
||||
}
|
||||
|
||||
public int[] getAddition() {
|
||||
return addition;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="QijieRanking")
|
||||
public class SQijieRanking implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int minRank;
|
||||
|
||||
private int maxRank;
|
||||
|
||||
private float[][] rankingReward;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getMinRank() {
|
||||
return minRank;
|
||||
}
|
||||
|
||||
public int getMaxRank() {
|
||||
return maxRank;
|
||||
}
|
||||
|
||||
public float[][] getRankingReward() {
|
||||
return rankingReward;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Table(name ="QijieStage")
|
||||
public class SQijieStage implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private String chapter;
|
||||
|
||||
private int bossId;
|
||||
|
||||
private int date;
|
||||
|
||||
private int qijieType;
|
||||
|
||||
private int stage;
|
||||
|
||||
private int nextID;
|
||||
|
||||
private int monsterGroup;
|
||||
|
||||
private int[] buff;
|
||||
|
||||
private int[] conditionValue;
|
||||
|
||||
private int[] addition;
|
||||
|
||||
private int[][] roundReward;
|
||||
|
||||
private int[][] reward;
|
||||
|
||||
private int[] jielingReward;
|
||||
|
||||
private int[] integral;
|
||||
|
||||
public static Map<Integer, Set<Integer>> dateMap = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
Map<Integer, SQijieStage> config = STableManager.getConfig(SQijieStage.class);
|
||||
Map<Integer, Set<Integer>> map = new HashMap<>();
|
||||
config.forEach((k,v)->{
|
||||
Set<Integer> set = map.getOrDefault(v.getDate(), new HashSet<>());
|
||||
set.add(k);
|
||||
map.put(v.getDate(),set);
|
||||
});
|
||||
dateMap = map;
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getChapter() {
|
||||
return chapter;
|
||||
}
|
||||
|
||||
public int getBossId() {
|
||||
return bossId;
|
||||
}
|
||||
|
||||
public int getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
public int getQijieType() {
|
||||
return qijieType;
|
||||
}
|
||||
|
||||
public int getStage() {
|
||||
return stage;
|
||||
}
|
||||
|
||||
public int getMonsterGroup() {
|
||||
return monsterGroup;
|
||||
}
|
||||
|
||||
public int[] getBuff() {
|
||||
return buff;
|
||||
}
|
||||
|
||||
public int[] getConditionValue() {
|
||||
return conditionValue;
|
||||
}
|
||||
|
||||
public int[] getAddition() {
|
||||
return addition;
|
||||
}
|
||||
|
||||
public int[][] getRoundReward() {
|
||||
return roundReward;
|
||||
}
|
||||
|
||||
public int[][] getReward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
public int[] getJielingReward() {
|
||||
return jielingReward;
|
||||
}
|
||||
|
||||
public int[] getIntegral() {
|
||||
return integral;
|
||||
}
|
||||
|
||||
public int getNextID() {
|
||||
return nextID;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="QijieStageBuff")
|
||||
public class SQijieStageBuff implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int type;
|
||||
|
||||
private int passiveSkillLogic;
|
||||
|
||||
private int[] vocation;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public int getPassiveSkillLogic() {
|
||||
return passiveSkillLogic;
|
||||
}
|
||||
|
||||
public int[] getVocation() {
|
||||
return vocation;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="QijieTreasure")
|
||||
public class SQijieTreasure implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int level;
|
||||
|
||||
private int[][] integral;
|
||||
|
||||
private int[][] reward;
|
||||
|
||||
private int[][] treasureReward;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public int[][] getIntegral() {
|
||||
return integral;
|
||||
}
|
||||
|
||||
public int[][] getReward() {
|
||||
return reward;
|
||||
}
|
||||
|
||||
public int[][] getTreasureReward() {
|
||||
return treasureReward;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="QijieUpgrade")
|
||||
public class SQijieUpgrade implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int conditionType;
|
||||
|
||||
private String describe;
|
||||
|
||||
private int propertyName;
|
||||
|
||||
private int profession;
|
||||
|
||||
private int min;
|
||||
|
||||
private int max;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getConditionType() {
|
||||
return conditionType;
|
||||
}
|
||||
|
||||
public String getDescribe() {
|
||||
return describe;
|
||||
}
|
||||
|
||||
public int getPropertyName() {
|
||||
return propertyName;
|
||||
}
|
||||
|
||||
public int getProfession() {
|
||||
return profession;
|
||||
}
|
||||
|
||||
public int getMin() {
|
||||
return min;
|
||||
}
|
||||
|
||||
public int getMax() {
|
||||
return max;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -112,6 +112,9 @@ public class SSpecialConfig implements BaseConfig {
|
|||
public static final String Data_Of_Unlock_All_Wish_Hero = "DataOfUnlockAllWishHero";//在这个日期前开服的服务器默认解锁所有卡池内神将作为心愿,不走hero表加入心愿时长的判断
|
||||
public static final String DATA_OF_UNLOCK_THE_EVEREST = "DataOfUnlockTheEverest";
|
||||
public static final String PRE_LOAD_REWARD = "PreLoadReward";
|
||||
|
||||
public static final String QIJIEHOLYCONFIG = "QIJIEHOLYCONFIG";//七界试炼遗物开启层数
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
|
|
Loading…
Reference in New Issue