比数小游戏
parent
b89c65056f
commit
f3ecd4fc3f
|
@ -407,4 +407,7 @@ public interface BIReason {
|
|||
int TRANSFORMATION_FORCE_STAR_COST= 1247;//身外化身之力消耗
|
||||
int TRANSFORMATION_CARD_ACTIVATION = 1248;//身外化身卡片升星奖励
|
||||
|
||||
int COMPARENUM_LEVEL_REWARD = 1306; // 比数字小游戏过关奖励
|
||||
int COMPARENUM_TOTAL_REWARD = 1307; // 比数字小游戏章节累计奖励
|
||||
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
package com.ljsd.jieling.handler.comparenum;
|
||||
|
||||
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.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SCompareNumChapter;
|
||||
import config.SCompareNumSetting;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class CompareNumBonusHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.COMPARENUM_BONUS_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession session, PacketNetData netData) throws Exception {
|
||||
byte[] bytes = netData.parseClientProtoNetData();
|
||||
PlayerInfoProto.CompareNumBonusRequest request = PlayerInfoProto.CompareNumBonusRequest.parseFrom(bytes);
|
||||
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
int rewardId = request.getRewardId();
|
||||
|
||||
if (user.getPlayerInfoManager().getCompareNumRewardInfo().contains(rewardId)) {
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("already get bonus"));
|
||||
}
|
||||
|
||||
int chapter = rewardId / 1000;
|
||||
int levelNum = rewardId % 1000;
|
||||
|
||||
int curLevelId = user.getPlayerInfoManager().getCompareNumLevelId();
|
||||
|
||||
SCompareNumSetting mainCfg = SCompareNumSetting.getConfig(curLevelId);
|
||||
if (mainCfg == null) {
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("invalid cfg data"));
|
||||
}
|
||||
|
||||
if (mainCfg.getChapter() < chapter) {
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("chapter not enough"));
|
||||
}
|
||||
|
||||
SCompareNumChapter chapterCfg = SCompareNumChapter.getConfig(chapter);
|
||||
if (chapterCfg == null) {
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("invalid chapterCfg data"));
|
||||
}
|
||||
|
||||
int[][] rewardInfo = chapterCfg.getReward();
|
||||
|
||||
PlayerInfoProto.CompareNumBonusResponse.Builder response = PlayerInfoProto.CompareNumBonusResponse.newBuilder();
|
||||
if (mainCfg.getChapter() == chapter) {
|
||||
for (int[] reward: rewardInfo) {
|
||||
if (reward[0] == levelNum) {
|
||||
if (levelNum > SCompareNumSetting.getChapterNumById(curLevelId, user.getPlayerInfoManager().isCompareNumEndGame())) {
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("passport not enough"));
|
||||
}
|
||||
int[] dropList = new int[1];
|
||||
dropList[0] = reward[1];
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropList,1,0, BIReason.COMPARENUM_TOTAL_REWARD);
|
||||
response.setDrop(drop);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (mainCfg.getChapter() > chapter) {
|
||||
for (int[] reward: rewardInfo) {
|
||||
if (reward[0] == levelNum) {
|
||||
int[] dropList = new int[1];
|
||||
dropList[0] = reward[1];
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, dropList,1,0, BIReason.COMPARENUM_TOTAL_REWARD);
|
||||
response.setDrop(drop);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (response.hasDrop()) {
|
||||
Set<Integer> info = user.getPlayerInfoManager().getCompareNumRewardInfo();
|
||||
info.add(rewardId);
|
||||
user.getPlayerInfoManager().setCompareNumRewardInfo(info);
|
||||
|
||||
|
||||
PlayerInfoProto.CompareNumDataIndication.Builder indication = PlayerInfoProto.CompareNumDataIndication.newBuilder();
|
||||
indication.setLevelId(user.getPlayerInfoManager().getCompareNumLevelId());
|
||||
indication.setCompleteNum(SCompareNumSetting.getChapterNumById(user.getPlayerInfoManager().getCompareNumLevelId(), user.getPlayerInfoManager().isCompareNumEndGame()));
|
||||
for (int id : user.getPlayerInfoManager().getCompareNumRewardInfo()) {
|
||||
indication.addRewardIdArr(id);
|
||||
}
|
||||
ISession sessionByUid = OnlineUserManager.getSessionByUid(session.getUid());
|
||||
MessageUtil.sendIndicationMessage(sessionByUid, 1, MessageTypeProto.MessageType.COMPARENUM_DATA_INDICATION_VALUE, indication.build(), true);
|
||||
}
|
||||
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.COMPARENUM_BONUS_RESPONSE_VALUE,
|
||||
response.build(), true);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,149 @@
|
|||
package com.ljsd.jieling.handler.comparenum;
|
||||
|
||||
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.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SCompareNumChapter;
|
||||
import config.SCompareNumSetting;
|
||||
import config.SMainLevelConfig;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.TreeMap;
|
||||
|
||||
|
||||
public class CompareNumEndGameHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.COMPARENUM_END_GAME_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession session, PacketNetData netData) throws Exception {
|
||||
byte[] bytes = netData.parseClientProtoNetData();
|
||||
PlayerInfoProto.CompareNumEndGameRequest request = PlayerInfoProto.CompareNumEndGameRequest.parseFrom(bytes);
|
||||
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
int levelId = request.getLevelId();
|
||||
int result = request.getResult();
|
||||
|
||||
PlayerInfoProto.CompareNumEndGameResponse.Builder response = PlayerInfoProto.CompareNumEndGameResponse.newBuilder();
|
||||
if(result == 0){
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.COMPARENUM_END_GAME_RESPONSE_VALUE,
|
||||
response.build(), true);
|
||||
return;
|
||||
}
|
||||
|
||||
int curLevelId = user.getPlayerInfoManager().getCompareNumLevelId();
|
||||
if (curLevelId <= 0 || curLevelId < levelId) {
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("invalid CompareNumLevelId"));
|
||||
}
|
||||
|
||||
SCompareNumSetting cfg = SCompareNumSetting.getConfig(levelId);
|
||||
if (cfg == null) {
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("invalid cfg data"));
|
||||
}
|
||||
|
||||
SCompareNumChapter chapterCfg = SCompareNumChapter.getConfig(cfg.getChapter());
|
||||
if (chapterCfg == null) {
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("invalid chaptercfg data"));
|
||||
}
|
||||
|
||||
int lastId = (int)((TreeMap)SCompareNumSetting.getCompareNumSettingMap()).lastEntry().getKey();
|
||||
if (curLevelId != lastId && user.getPlayerInfoManager().isCompareNumEndGame()) {
|
||||
user.getPlayerInfoManager().setCompareNumEndGame(false);
|
||||
}
|
||||
/*
|
||||
章节解锁条件
|
||||
1.玩家等级
|
||||
2.通关普通副本关卡
|
||||
*/
|
||||
for (int[] limit: chapterCfg.getLimit()) {
|
||||
|
||||
if (limit[0] == 1) {
|
||||
if (limit[1] > user.getPlayerInfoManager().getLevel()) {
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("invalid level"));
|
||||
}
|
||||
}
|
||||
else if (limit[0] == 2) {
|
||||
SMainLevelConfig mineMainLevelConfig = SMainLevelConfig.fightPreMap.get(user.getMainLevelManager().getFightId());
|
||||
if (mineMainLevelConfig != null && mineMainLevelConfig.getDifficulty() == 1) {
|
||||
if (limit[1] > user.getMainLevelManager().getFightId()) {
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("invalid FightId"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (curLevelId == levelId) {
|
||||
|
||||
/**
|
||||
关卡解锁条件
|
||||
1.前置关卡
|
||||
2.玩家等级
|
||||
3.通关普通副本关卡
|
||||
*/
|
||||
for (int[] limit: cfg.getLevelLimit()) {
|
||||
if (limit[0] == 1) {
|
||||
if (limit[1] > user.getPlayerInfoManager().getLevel()) {
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("invalid level"));
|
||||
}
|
||||
}
|
||||
else if (limit[0] == 2) {
|
||||
SMainLevelConfig mineMainLevelConfig = SMainLevelConfig.fightPreMap.get(user.getMainLevelManager().getFightId());
|
||||
if (mineMainLevelConfig != null && mineMainLevelConfig.getDifficulty() == 1) {
|
||||
if (limit[1] > user.getMainLevelManager().getFightId()) {
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("invalid FightId"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!user.getPlayerInfoManager().isCompareNumEndGame()) {
|
||||
int nextId = 0;
|
||||
if (lastId == curLevelId) {
|
||||
nextId = curLevelId;
|
||||
user.getPlayerInfoManager().setCompareNumEndGame(true);
|
||||
}
|
||||
else {
|
||||
nextId = curLevelId + 1;
|
||||
SCompareNumSetting nextCfg = SCompareNumSetting.getConfig(nextId);
|
||||
if (nextCfg == null) {
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("invalid nextCfg data"));
|
||||
}
|
||||
}
|
||||
|
||||
user.getPlayerInfoManager().setCompareNumLevelId(nextId);
|
||||
user.getPlayerInfoManager().setCompareNumLevelTime(TimeUtils.nowInt());
|
||||
|
||||
PlayerInfoProto.CompareNumDataIndication.Builder indication = PlayerInfoProto.CompareNumDataIndication.newBuilder();
|
||||
indication.setLevelId(user.getPlayerInfoManager().getCompareNumLevelId());
|
||||
indication.setCompleteNum(SCompareNumSetting.getChapterNumById(user.getPlayerInfoManager().getCompareNumLevelId(), user.getPlayerInfoManager().isCompareNumEndGame()));
|
||||
for (int rewardId: user.getPlayerInfoManager().getCompareNumRewardInfo()) {
|
||||
indication.addRewardIdArr(rewardId);
|
||||
}
|
||||
ISession sessionByUid = OnlineUserManager.getSessionByUid(session.getUid());
|
||||
MessageUtil.sendIndicationMessage(sessionByUid, 1, MessageTypeProto.MessageType.COMPARENUM_DATA_INDICATION_VALUE, indication.build(), true);
|
||||
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, cfg.getPassReward(), BIReason.COMPARENUM_LEVEL_REWARD);
|
||||
response.setDrop(drop);
|
||||
response.setNextId(nextId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.COMPARENUM_END_GAME_RESPONSE_VALUE,
|
||||
response.build(), true);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
package com.ljsd.jieling.handler.comparenum;
|
||||
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.dao.GuilidManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.GuildInfo;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SCompareNumSetting;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class CompareNumInfoHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.COMPARENUM_INFO_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession session, PacketNetData netData) throws Exception {
|
||||
byte[] bytes = netData.parseClientProtoNetData();
|
||||
PlayerInfoProto.CompareNumInfoRequest request = PlayerInfoProto.CompareNumInfoRequest.parseFrom(bytes);
|
||||
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
int chapterId = request.getChapterId();
|
||||
|
||||
List<SCompareNumSetting> list = SCompareNumSetting.getListByChapter(chapterId);
|
||||
if (list == null) {
|
||||
throw new ErrorCodeException(ErrorCode.newDefineCode("invalid chapterId"));
|
||||
}
|
||||
|
||||
Set<Integer> userIds = new HashSet<>();
|
||||
List<Integer> friends = user.getFriendManager().getFriends();
|
||||
userIds.addAll(friends);
|
||||
GuildInfo guildInfo = GuilidManager.getGuildInfo(user.getPlayerInfoManager().getGuildId());
|
||||
if (guildInfo != null) {
|
||||
for (Set<Integer> items : guildInfo.getMembers().values()) {
|
||||
userIds.addAll(items);
|
||||
}
|
||||
}
|
||||
|
||||
HashMap<Integer, List<CommonProto.CompareNumLevelUserInfo>> userInfoMap = new HashMap<>();
|
||||
for (int uid: userIds) {
|
||||
User friend = UserManager.getUser(uid);
|
||||
int levelId = friend.getPlayerInfoManager().getCompareNumLevelId();
|
||||
SCompareNumSetting cfg = SCompareNumSetting.getConfig(levelId);
|
||||
if (cfg != null && cfg.getChapter() == chapterId) {
|
||||
CommonProto.CompareNumLevelUserInfo info = CommonProto.CompareNumLevelUserInfo.newBuilder()
|
||||
.setUid(friend.getId())
|
||||
.setHeadFrame(friend.getPlayerInfoManager().getHeadFrame())
|
||||
.setTime(friend.getPlayerInfoManager().getCompareNumLevelTime())
|
||||
.build();
|
||||
userInfoMap.computeIfAbsent(levelId, n -> new ArrayList<>()).add(info);
|
||||
}
|
||||
}
|
||||
|
||||
PlayerInfoProto.CompareNumInfoResponse.Builder response = PlayerInfoProto.CompareNumInfoResponse.newBuilder();
|
||||
response.setLevelId(user.getPlayerInfoManager().getCompareNumLevelId());
|
||||
|
||||
CommonProto.CompareNumLevelInfo.Builder levelInfo = CommonProto.CompareNumLevelInfo.newBuilder();
|
||||
for (Map.Entry<Integer, List<CommonProto.CompareNumLevelUserInfo>> entry: userInfoMap.entrySet()) {
|
||||
levelInfo.setLevelId(entry.getKey());
|
||||
entry.getValue().sort(Comparator.comparingInt(CommonProto.CompareNumLevelUserInfo::getTime));
|
||||
levelInfo.addAllUserInfo(entry.getValue());
|
||||
response.addLevelInfo(levelInfo);
|
||||
}
|
||||
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.COMPARENUM_INFO_RESPONSE_VALUE,
|
||||
response.build(), true);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.ljsd.jieling.handler.comparenum;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.netty.cocdex.PacketNetData;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SCompareNumSetting;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
public class GetCompareInfoHandler extends BaseHandler {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.GET_COMPARENUM_INFO_REQUEST;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void process(ISession session, PacketNetData netData) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
PlayerManager player = user.getPlayerInfoManager();
|
||||
|
||||
PlayerInfoProto.GetCompareNumInfoResponse.Builder response = PlayerInfoProto.GetCompareNumInfoResponse.newBuilder();
|
||||
|
||||
if (user.getPlayerInfoManager().getCompareNumLevelId() == 0) {
|
||||
user.getPlayerInfoManager().setCompareNumLevelId(1);
|
||||
}
|
||||
|
||||
response.setLevelId(player.getCompareNumLevelId())
|
||||
.setCompleteNum(SCompareNumSetting.getChapterNumById(player.getCompareNumLevelId(), player.isCompareNumEndGame()))
|
||||
.addAllRewardIdArr(player.getCompareNumRewardInfo());
|
||||
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.GET_COMPARENUM_INFO_RESPONSE_VALUE, response.build(), true);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.ljsd.jieling.kefu;
|
||||
|
||||
import com.ljsd.jieling.logic.OnlineUserManager;
|
||||
import com.ljsd.jieling.logic.dao.PlayerManager;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SCompareNumSetting;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/10/28 17:35:00
|
||||
* @Description: 比数小游戏 命令: Compare 角色id levelId
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class Cmd_CompareNum extends GmRoleAbstract {
|
||||
@Override
|
||||
public boolean exec(String[] args) throws Exception {
|
||||
User user = getUser();
|
||||
PlayerManager player = user.getPlayerInfoManager();
|
||||
|
||||
int levelId = Integer.parseInt(args[0]);
|
||||
|
||||
player.setCompareNumLevelId(levelId);
|
||||
player.setCompareNumLevelTime(TimeUtils.nowInt());
|
||||
|
||||
PlayerInfoProto.CompareNumDataIndication.Builder indication = PlayerInfoProto.CompareNumDataIndication.newBuilder();
|
||||
indication.setLevelId(player.getCompareNumLevelId());
|
||||
indication.setCompleteNum(SCompareNumSetting.getChapterNumById(player.getCompareNumLevelId(), player.isCompareNumEndGame()));
|
||||
indication.addAllRewardIdArr(player.getCompareNumRewardInfo());
|
||||
|
||||
ISession session = OnlineUserManager.sessionMap.get(user.getId());
|
||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.COMPARENUM_DATA_INDICATION_VALUE, indication.build(), true);
|
||||
|
||||
LOGGER.info(user.getId() + "的关卡ID已设为:" + levelId);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -180,6 +180,16 @@ public class PlayerManager extends MongoBase {
|
|||
// 是否是首次开启四灵
|
||||
private boolean openFourChallenge = false;
|
||||
|
||||
|
||||
// 数字小游戏
|
||||
private int compareNumLevelId;
|
||||
|
||||
private Set<Integer> compareNumRewardInfo = new HashSet<>();
|
||||
|
||||
private int compareNumLevelTime;
|
||||
|
||||
private boolean compareNumEndGame;
|
||||
|
||||
/**
|
||||
* 开启的七界层数, key: 七届类型, value: 最高层数
|
||||
*/
|
||||
|
@ -1468,4 +1478,40 @@ public class PlayerManager extends MongoBase {
|
|||
this.treasureReplica = treasureReplica;
|
||||
updateString("treasureReplica",treasureReplica);
|
||||
}
|
||||
|
||||
public int getCompareNumLevelId() {
|
||||
return compareNumLevelId;
|
||||
}
|
||||
|
||||
public void setCompareNumLevelId(int compareNumLevelId) {
|
||||
this.compareNumLevelId = compareNumLevelId;
|
||||
updateString("compareNumLevelId", this.compareNumLevelId);
|
||||
}
|
||||
|
||||
public Set<Integer> getCompareNumRewardInfo() {
|
||||
return compareNumRewardInfo;
|
||||
}
|
||||
|
||||
public void setCompareNumRewardInfo(Set<Integer> compareNumRewardInfo) {
|
||||
this.compareNumRewardInfo = compareNumRewardInfo;
|
||||
updateString("compareNumRewardInfo", this.compareNumRewardInfo);
|
||||
}
|
||||
|
||||
public int getCompareNumLevelTime() {
|
||||
return compareNumLevelTime;
|
||||
}
|
||||
|
||||
public void setCompareNumLevelTime(int compareNumLevelTime) {
|
||||
this.compareNumLevelTime = compareNumLevelTime;
|
||||
updateString("compareNumLevelTime", this.compareNumLevelTime);
|
||||
}
|
||||
|
||||
public boolean isCompareNumEndGame() {
|
||||
return compareNumEndGame;
|
||||
}
|
||||
|
||||
public void setCompareNumEndGame(boolean compareNumEndGame) {
|
||||
this.compareNumEndGame = compareNumEndGame;
|
||||
updateString("compareNumEndGame", this.compareNumEndGame);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="CompareNumBuild")
|
||||
public class SCompareNumBuild implements BaseConfig {
|
||||
|
||||
private int iD;
|
||||
|
||||
private int[] checkpointsID;
|
||||
|
||||
private int[][] formula;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getID() {
|
||||
return iD;
|
||||
}
|
||||
|
||||
public int[] getCheckpointsID() {
|
||||
return checkpointsID;
|
||||
}
|
||||
|
||||
public int[][] getFormula() {
|
||||
return formula;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="CompareNumChaper")
|
||||
public class SCompareNumChapter implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
private int[][] limit;
|
||||
private int[][] reward;
|
||||
|
||||
private static Map<Integer, SCompareNumChapter> sCompareNumChapterMap = new HashMap<>();
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
sCompareNumChapterMap = STableManager.getConfig(SCompareNumChapter.class);
|
||||
}
|
||||
|
||||
public static SCompareNumChapter getConfig(int id) {
|
||||
return sCompareNumChapterMap.get(id);
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int[][] getLimit() {
|
||||
return limit;
|
||||
}
|
||||
|
||||
public int[][] getReward() {
|
||||
return reward;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="CompareNumItem")
|
||||
public class SCompareNumItem implements BaseConfig {
|
||||
|
||||
private int iD;
|
||||
|
||||
private int type;
|
||||
|
||||
private int monsterType;
|
||||
|
||||
private int monsterAttackRange;
|
||||
|
||||
private int combatEffectiveness;
|
||||
|
||||
private int access;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getID() {
|
||||
return iD;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public int getMonsterType() {
|
||||
return monsterType;
|
||||
}
|
||||
|
||||
public int getMonsterAttackRange() {
|
||||
return monsterAttackRange;
|
||||
}
|
||||
|
||||
public int getCombatEffectiveness() {
|
||||
return combatEffectiveness;
|
||||
}
|
||||
|
||||
public int getAccess() {
|
||||
return access;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Table(name ="CompareNumSetting")
|
||||
public class SCompareNumSetting implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
private int chapter;
|
||||
private int[][] levelLimit;
|
||||
private int[] buildID;
|
||||
private int[][] passReward;
|
||||
private int repeat;
|
||||
|
||||
private static Map<Integer, SCompareNumSetting> sCompareNumSettingMap = new HashMap<>();
|
||||
private static Map<Integer, List<SCompareNumSetting>> chapter2List = new HashMap<>();
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
sCompareNumSettingMap = STableManager.getConfig(SCompareNumSetting.class);
|
||||
for (SCompareNumSetting cfg: sCompareNumSettingMap.values()) {
|
||||
chapter2List.computeIfAbsent(cfg.chapter, v -> new ArrayList<>()).add(cfg);
|
||||
}
|
||||
}
|
||||
|
||||
public static int getChapterNumById(int id, boolean isEndGame) {
|
||||
int count = 0;
|
||||
SCompareNumSetting cfg = sCompareNumSettingMap.get(id);
|
||||
if (cfg != null) {
|
||||
List<SCompareNumSetting> list = chapter2List.get(cfg.getChapter());
|
||||
if (list != null && list.size() > 0) {
|
||||
SCompareNumSetting info = list.get(0);
|
||||
if (info != null) {
|
||||
int lastId = (int)((TreeMap)SCompareNumSetting.getCompareNumSettingMap()).lastEntry().getKey();
|
||||
if (lastId == id && isEndGame) {
|
||||
count = id - info.getId() + 1;
|
||||
}
|
||||
else {
|
||||
count = id - info.getId();
|
||||
}
|
||||
if (count < 0) {
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
// public static int[][] getRewardInfoByChapter(int chapter) {
|
||||
// List<SCompareNumSetting> list = chapter2List.get(chapter);
|
||||
// if (list != null && list.size() > 0) {
|
||||
// SCompareNumSetting info = list.get(0);
|
||||
// if (info != null) {
|
||||
// return info.getReward();
|
||||
// }
|
||||
// }
|
||||
// return new int[0][];
|
||||
// }
|
||||
|
||||
public static SCompareNumSetting getConfig(int id) {
|
||||
return sCompareNumSettingMap.get(id);
|
||||
}
|
||||
|
||||
public static Map<Integer, SCompareNumSetting> getCompareNumSettingMap() {
|
||||
return sCompareNumSettingMap;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getChapter() {
|
||||
return chapter;
|
||||
}
|
||||
|
||||
public int[][] getLevelLimit() {
|
||||
return levelLimit;
|
||||
}
|
||||
|
||||
|
||||
public int[][] getPassReward() {
|
||||
return passReward;
|
||||
}
|
||||
|
||||
public int getRepeat() {
|
||||
return repeat;
|
||||
}
|
||||
|
||||
|
||||
public static List<SCompareNumSetting> getListByChapter(int chapterId) {
|
||||
return chapter2List.get(chapterId);
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue