Merge branch 'master_test_gn' into master_test_gn_xxp
# Conflicts: # serverlogic/src/main/java/com/ljsd/jieling/handler/GetPlayerInfoHandler.javaback_recharge
commit
8f0010b1be
|
@ -74,6 +74,7 @@ public enum FunctionIdEnum {
|
|||
Likable(114,null),//好感度
|
||||
GodSoul(116,null),//神魂
|
||||
FaBaoSoul(119,null),//法宝聚灵
|
||||
LifeGrid(122,null),//命格
|
||||
WeekGood(9091,null),
|
||||
;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.ljsd.jieling.core;
|
|||
|
||||
public interface GlobalsDef {
|
||||
String DEFAULT_NAME = "无名妖灵师";
|
||||
int VERSION_CODE=4;//后端兼容版本号
|
||||
int VERSION_CODE = 5;//后端兼容版本号
|
||||
int MAP_MISSION_RETURN = -9999;
|
||||
int MAP_MISSION_FAILURE = -10000;
|
||||
|
||||
|
@ -23,6 +23,8 @@ public interface GlobalsDef {
|
|||
|
||||
int LUOFUZHENG_MONEY = 1207; // 罗浮争锋道具
|
||||
|
||||
int FIVE_STAR_ITEM = 12059; // 5星万能将魂道具 ID:
|
||||
|
||||
int BATTLING = -1;
|
||||
|
||||
int BREAK_TYPE = 1; //1突破
|
||||
|
|
|
@ -15,7 +15,7 @@ public class ChampionFunction implements FunctionManager {
|
|||
return;
|
||||
}
|
||||
ChampionshipLogic.start();
|
||||
Poster.getPoster().dispatchEvent(new FunctionRefreshEvent(FunctionIdEnum.Arena.getFunctionType(),-1));
|
||||
// Poster.getPoster().dispatchEvent(new FunctionRefreshEvent(FunctionIdEnum.TopBattle.getFunctionType(),-1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -373,7 +373,10 @@ public interface BIReason {
|
|||
int FABAO_SOUL_UP_COST =1223;//法宝之魂升级消耗
|
||||
|
||||
int TRANSFORMATION_CARD_COST = 1224;//变身卡激活消耗
|
||||
|
||||
|
||||
int BUY_GOOD_ITEM_COST =1225;//妖晶购买道具消耗
|
||||
int BUY_GOOD_ITEM_GET =1226;//妖晶购买道具获得
|
||||
int LIFE_STONE_UP = 1227;//命石合成
|
||||
|
||||
int GM_COST = 1228;//gm删除道具
|
||||
}
|
|
@ -29,5 +29,6 @@ public interface GlobalGm {
|
|||
// int POKEMAN_MAX = 22;//一键获得所有满级异妖
|
||||
int HARD_STAGE =25;//一键通关山河社稷图特定关卡之前的所有关卡
|
||||
int FOUR_SPIRITS =26;//一键通关山河社稷图特定关卡之前的所有关卡
|
||||
int CLEAR_ITEM=27;//批量清除道具
|
||||
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ public interface GlobalItemType {
|
|||
int MOUNT_FRAGMENTS_ITEM = 28;//坐骑碎片
|
||||
int TRANSFORMATION_CARD = 29;//化身卡
|
||||
int TRUMP_CHIP=30;//法宝碎片(法宝聚灵使用)
|
||||
int LIFE_STONE=31;//命石
|
||||
int HOOK_PROP=32;//挂机奖励资源道具
|
||||
//物品使用类型
|
||||
int NO_USE = 0 ; //不使用
|
||||
|
|
|
@ -102,7 +102,7 @@ public class GMRequestHandler extends BaseHandler{
|
|||
// if(!GameApplication.serverProperties.isDebug()){
|
||||
// throw new ErrorCodeException("In a formal setting");
|
||||
// }
|
||||
if (!command.contains("#") || command.split("#").length < 3) {
|
||||
if (!command.contains("#") || command.split("#").length < 2) {
|
||||
LOGGER.error("wrong command :" + command);
|
||||
return;
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ public class GMRequestHandler extends BaseHandler{
|
|||
if (gmCommandType == GlobalGm.RESET_USER_NAME){
|
||||
prarm3 = commandArray[2];
|
||||
}else{
|
||||
if(gmCommandType!=GlobalGm.TIME_INFO){
|
||||
if(gmCommandType!=GlobalGm.TIME_INFO&&gmCommandType!=GlobalGm.CLEAR_ITEM){
|
||||
prarm2 = Integer.parseInt(commandArray[2]);
|
||||
}
|
||||
}
|
||||
|
@ -471,11 +471,20 @@ public class GMRequestHandler extends BaseHandler{
|
|||
prarm2 = Integer.parseInt(commandArray[2]);
|
||||
cUser.getPlayerInfoManager().updateFourChallengeByIndex(prarm1, prarm2);
|
||||
break;
|
||||
case GlobalGm.CLEAR_ITEM:
|
||||
Map<Integer,Long>costMap=new HashMap<>();
|
||||
for (int i = 1; i < commandArray.length; i++) {
|
||||
Item item=cUser.getItemManager().getItem(Integer.parseInt(commandArray[i]));
|
||||
if (item!=null){
|
||||
costMap.put(item.getItemId(),item.getItemNum());
|
||||
}
|
||||
}
|
||||
ItemUtil.itemCostLong(cUser, costMap, BIReason.GM_COST, GlobalGm.CLEAR_ITEM);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
try {
|
||||
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GM_RESPONSE_VALUE, gmBuilder.build(), true);
|
||||
LOGGER.info("back to client!");
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -18,7 +18,7 @@ import com.ljsd.jieling.logic.activity.fourChallenge.FourChallengeLogic;
|
|||
import com.ljsd.jieling.logic.dao.*;
|
||||
import com.ljsd.jieling.logic.dao.root.GlobalSystemControl;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.explorerMap.ExplorerMapLogic;
|
||||
import com.ljsd.jieling.logic.mail.MailLogic;
|
||||
import com.ljsd.jieling.logic.mission.GameEvent;
|
||||
import com.ljsd.jieling.logic.player.PlayerLogic;
|
||||
import com.ljsd.jieling.logic.question.QuestionLogic;
|
||||
|
@ -173,6 +173,69 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
if (playerInfoManager.getVersionCode() < 4) {
|
||||
user.getStoreManager().removeStoreInfo(17);
|
||||
}
|
||||
// 升星配方调整 涉及到线上补偿,上线时根据玩家队伍列表中用拥有的各升星过的神将数量进行补偿
|
||||
if (playerInfoManager.getVersionCode() < 5) {
|
||||
Map<String, Hero> heroMap = user.getHeroManager().getHeroMap();
|
||||
Map<Integer, Integer> hasHeroMap = new TreeMap<>();
|
||||
for (Hero value : heroMap.values()) {
|
||||
if (value.getStar() == 6) {
|
||||
if (hasHeroMap.containsKey(6)) {
|
||||
hasHeroMap.put(6, hasHeroMap.get(6) + 1);
|
||||
} else {
|
||||
hasHeroMap.put(6, 1);
|
||||
}
|
||||
} else if (value.getStar() == 7) {
|
||||
if (hasHeroMap.containsKey(7)) {
|
||||
hasHeroMap.put(7, hasHeroMap.get(7) + 1);
|
||||
} else {
|
||||
hasHeroMap.put(7, 1);
|
||||
}
|
||||
} else if (value.getStar() == 8) {
|
||||
if (hasHeroMap.containsKey(8)) {
|
||||
hasHeroMap.put(8, hasHeroMap.get(8) + 1);
|
||||
} else {
|
||||
hasHeroMap.put(8, 1);
|
||||
}
|
||||
} else if (value.getStar() == 9) {
|
||||
if (hasHeroMap.containsKey(9)) {
|
||||
hasHeroMap.put(9, hasHeroMap.get(9) + 1);
|
||||
} else {
|
||||
hasHeroMap.put(9, 1);
|
||||
}
|
||||
} else if (value.getStar() == 10) {
|
||||
if (hasHeroMap.containsKey(10)) {
|
||||
hasHeroMap.put(10, hasHeroMap.get(10) + 1);
|
||||
} else {
|
||||
hasHeroMap.put(10, 1);
|
||||
}
|
||||
} else if (value.getStar() == 11) {
|
||||
if (hasHeroMap.containsKey(11)) {
|
||||
hasHeroMap.put(11, hasHeroMap.get(11) + 1);
|
||||
} else {
|
||||
hasHeroMap.put(11, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!hasHeroMap.isEmpty()) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
String txtStart = SErrorCodeEerverConfig.getI18NMessage("starcomposechange_mail_txt_start");
|
||||
stringBuilder.append(txtStart);
|
||||
int totalCount = 0;
|
||||
for (Map.Entry<Integer, Integer> entry : hasHeroMap.entrySet()) {
|
||||
int count = entry.getValue() * map.getOrDefault(entry.getKey(), 0);
|
||||
totalCount += count;
|
||||
String txt = SErrorCodeEerverConfig.getFormatMessage("starcomposechange_mail_txt_" + entry.getKey(), new Object[]{entry.getValue(), count});
|
||||
stringBuilder.append(txt);
|
||||
}
|
||||
String txtEnd = SErrorCodeEerverConfig.getFormatMessage("starcomposechange_mail_txt_end", new Object[]{totalCount});
|
||||
stringBuilder.append(txtEnd);
|
||||
String title = SErrorCodeEerverConfig.getI18NMessage("starcomposechange_mail_title");
|
||||
MailLogic.getInstance().sendMail(user.getId(), title, stringBuilder.toString(), GlobalsDef.FIVE_STAR_ITEM + "#" + totalCount, TimeUtils.nowInt(), Global.MAIL_EFFECTIVE_TIME);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
playerInfoManager.setVersionCode(GlobalsDef.VERSION_CODE);
|
||||
}
|
||||
// 处理玩家旧头像框,兼容,一个玩家只执行一次
|
||||
|
@ -250,6 +313,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
.setXiuweiLevel(heroManager.getXiuweiLevel())
|
||||
.addAllPracticeSkillInfos(practiceSkillInfos)
|
||||
.addAllFaBaoSoulInfos(faBaoSoulInfos)
|
||||
.addAllLifeGridInfos(getLifeGridInfos(heroManager))
|
||||
.build();
|
||||
ReportUtil.onReportEvent(user, ReportEventEnum.APP_LOGIN.getType());
|
||||
try {
|
||||
|
@ -264,9 +328,6 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
// 无尽秘宝处理
|
||||
endLessTreasureHandler(user);
|
||||
expeditionTreasureHandler(user);
|
||||
//探索挂机
|
||||
//ExplorerMapLogic.getInstance().calOfflineReward(user);
|
||||
|
||||
user.getUserMissionManager().onGameEvent(user,GameEvent.DAILY_TASK_TYPE,0,user);
|
||||
MessageUtil.sendIndicationMessage(iSession, 1, MessageTypeProto.MessageType.WorldLevelIndication_VALUE, PlayerInfoProto.WorldLevelIndication.newBuilder().setWorldLeve(GlobleSystemLogic.getGlobalWorldLevelCache()).build(), true);
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.GET_PLAYERINFO_RESPONSE_VALUE, getPlayerInfoResponse, true);
|
||||
|
@ -281,6 +342,16 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
}
|
||||
}
|
||||
|
||||
private static Map<Integer, Integer> map = new HashMap<>(6);
|
||||
{
|
||||
map.put(6, 4);
|
||||
map.put(7, 4);
|
||||
map.put(8, 8);
|
||||
map.put(9, 12);
|
||||
map.put(10, 28);
|
||||
map.put(11, 40);
|
||||
}
|
||||
|
||||
/**
|
||||
* 常驻活动重置
|
||||
* @param user
|
||||
|
@ -395,6 +466,26 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
return faBaoSoulInfos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化获取命格数据
|
||||
* @param heroManager
|
||||
* @return
|
||||
*/
|
||||
private List<CommonProto.LifeGridInfo>getLifeGridInfos(HeroManager heroManager){
|
||||
List<CommonProto.LifeGridInfo>lifeGridInfos=new ArrayList<>();
|
||||
for (Map.Entry<Integer, Map<Integer,Integer>> entry : heroManager.getLifeGridMap().entrySet()) {
|
||||
for (Map.Entry<Integer, Integer> indexById : entry.getValue().entrySet()) {
|
||||
CommonProto.LifeGridInfo info=CommonProto.LifeGridInfo.newBuilder()
|
||||
.setGridId(entry.getKey())
|
||||
.setGridIndex(indexById.getKey())
|
||||
.setItemId(indexById.getValue())
|
||||
.build();
|
||||
lifeGridInfos.add(info);
|
||||
}
|
||||
}
|
||||
return lifeGridInfos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化英雄星级map(针对老号)
|
||||
* @param user
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
package com.ljsd.jieling.handler.hero;
|
||||
import com.ljsd.jieling.core.FunctionIdEnum;
|
||||
import com.ljsd.jieling.core.HandlerLogicThread;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
|
@ -12,6 +14,8 @@ import com.ljsd.jieling.logic.hero.HeroLogic;
|
|||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SCHero;
|
||||
import config.SGlobalSystemConfig;
|
||||
import manager.STableManager;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.HeroInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
@ -33,6 +37,11 @@ public class HeroGodSoulBindRequestHandler extends BaseHandler<HeroInfoProto.Her
|
|||
List<String>bindHeroList= proto.getBindHerosList();
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(FunctionIdEnum.GodSoul.getFunctionType());
|
||||
if (!HandlerLogicThread.checkOpen(user, sGlobalSystemConfig)) {
|
||||
LOGGER.error("等级不足功能尚未开启");
|
||||
throw new ErrorCodeException(ErrorCode.HANDLE_FAILED);
|
||||
}
|
||||
HeroManager heroManager= user.getHeroManager();
|
||||
Hero upHero=heroManager.getHero(heroId);
|
||||
SCHero heroConfig=SCHero.getsCHero().get(upHero.getTemplateId());
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package com.ljsd.jieling.handler.hero;
|
||||
|
||||
import com.ljsd.common.mogodb.util.GlobalData;
|
||||
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;
|
||||
|
@ -14,6 +16,7 @@ import com.ljsd.jieling.network.session.ISession;
|
|||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.*;
|
||||
import manager.STableManager;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.HeroInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
@ -40,7 +43,11 @@ public class HeroUpLikableRequestHandler extends BaseHandler<HeroInfoProto.HeroU
|
|||
|
||||
User user = UserManager.getUser(uid);
|
||||
HeroManager heroManager=user.getHeroManager();
|
||||
|
||||
SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(FunctionIdEnum.Likable.getFunctionType());
|
||||
if (!HandlerLogicThread.checkOpen(user, sGlobalSystemConfig)) {
|
||||
LOGGER.error("等级不足功能尚未开启");
|
||||
throw new ErrorCodeException(ErrorCode.HANDLE_FAILED);
|
||||
}
|
||||
if (itemNum+heroManager.getLikableSendTime()> SSpecialConfig.getIntegerValue(SSpecialConfig.LIKE_ABILITY)){
|
||||
LOGGER.error("好感度赠送次数超出每日限制");
|
||||
throw new ErrorCodeException(ErrorCode.REFRESH_WHEL_TIME_NOT);
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
package com.ljsd.jieling.handler.hero;
|
||||
|
||||
import com.ljsd.jieling.core.FunctionIdEnum;
|
||||
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.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.UserMainTeamForceEvent;
|
||||
import com.ljsd.jieling.logic.dao.HeroManager;
|
||||
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.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SGlobalSystemConfig;
|
||||
import manager.STableManager;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.HeroInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 命格命石穿戴/卸下
|
||||
*/
|
||||
@Component
|
||||
public class LifeGridChangeRequestHandler extends BaseHandler<HeroInfoProto.LifeGridChangeRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.LIFE_GRID_CHANGE_REQUEST;
|
||||
}
|
||||
@Override
|
||||
public void processWithProto(ISession session, HeroInfoProto.LifeGridChangeRequest proto) throws Exception {
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(FunctionIdEnum.LifeGrid.getFunctionType());
|
||||
if (!HandlerLogicThread.checkOpen(user, sGlobalSystemConfig)) {
|
||||
LOGGER.error("等级不足功能尚未开启");
|
||||
throw new ErrorCodeException(ErrorCode.HANDLE_FAILED);
|
||||
}
|
||||
int type=proto.getType();
|
||||
int position=proto.getPosition();
|
||||
int index=proto.getIndex();
|
||||
int itemId=proto.getLifeStoneId();
|
||||
HeroManager heroManager=user.getHeroManager();
|
||||
Map<Integer, Map<Integer,Integer>>lifeGridMap=heroManager.getLifeGridMap();
|
||||
HeroInfoProto.LifeGridChangeResponse response=null;
|
||||
if (type==1){//穿戴
|
||||
Map<Integer,Integer>instItemMap=new HashMap<>();
|
||||
instItemMap.put(itemId,1);
|
||||
boolean isTrue=ItemUtil.itemCost(user,instItemMap,BIReason.LIFE_STONE_UP,type);
|
||||
if (!isTrue){
|
||||
LOGGER.error("穿戴的命石未拥有");
|
||||
throw new ErrorCodeException(ErrorCode.HANDLE_FAILED);
|
||||
}
|
||||
//更换
|
||||
if (lifeGridMap.containsKey(position)&&lifeGridMap.get(position).containsKey(index)&&lifeGridMap.get(position).get(index)>0){
|
||||
int unItemId=lifeGridMap.get(position).get(index);
|
||||
int[][]unItem=new int[1][2];
|
||||
unItem[0][0]=unItemId;
|
||||
unItem[0][1]=1;
|
||||
ItemUtil.drop(user,unItem, BIReason.LIFE_STONE_UP);
|
||||
}
|
||||
heroManager.setLifeGridMap(position,index,itemId);
|
||||
CommonProto.LifeGridInfo lifeGridInfo=CommonProto.LifeGridInfo.newBuilder()
|
||||
.setGridId(position)
|
||||
.setGridIndex(index)
|
||||
.setItemId(itemId)
|
||||
.build();
|
||||
response=HeroInfoProto.LifeGridChangeResponse.newBuilder().setLifeGridInfo(lifeGridInfo).build();
|
||||
}else{//卸下
|
||||
int unItemId= lifeGridMap.get(position).get(index);
|
||||
int[][]unItem=new int[1][2];
|
||||
unItem[0][0]=unItemId;
|
||||
unItem[0][1]=1;
|
||||
ItemUtil.drop(user,unItem, BIReason.LIFE_STONE_UP);
|
||||
heroManager.setLifeGridMap(position,index,0);
|
||||
CommonProto.LifeGridInfo lifeGridInfo=CommonProto.LifeGridInfo.newBuilder()
|
||||
.setGridId(position)
|
||||
.setGridIndex(index)
|
||||
.setItemId(0)
|
||||
.build();
|
||||
response=HeroInfoProto.LifeGridChangeResponse.newBuilder().setLifeGridInfo(lifeGridInfo).build();
|
||||
}
|
||||
Poster.getPoster().dispatchEvent(new UserMainTeamForceEvent(session.getUid()));
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.LIFE_GRID_CHANGE_RESPONSE_VALUE,response,true);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,327 @@
|
|||
package com.ljsd.jieling.handler.hero;
|
||||
|
||||
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.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.activity.event.UserMainTeamForceEvent;
|
||||
import com.ljsd.jieling.logic.dao.Item;
|
||||
import com.ljsd.jieling.logic.dao.ItemManager;
|
||||
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.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SGemConfig;
|
||||
import manager.STableManager;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.HeroInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 命石合成协议
|
||||
*/
|
||||
@Component
|
||||
public class LifeStoneUpRequestHandler extends BaseHandler<HeroInfoProto.LifeStoneUpRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.LIFE_STONE_UP_REQUEST;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession session, HeroInfoProto.LifeStoneUpRequest proto) throws Exception {
|
||||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
int type = proto.getType();
|
||||
Map<Integer, Long> costItemMap = new HashMap<>();
|
||||
Map<Integer, Long> addItemMap = new HashMap<>();
|
||||
int equipLifeStoneId = 0;
|
||||
ItemManager itemManager = user.getItemManager();
|
||||
//操作类型 1:批量合成 2:一键合成 3:命石单个合成 4:快速合成
|
||||
if (type == 1) {
|
||||
int itemId = proto.getCurGemId();
|
||||
int itemNum = proto.getSelectNum();
|
||||
SGemConfig gemConfig = STableManager.getConfig(SGemConfig.class).get(itemId);
|
||||
if (itemNum%gemConfig.getUpgradeNum()>0){
|
||||
itemNum=itemNum-(itemNum%gemConfig.getUpgradeNum());
|
||||
}
|
||||
long upNum = itemNum / gemConfig.getUpgradeNum();
|
||||
long costGold = upNum * gemConfig.getUpgradeCost()[1];
|
||||
costItemMap.put(gemConfig.getUpgradeCost()[0], costGold);
|
||||
costItemMap.put(itemId, (long) itemNum);
|
||||
addItemMap.put(gemConfig.getNextGem(), upNum);
|
||||
} else if (type == 2) {
|
||||
for (Map.Entry<Integer, TreeMap<Integer, SGemConfig>> integerTreeMapEntry : SGemConfig.gemConfigMapByType.entrySet()) {
|
||||
boolean isCost = LifeStoneAllUp(itemManager, integerTreeMapEntry.getValue(), costItemMap, addItemMap);
|
||||
if (!isCost) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (type == 3) {
|
||||
int itemId = proto.getCurGemId();
|
||||
int itemNum = proto.getSelectNum();
|
||||
SGemConfig gemConfig = STableManager.getConfig(SGemConfig.class).get(itemId);
|
||||
costItemMap.put(gemConfig.getUpgradeCost()[0], (long) gemConfig.getUpgradeCost()[1]);
|
||||
if (proto.getGridIndex() > 0) {
|
||||
costItemMap.put(itemId, (long) itemNum);
|
||||
equipLifeStoneId = gemConfig.getNextGem();
|
||||
} else {
|
||||
costItemMap.put(itemId, (long) itemNum + 1);
|
||||
addItemMap.put(gemConfig.getNextGem(), 1L);
|
||||
}
|
||||
|
||||
} else if (type == 4) {
|
||||
SGemConfig gemConfig = STableManager.getConfig(SGemConfig.class).get(proto.getCurGemId());
|
||||
TreeMap<Integer, SGemConfig> gemConfigMap = SGemConfig.gemConfigMapByType.get(gemConfig.getType());
|
||||
boolean isBag=proto.getGridIndex()<=0;//此字段判断是否在背包里进行快速合成
|
||||
if (LifeStoneQuickUp(itemManager, gemConfigMap, costItemMap, gemConfig.getLevel(),isBag)) {
|
||||
int[] curUpCost = gemConfig.getUpgradeCost();
|
||||
long allGoldCost = curUpCost[1];
|
||||
if (costItemMap.containsKey(curUpCost[0])){
|
||||
allGoldCost+=costItemMap.get(curUpCost[0]);
|
||||
}
|
||||
costItemMap.put(curUpCost[0], allGoldCost);
|
||||
if (isBag) {
|
||||
addItemMap.put(gemConfig.getNextGem(), 1L);
|
||||
if (costItemMap.containsKey(proto.getCurGemId())){
|
||||
long costNum=costItemMap.get(proto.getCurGemId())+1;
|
||||
costItemMap.put(proto.getCurGemId(),costNum);
|
||||
}else{
|
||||
costItemMap.put(proto.getCurGemId(),1L);
|
||||
}
|
||||
|
||||
} else {
|
||||
equipLifeStoneId = gemConfig.getNextGem();
|
||||
}
|
||||
} else {
|
||||
LOGGER.error("快速合成:命石合成材料不足");
|
||||
throw new ErrorCodeException(ErrorCode.HANDLE_FAILED);
|
||||
}
|
||||
}
|
||||
if (costItemMap.isEmpty()) {
|
||||
LOGGER.error("命石合成异常,请联系后端");
|
||||
throw new ErrorCodeException(ErrorCode.HANDLE_FAILED);
|
||||
}
|
||||
boolean isTrue = ItemUtil.itemCostLong(user, costItemMap, BIReason.LIFE_STONE_UP, type);
|
||||
if (!isTrue) {
|
||||
LOGGER.error("命石合成材料不足");
|
||||
throw new ErrorCodeException(ErrorCode.HANDLE_FAILED);
|
||||
}
|
||||
HeroInfoProto.LifeStoneUpResponse.Builder response = HeroInfoProto.LifeStoneUpResponse.newBuilder();
|
||||
///大于0说明是在命格系统操作
|
||||
if (equipLifeStoneId > 0) {
|
||||
CommonProto.LifeGridInfo lifeGridInfo = CommonProto.LifeGridInfo.newBuilder()
|
||||
.setGridId(proto.getGridId())
|
||||
.setGridIndex(proto.getGridIndex())
|
||||
.setItemId(equipLifeStoneId)
|
||||
.build();
|
||||
response.setLifeGridInfo(lifeGridInfo);
|
||||
user.getHeroManager().setLifeGridMap(proto.getGridId(), proto.getGridIndex(), equipLifeStoneId);
|
||||
} else {
|
||||
long[][] addItem = ItemUtil.mapToLongArray(addItemMap);
|
||||
CommonProto.Drop.Builder drop = ItemUtil.drop(user, addItem, BIReason.LIFE_STONE_UP);
|
||||
response.setDrop(drop.build());
|
||||
}
|
||||
Poster.getPoster().dispatchEvent(new UserMainTeamForceEvent(session.getUid()));
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.LIFE_STONE_UP_RESPONSE_VALUE, response.build(), true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 命石一键合成
|
||||
* @param itemManager
|
||||
* @param gemConfigMap
|
||||
* @param costItemMap
|
||||
* @param addItemMap
|
||||
* @return
|
||||
*/
|
||||
private boolean LifeStoneAllUp(ItemManager itemManager, TreeMap<Integer, SGemConfig> gemConfigMap, Map<Integer, Long> costItemMap, Map<Integer, Long> addItemMap) {
|
||||
long addCount = 0;//一个循环合成数量
|
||||
long costGoldNum = 0;//合成金币总消耗
|
||||
int costGoldId = gemConfigMap.get(1).getUpgradeCost()[0];//获取消耗材料id
|
||||
if (costItemMap.containsKey(costGoldId)) {
|
||||
costGoldNum = costItemMap.get(costGoldId);
|
||||
}
|
||||
int[]minCostArr=gemConfigMap.get(1).getUpgradeCost();
|
||||
if (itemManager.getItem(minCostArr[0]).getItemNum()-costGoldNum<minCostArr[1]){
|
||||
return false;
|
||||
}
|
||||
for (Map.Entry<Integer, SGemConfig> gemConfigEntry : gemConfigMap.entrySet()) {
|
||||
SGemConfig gemConfig = gemConfigEntry.getValue();
|
||||
///升到满级
|
||||
if (gemConfig.getNextGem() == 0) {
|
||||
if (addCount > 0) {
|
||||
addItemMap.put(gemConfig.getId(), addCount);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
Item curItem = itemManager.getItem(gemConfig.getId());
|
||||
long costNum = addCount;
|
||||
if (curItem != null) {
|
||||
costNum = curItem.getItemNum() + addCount;
|
||||
}
|
||||
///命石不足
|
||||
if (costNum < gemConfig.getUpgradeNum()) {
|
||||
if (addCount > 0) {
|
||||
addItemMap.put(gemConfig.getId(), addCount);
|
||||
addCount = 0;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
int stoneNum = gemConfig.getUpgradeNum();
|
||||
int[] costGold = gemConfig.getUpgradeCost();
|
||||
long remainNum = costNum % stoneNum;
|
||||
if (remainNum != 0) {
|
||||
costNum -= remainNum;
|
||||
}
|
||||
if (costNum <= 0) {
|
||||
continue;
|
||||
}
|
||||
//本次合成消耗
|
||||
long needCostGoldNum = costNum / stoneNum * costGold[1];
|
||||
long haveGoldNum = 0;
|
||||
if (itemManager.getItem(costGold[0]) != null) {
|
||||
haveGoldNum = itemManager.getItem(costGold[0]).getItemNum();
|
||||
}
|
||||
///金币不足情况中断合成
|
||||
if (needCostGoldNum + costGoldNum > haveGoldNum) {
|
||||
long upNum = (haveGoldNum - costGoldNum) / costGold[1];
|
||||
long endCostNum = upNum * stoneNum;
|
||||
long haveCostNum = endCostNum - addCount;
|
||||
if (haveCostNum > 0) {
|
||||
costItemMap.put(gemConfig.getId(), haveCostNum);
|
||||
} else {
|
||||
addItemMap.put(gemConfig.getId(), -haveCostNum);
|
||||
}
|
||||
addItemMap.put(gemConfig.getNextGem(), upNum);
|
||||
costGoldNum += upNum * costGold[1];
|
||||
//刷新消耗金币数量
|
||||
costItemMap.put(costGold[0], costGoldNum);
|
||||
return true;
|
||||
}
|
||||
//计算累计消耗金币
|
||||
costGoldNum += needCostGoldNum;
|
||||
if (curItem != null) {
|
||||
long bagCost = curItem.getItemNum() - remainNum;
|
||||
//刷新消耗命石数量
|
||||
costItemMap.put(gemConfig.getId(), bagCost);
|
||||
long addNum = remainNum - curItem.getItemNum();
|
||||
if (addNum > 0) {
|
||||
addItemMap.put(gemConfig.getId(), addNum);
|
||||
}
|
||||
}
|
||||
//保存累计消耗金币数量
|
||||
costItemMap.put(costGold[0], costGoldNum);
|
||||
|
||||
if (curItem == null) {
|
||||
addItemMap.put(gemConfig.getId(), remainNum);
|
||||
}
|
||||
addCount = costNum / stoneNum;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 命石快速合成
|
||||
* @param itemManager
|
||||
* @param gemConfigMap
|
||||
* @param costItemMap
|
||||
* @param selectGemLv
|
||||
* @return
|
||||
*/
|
||||
private boolean LifeStoneQuickUp(ItemManager itemManager, TreeMap<Integer, SGemConfig> gemConfigMap, Map<Integer, Long> costItemMap, int selectGemLv,boolean isBag) {
|
||||
long addCount = 0;//一个循环合成数量
|
||||
long costGoldNum = 0;//合成金币总消耗
|
||||
for (Map.Entry<Integer, SGemConfig> gemConfigEntry : gemConfigMap.entrySet()) {
|
||||
SGemConfig gemConfig = gemConfigEntry.getValue();
|
||||
Item curItem = itemManager.getItem(gemConfig.getId());
|
||||
if (gemConfig.getLevel()==selectGemLv){
|
||||
if (addCount>0||curItem==null){
|
||||
break;
|
||||
}
|
||||
///是否是在背包操作
|
||||
if (isBag){
|
||||
if (curItem.getItemNum()<gemConfig.getUpgradeNum()){
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
if (curItem.getItemNum()<gemConfig.getUpgradeNum()-1){
|
||||
break;
|
||||
}
|
||||
}
|
||||
costItemMap.put(gemConfig.getId(),1L);
|
||||
addCount=1;
|
||||
break;
|
||||
}
|
||||
///如果命石等级大于当前选中的命石等级跳过
|
||||
if (gemConfig.getLevel() > selectGemLv) {
|
||||
break;
|
||||
}
|
||||
|
||||
long costNum = addCount;
|
||||
if (curItem != null) {
|
||||
costNum = curItem.getItemNum() + addCount;
|
||||
}
|
||||
int[] costGold = gemConfig.getUpgradeCost();
|
||||
int stoneNum = gemConfig.getUpgradeNum();
|
||||
if (costNum < stoneNum) {
|
||||
costItemMap.clear();
|
||||
costGoldNum = 0;
|
||||
addCount = 0;
|
||||
continue;
|
||||
}
|
||||
long needNum = GetNeedLifeStoneNum(gemConfig.getType(), gemConfig.getLevel(), selectGemLv);
|
||||
//剩余数量
|
||||
long remainNum = costNum % stoneNum;
|
||||
if (costNum > needNum) {
|
||||
remainNum = costNum - needNum;
|
||||
costNum = needNum;
|
||||
}
|
||||
addCount = costNum / stoneNum;
|
||||
//本次合成消耗金币
|
||||
long needCostGoldNum = addCount * costGold[1];
|
||||
//计算累计消耗金币
|
||||
costGoldNum += needCostGoldNum;
|
||||
costItemMap.put(costGold[0], costGoldNum);
|
||||
if (curItem != null) {
|
||||
long bagCost = curItem.getItemNum() - remainNum;
|
||||
//刷新消耗命石数量
|
||||
costItemMap.put(gemConfig.getId(), bagCost);
|
||||
}
|
||||
long haveGoldNum = itemManager.getItem(costGold[0]).getItemNum();
|
||||
if (costGoldNum > haveGoldNum) {
|
||||
LOGGER.error("命石快速合成金币不足");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return addCount == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取升级到目标等级获取消耗指定命石需要数量
|
||||
* @param stoneType 命石类型
|
||||
* @param costStoneLv 消耗命石等级
|
||||
* @param targetStoneLv 目标等级
|
||||
* @return
|
||||
*/
|
||||
private long GetNeedLifeStoneNum(int stoneType, int costStoneLv, int targetStoneLv) {
|
||||
long needNum = 1;
|
||||
TreeMap<Integer, SGemConfig> stoneLvMap = SGemConfig.gemConfigMapByType.get(stoneType);
|
||||
for (Map.Entry<Integer, SGemConfig> gemConfigEntry : stoneLvMap.entrySet()) {
|
||||
if (gemConfigEntry.getKey() < costStoneLv) {
|
||||
continue;
|
||||
}
|
||||
if (gemConfigEntry.getValue().getLevel() == targetStoneLv) {
|
||||
break;
|
||||
}
|
||||
needNum *= gemConfigEntry.getValue().getUpgradeNum();
|
||||
}
|
||||
return needNum;
|
||||
}
|
||||
|
||||
}
|
|
@ -5,22 +5,18 @@ import com.ljsd.jieling.exception.ErrorCodeException;
|
|||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.dao.HeroManager;
|
||||
import com.ljsd.jieling.logic.dao.SixiangProfessionInfo;
|
||||
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.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SFourQuadrantConfig;
|
||||
import config.SPlayerSkill;
|
||||
import config.SXiuXian;
|
||||
import manager.STableManager;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.HeroInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Component
|
||||
public class PracticeSkillUpRequestHandler extends BaseHandler<HeroInfoProto.PracticeSkillUpRequest> {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.ljsd.jieling.handler.hero;
|
||||
|
||||
import com.ljsd.jieling.core.FunctionIdEnum;
|
||||
import com.ljsd.jieling.core.HandlerLogicThread;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
|
@ -9,12 +11,11 @@ import com.ljsd.jieling.logic.activity.event.UserMainTeamForceEvent;
|
|||
import com.ljsd.jieling.logic.dao.SixiangProfessionInfo;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SFourQuadrantConfig;
|
||||
import config.SXiuXian;
|
||||
import config.SGlobalSystemConfig;
|
||||
import manager.STableManager;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.CommonProto;
|
||||
|
@ -37,6 +38,11 @@ public class SixiangUpRequestHandler extends BaseHandler<HeroInfoProto.SixiangUp
|
|||
int uid = session.getUid();
|
||||
|
||||
User user = UserManager.getUser(uid);
|
||||
SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(FunctionIdEnum.FourQua.getFunctionType());
|
||||
if (!HandlerLogicThread.checkOpen(user, sGlobalSystemConfig)) {
|
||||
LOGGER.error("等级不足功能尚未开启");
|
||||
throw new ErrorCodeException(ErrorCode.HANDLE_FAILED);
|
||||
}
|
||||
SixiangProfessionInfo professionInfo = user.getHeroManager().getSixiangDataMap().get(professionId);
|
||||
if (CheckCurUpIsLimit(professionInfo)) {
|
||||
throw new ErrorCodeException(ErrorCode.SIXIANG_UP_LIMIT);
|
||||
|
|
|
@ -11,7 +11,6 @@ import com.ljsd.jieling.logic.activity.event.UserMainTeamForceEvent;
|
|||
import com.ljsd.jieling.logic.dao.SixiangProfessionInfo;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.fight.eventhandler.IFightEventProcesor;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
|
|
|
@ -23,8 +23,6 @@ import com.ljsd.jieling.util.MessageUtil;
|
|||
import config.SActivityRewardConfig;
|
||||
import config.SErrorCodeEerverConfig;
|
||||
import config.SGlobalActivity;
|
||||
import config.SSpiritAnimalSummon;
|
||||
import manager.STableManager;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import rpc.protocols.CommonProto;
|
||||
|
@ -358,6 +356,22 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
* @return
|
||||
*/
|
||||
public Set<Integer> getCloseGoods(User user){
|
||||
//超值返利活动临时处理 下次大更新之前可以直接删掉
|
||||
if (id==90||id==9000){
|
||||
HashSet<Integer> set = new HashSet<>();
|
||||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
if (mission == null){
|
||||
return set;
|
||||
}
|
||||
Map<Integer, ActivityProgressInfo> map = mission.getActivityMissionMap();
|
||||
for (Map.Entry<Integer, ActivityProgressInfo> progressInfoEntry : map.entrySet()) {
|
||||
SActivityRewardConfig rewardConfig=SActivityRewardConfig.getsActivityRewardConfigByMissionId(progressInfoEntry.getKey());
|
||||
if (progressInfoEntry.getValue().getState()==ActivityType.HAD_TAKED||(progressInfoEntry.getValue().getState()==ActivityType.WILL_TAKE&&mission.getV()+1!=rewardConfig.getSort())){
|
||||
set.add(rewardConfig.getValues()[0][0]);
|
||||
}
|
||||
}
|
||||
return set;
|
||||
}
|
||||
return new HashSet<>(1);
|
||||
}
|
||||
|
||||
|
@ -378,26 +392,11 @@ public abstract class AbstractActivity implements IActivity, IEventHandler {
|
|||
public List<CommonProto.ActivityInfo.MissionInfo> getAllMissInfo(User user,ActivityMission activityMission, Set<Integer> filter) {
|
||||
Map<Integer, ActivityProgressInfo> activityProgressInfoMap = activityMission.getActivityMissionMap();
|
||||
List<CommonProto.ActivityInfo.MissionInfo> missionInfos = new ArrayList<>(activityProgressInfoMap.size());
|
||||
long now = TimeUtils.now();
|
||||
for (Map.Entry<Integer, ActivityProgressInfo> missionProgress : activityProgressInfoMap.entrySet()) {
|
||||
if (filter != null && !filter.contains(missionProgress.getKey())) {
|
||||
continue;
|
||||
}
|
||||
Integer missionId = missionProgress.getKey();
|
||||
SActivityRewardConfig sActivityRewardConfig = SActivityRewardConfig.getsActivityRewardConfigByMissionId(missionId);
|
||||
if (missionId != 0 && sActivityRewardConfig == null) {
|
||||
// missionId==0 灵兽宝阁特殊使用
|
||||
continue;
|
||||
}
|
||||
if(id == ActivityType.RechargeTotal){
|
||||
// 2021-12-22 09:00:00 之后开的服,首充不显示累充满100元任务
|
||||
if (now > 1640134800000L) {
|
||||
int value = sActivityRewardConfig.getValues()[0][0];
|
||||
if (value == 100) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
ActivityProgressInfo activityProgressInfo = missionProgress.getValue();
|
||||
missionInfos.add(CommonProto.ActivityInfo.MissionInfo.newBuilder().setMissionId(missionId).setProgress(activityProgressInfo.getProgrss()).setState(activityProgressInfo.getState()).build());
|
||||
}
|
||||
|
|
|
@ -195,6 +195,7 @@ public class ActivityLogic implements IEventHandler{
|
|||
// 开服条件判断
|
||||
boolean open = SGlobalActivity.checkActivityIfOpen(sGlobalActivity.getId(),0,GameApplication.serverConfig.getCacheOpenTime());
|
||||
if (!open){
|
||||
openActivityIds.remove(sGlobalActivity.getId());
|
||||
continue;
|
||||
}
|
||||
if (endTime != 0 && now > endTime) {
|
||||
|
@ -586,6 +587,12 @@ public class ActivityLogic implements IEventHandler{
|
|||
for (Map.Entry<Integer, ActivityMission> activityState : activityMissionMap.entrySet()) {
|
||||
Integer activityId = activityState.getKey();
|
||||
ActivityMission activityMission = activityState.getValue();
|
||||
|
||||
boolean open = SGlobalActivity.checkActivityIfOpen(activityId,user.getPlayerInfoManager().getCreateTime(),GameApplication.serverConfig.getCacheOpenTime());
|
||||
if (!open){
|
||||
// 开服条件判断
|
||||
continue;
|
||||
}
|
||||
//todo 活动未初始化成功
|
||||
if (activityMission == null) {
|
||||
continue;
|
||||
|
@ -668,6 +675,11 @@ public class ActivityLogic implements IEventHandler{
|
|||
}
|
||||
|
||||
public void sendActivityInfo(User user,int activityId){
|
||||
// 开服条件判断
|
||||
boolean open = SGlobalActivity.checkActivityIfOpen(activityId,user.getPlayerInfoManager().getCreateTime(),GameApplication.serverConfig.getCacheOpenTime());
|
||||
if (!open){
|
||||
return;
|
||||
}
|
||||
ISession session = OnlineUserManager.getSessionByUid(user.getId());
|
||||
if(session!=null){
|
||||
PlayerInfoProto.ActivityUpateIndication.Builder builder = PlayerInfoProto.ActivityUpateIndication.newBuilder();
|
||||
|
@ -767,8 +779,10 @@ public class ActivityLogic implements IEventHandler{
|
|||
Map<Integer, ActivityMission> activityMissionMap = activityManager.getActivityMissionMap();
|
||||
for (Map.Entry<Integer, ActivityMission> item : activityMissionMap.entrySet()) {
|
||||
ActivityMission activityMission = item.getValue();
|
||||
if (withState && activityMission.getActivityState() != ActivityType.OPEN_STATE) {
|
||||
continue;
|
||||
if (activityType != ActivityType.NEW_WELFARE) { // 这个活动未开启也需要记录进度
|
||||
if (withState && activityMission.getActivityState() != ActivityType.OPEN_STATE) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
Integer activityId = item.getKey();
|
||||
SGlobalActivity sGlobalActivity = SGlobalActivity.getsGlobalActivityMap().get(activityId);
|
||||
|
|
|
@ -18,7 +18,9 @@ import config.SActivityRewardConfig;
|
|||
import config.SRechargeCommodityNewConfig;
|
||||
import manager.STableManager;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
class NewRechargeSumDayActivity extends AbstractActivity {
|
||||
|
||||
|
@ -81,4 +83,20 @@ class NewRechargeSumDayActivity extends AbstractActivity {
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Set<Integer> getCloseGoods(User user) {
|
||||
HashSet<Integer> set = new HashSet<>();
|
||||
ActivityMission mission = user.getActivityManager().getActivityMissionMap().get(id);
|
||||
if (mission == null) {
|
||||
return set;
|
||||
}
|
||||
Map<Integer, ActivityProgressInfo> map = mission.getActivityMissionMap();
|
||||
for (Map.Entry<Integer, ActivityProgressInfo> progressInfoEntry : map.entrySet()) {
|
||||
SActivityRewardConfig rewardConfig = SActivityRewardConfig.getsActivityRewardConfigByMissionId(progressInfoEntry.getKey());
|
||||
if (progressInfoEntry.getValue().getState() == ActivityType.HAD_TAKED || (progressInfoEntry.getValue().getState() == ActivityType.WILL_TAKE && mission.getV() + 1 != rewardConfig.getSort())) {
|
||||
set.add(rewardConfig.getValues()[0][0]);
|
||||
}
|
||||
}
|
||||
return set;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import com.ljsd.jieling.logic.dao.UserManager;
|
|||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
|
@ -22,6 +23,7 @@ import config.SGlobalActivity;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class NewWelfareActivity extends AbstractActivity {
|
||||
|
||||
|
@ -35,6 +37,34 @@ public class NewWelfareActivity extends AbstractActivity {
|
|||
super.initActivity(user);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新进度
|
||||
*
|
||||
* @param filterMissId miss过滤
|
||||
*/
|
||||
@Override
|
||||
public void sendActivityProgress(ISession session, ActivityMission activityMission, Set<Integer> filterMissId) {
|
||||
if (session == null) {
|
||||
return;
|
||||
}
|
||||
PlayerInfoProto.ActivityUpateProgressIndication.Builder builder = PlayerInfoProto.ActivityUpateProgressIndication.newBuilder();
|
||||
|
||||
User user = UserManager.getUserInMem(session.getUid());
|
||||
if (user != null && activityMission != null) {
|
||||
if (activityMission.getActivityState() != ActivityType.OPEN_STATE) {
|
||||
return;
|
||||
}
|
||||
List<CommonProto.ActivityInfo.MissionInfo> missInfo = getAllMissInfo(user, activityMission, filterMissId);
|
||||
CommonProto.ActivityInfo.Builder builder1 = CommonProto.ActivityInfo.newBuilder()
|
||||
.setValue(activityMission.getV())
|
||||
.addAllMission(missInfo)
|
||||
.setActivityId(id);
|
||||
builder.setActivityInfo(builder1);
|
||||
MessageUtil.sendIndicationMessage(session, 1, MessageTypeProto.MessageType.ACTIVITY_UPDATE_PROGRESS_INDICATION_VALUE, builder.build(), true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEvent(IEvent event) throws Exception {
|
||||
if (!(event instanceof NewWelfareEvent)) {
|
||||
|
|
|
@ -32,7 +32,7 @@ class RechargeSumDayActivity extends AbstractActivity {
|
|||
if (activityMission.getV() <= 0 || activityMission.getV() >= 15) {
|
||||
return;
|
||||
}
|
||||
if (user.getPlayerInfoManager().getRechargedaily() > 0 ) {//充值0.99不触发修改
|
||||
if (user.getPlayerInfoManager().getRechargedaily() >= 6 ) {//充值小于六块不触发修改
|
||||
// SActivityRewardConfig.getsActivityRewardConfigByMissionId(missionId).getValues()[0][0]
|
||||
activityMission.setV(activityMission.getV() + 1);
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ class RechargeSumDayActivity extends AbstractActivity {
|
|||
if (activityMission.getV() <= 0 || activityMission.getV() >= 15) {
|
||||
return;
|
||||
}
|
||||
if (count>0 ) {//只要是充值就算
|
||||
if (count>=6000 ) {//大于6块钱才算
|
||||
//>= SActivityRewardConfig.getsActivityRewardConfigByMissionId(missionId).getValues()[0][0]
|
||||
activityProgressInfo.setProgrss(1);
|
||||
}
|
||||
|
|
|
@ -1,13 +1,21 @@
|
|||
package com.ljsd.jieling.logic.activity;
|
||||
|
||||
import com.ljsd.GameApplication;
|
||||
import com.ljsd.jieling.jbean.ActivityMission;
|
||||
import com.ljsd.jieling.jbean.ActivityProgressInfo;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.store.newRechargeInfo.NewRechargeInfo;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import config.SActivityRewardConfig;
|
||||
import rpc.protocols.CommonProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
class RechargeTotalActivity extends AbstractActivity {
|
||||
|
||||
public RechargeTotalActivity(int id) {
|
||||
|
@ -27,4 +35,33 @@ class RechargeTotalActivity extends AbstractActivity {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CommonProto.ActivityInfo.MissionInfo> getAllMissInfo(User user, ActivityMission activityMission, Set<Integer> filter) {
|
||||
Map<Integer, ActivityProgressInfo> activityProgressInfoMap = activityMission.getActivityMissionMap();
|
||||
List<CommonProto.ActivityInfo.MissionInfo> missionInfos = new ArrayList<>(activityProgressInfoMap.size());
|
||||
long openTime = TimeUtils.stringToTimeLong2(GameApplication.serverConfig.getOpenTime());
|
||||
for (Map.Entry<Integer, ActivityProgressInfo> missionProgress : activityProgressInfoMap.entrySet()) {
|
||||
if (filter != null && !filter.contains(missionProgress.getKey())) {
|
||||
continue;
|
||||
}
|
||||
Integer missionId = missionProgress.getKey();
|
||||
SActivityRewardConfig sActivityRewardConfig = SActivityRewardConfig.getsActivityRewardConfigByMissionId(missionId);
|
||||
if (sActivityRewardConfig == null) {
|
||||
continue;
|
||||
}
|
||||
if(id == ActivityType.RechargeTotal){
|
||||
// 2021-12-22 09:00:00 之后开的服,首充不显示累充满100元任务
|
||||
if (openTime > 1640134800000L) {
|
||||
int value = sActivityRewardConfig.getValues()[0][0];
|
||||
if (value == 100) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
ActivityProgressInfo activityProgressInfo = missionProgress.getValue();
|
||||
missionInfos.add(CommonProto.ActivityInfo.MissionInfo.newBuilder().setMissionId(missionId).setProgress(activityProgressInfo.getProgrss()).setState(activityProgressInfo.getState()).build());
|
||||
}
|
||||
return missionInfos;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -167,6 +167,24 @@ public class HeroManager extends MongoBase {
|
|||
return faBaoGongMingSkillMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 命格数据
|
||||
*/
|
||||
private Map<Integer,Map<Integer,Integer>>LifeGridMap=new HashMap<>();
|
||||
|
||||
public Map<Integer, Map<Integer, Integer>> getLifeGridMap() {
|
||||
return LifeGridMap;
|
||||
}
|
||||
|
||||
///设置命格数据
|
||||
public void setLifeGridMap(int gridId,int index,int itemId) {
|
||||
if (!LifeGridMap.containsKey(gridId)) {
|
||||
LifeGridMap.put(gridId, new HashMap<>());
|
||||
}
|
||||
LifeGridMap.get(gridId).put(index,itemId);
|
||||
updateString("LifeGridMap."+gridId, LifeGridMap.get(gridId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 心愿可以选择的英雄列表
|
||||
*/
|
||||
|
|
|
@ -153,6 +153,7 @@ public class UserManager {
|
|||
playerManager.setIp(ip);
|
||||
playerManager.setChannel_id(channle_id);
|
||||
playerManager.setBundle_id(bundle_id);
|
||||
playerManager.setVersionCode(GlobalsDef.VERSION_CODE);
|
||||
int headFrameId = STableManager.getFigureConfig(CommonStaticConfig.class).getGameSetting().getDefaultPicture();
|
||||
playerManager.setHeadFrame(headFrameId);
|
||||
playerManager.putHeadFrameValidTime(headFrameId,0L);
|
||||
|
|
|
@ -466,7 +466,6 @@ public class FightUtil {
|
|||
user.getTeamPosManager().setCurTeamPosId(teamId);
|
||||
List<CommonProto.FightUnitInfo> heroFightInfos = new ArrayList<>();
|
||||
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
int i = 0;
|
||||
for (TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfos) {
|
||||
Hero hero = user.getHeroManager().getHero(teamPosHeroInfo.getHeroId());
|
||||
if (hero == null) {
|
||||
|
|
|
@ -2659,7 +2659,7 @@ public class HeroLogic {
|
|||
//英雄皮肤加成 记得判断皮肤过期
|
||||
int skin = hero.getSkin();
|
||||
if (skin != 0) {
|
||||
Map<Integer, Integer> skinInfo = user.getHeroManager().getSkinInfo();
|
||||
Map<Integer, Integer> skinInfo = heroManager.getSkinInfo();
|
||||
SHeroSkin sHeroSkin = SHeroSkin.skinMapByType.get(skin);
|
||||
if (sHeroSkin != null && sHeroSkin.getMonomerProperty() != null && sHeroSkin.getMonomerProperty().length > 0) {
|
||||
if (skinInfo.containsKey(skin) && (skinInfo.get(skin) == -1 || skinInfo.get(skin) > TimeUtils.nowInt())) {
|
||||
|
@ -2689,7 +2689,7 @@ public class HeroLogic {
|
|||
combinedAttribute(SPlayerHeadIcon.getHeadIconMap().get(entry.getKey()).getUnlockProperty(), heroAllAttribute);
|
||||
}
|
||||
//四象心法加成
|
||||
for (Map.Entry<Integer, SixiangProfessionInfo> entry : user.getHeroManager().getSixiangDataMap().entrySet()) {
|
||||
for (Map.Entry<Integer, SixiangProfessionInfo> entry :heroManager.getSixiangDataMap().entrySet()) {
|
||||
if (scHero.getProfession() != entry.getKey()) {
|
||||
continue;
|
||||
}
|
||||
|
@ -2697,22 +2697,22 @@ public class HeroLogic {
|
|||
Map<Integer, Integer> propertyMap = entry.getValue().propertyMap;
|
||||
int[][] propArr = ItemUtil.mapToArray(propertyMap);
|
||||
combinedAttribute(propArr, heroAllAttribute);
|
||||
if (user.getHeroManager().getSixiangPropUpMap().containsKey(entry.getKey())) {
|
||||
if (heroManager.getSixiangPropUpMap().containsKey(entry.getKey())) {
|
||||
//进阶属性
|
||||
Map<Integer, Integer> upStarPropertyMap = user.getHeroManager().getSixiangPropUpMap().get(entry.getKey());
|
||||
Map<Integer, Integer> upStarPropertyMap = heroManager.getSixiangPropUpMap().get(entry.getKey());
|
||||
int[][] upStarProp = ItemUtil.mapToArray(upStarPropertyMap);
|
||||
combinedAttribute(upStarProp, heroAllAttribute);
|
||||
}
|
||||
}
|
||||
///四象心法共鸣属性加成
|
||||
if (user.getHeroManager().GetSiXiangGongMingLv() > 0) {
|
||||
SFourQuadrantConfig fourConfig = SFourQuadrantConfig.configByStrtMap.get(user.getHeroManager().GetSiXiangGongMingLv());
|
||||
if (heroManager.GetSiXiangGongMingLv() > 0) {
|
||||
SFourQuadrantConfig fourConfig = SFourQuadrantConfig.configByStrtMap.get(heroManager.GetSiXiangGongMingLv());
|
||||
combinedAttribute(fourConfig.getPropResonance(), heroAllAttribute);
|
||||
}
|
||||
|
||||
///四象心法技能属性加成
|
||||
Map<Integer, Integer> skillPropertyMap = new HashMap<>();
|
||||
for (Map.Entry<Integer, SixiangProfessionInfo> entry : user.getHeroManager().getSixiangDataMap().entrySet()) {
|
||||
for (Map.Entry<Integer, SixiangProfessionInfo> entry : heroManager.getSixiangDataMap().entrySet()) {
|
||||
if (entry.getValue().level > 0) {
|
||||
SFourQuadrantConfig fourConfig = SFourQuadrantConfig.configByStrtMap.get(entry.getValue().level);
|
||||
int[] skillAddProp = fourConfig.getSkill()[entry.getKey() - 1];
|
||||
|
@ -2723,25 +2723,36 @@ public class HeroLogic {
|
|||
combinedAttribute(skillProp, heroAllAttribute);
|
||||
|
||||
//英雄好感度属性加成
|
||||
if (user.getHeroManager().getHeroLikablePropAddMap().containsKey(scHero.getId())) {
|
||||
int[][] likableProp = ItemUtil.mapToArray(user.getHeroManager().getHeroLikablePropAddMap().get(scHero.getId()));
|
||||
if (heroManager.getHeroLikablePropAddMap().containsKey(scHero.getId())) {
|
||||
int[][] likableProp = ItemUtil.mapToArray(heroManager.getHeroLikablePropAddMap().get(scHero.getId()));
|
||||
combinedAttribute(likableProp, heroAllAttribute);
|
||||
}
|
||||
//英雄总好感度属性加成
|
||||
if (user.getHeroManager().getAllLikablePropAddMap().size() > 0) {
|
||||
int[][] allLikableProp = ItemUtil.mapToArray(user.getHeroManager().getAllLikablePropAddMap());
|
||||
if (heroManager.getAllLikablePropAddMap().size() > 0) {
|
||||
int[][] allLikableProp = ItemUtil.mapToArray(heroManager.getAllLikablePropAddMap());
|
||||
combinedAttribute(allLikableProp, heroAllAttribute);
|
||||
}
|
||||
|
||||
///法宝之魂属性加成
|
||||
for (Map.Entry<Integer, Integer> faBaoSoulEntry : user.getHeroManager().getFaBaoSoulMap().entrySet()) {
|
||||
for (Map.Entry<Integer, Integer> faBaoSoulEntry :heroManager.getFaBaoSoulMap().entrySet()) {
|
||||
STrump trumpConfig = STrump.sTrumpMap.get(faBaoSoulEntry.getKey());
|
||||
STrumpLevelupPool lvUpProps = STrumpLevelupPool.levelPoolMap.get(trumpConfig.getLvupPool()).get(faBaoSoulEntry.getValue());
|
||||
combinedAttribute(lvUpProps.getLvupProps(), heroAllAttribute);
|
||||
}
|
||||
|
||||
///命格属性加成
|
||||
for (Map.Entry<Integer, Map<Integer, Integer>> lifeGridMapEntry : heroManager.getLifeGridMap().entrySet()) {
|
||||
for (Map.Entry<Integer, Integer> entry : lifeGridMapEntry.getValue().entrySet()) {
|
||||
int lifeStoneId=entry.getValue();
|
||||
if (lifeStoneId>0){
|
||||
SGemConfig sGemConfig=STableManager.getConfig(SGemConfig.class).get(lifeStoneId);
|
||||
combinedAttribute(sGemConfig.getProperty(), heroAllAttribute);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 身外化身加成
|
||||
Map<Integer, TransformationInfo> transformationList = user.getHeroManager().getTransformationList();
|
||||
Map<Integer, TransformationInfo> transformationList = heroManager.getTransformationList();
|
||||
Map<Integer, SChangingCard> changingCardMap = STableManager.getConfig(SChangingCard.class);
|
||||
int[][] arrayValue = SSpecialConfig.getTwiceArrayValue(SSpecialConfig.PER_CHANGING_CART_PROP);
|
||||
for (TransformationInfo info : transformationList.values()) {
|
||||
|
@ -2756,7 +2767,7 @@ public class HeroLogic {
|
|||
|
||||
//装备总战力评分
|
||||
int equipForce = 0;
|
||||
Iterator<Map.Entry<Integer, Integer>> iterator = hero.getEquipByHongmengPositionMap(user.getHeroManager()).entrySet().iterator();
|
||||
Iterator<Map.Entry<Integer, Integer>> iterator = hero.getEquipByHongmengPositionMap(heroManager).entrySet().iterator();
|
||||
// 套装list初始化
|
||||
ArrayList<SEquipConfig> suiteNumList = new ArrayList<>();
|
||||
while (iterator.hasNext()) {
|
||||
|
|
|
@ -233,6 +233,7 @@ public class StoreLogic implements IEventHandler {
|
|||
StoreInfo storeInfo = it.next().getValue();
|
||||
SStoreTypeConfig sStoreTypeConfig = SStoreTypeConfig.getsStoreTypeConfigMap().get(storeInfo.getId());
|
||||
if(null == sStoreTypeConfig){
|
||||
removeStoreIds.add(storeInfo.getId());
|
||||
continue;
|
||||
}
|
||||
if (sStoreTypeConfig.getStoreOpenRule() ==2 || sStoreTypeConfig.getStoreOpenRule() ==5 || sStoreTypeConfig.getStoreOpenRule() ==6 || sStoreTypeConfig.getStoreOpenRule() ==7){
|
||||
|
|
|
@ -25,7 +25,7 @@ public class FightDataUtil {
|
|||
|
||||
LuaValue LuaTable = new LuaTable();
|
||||
LuaTable.set("uid",data);
|
||||
// LuaTable.set("enemyData", getEnemyData(monsterTeamList));
|
||||
// LuaTable.set("enemyData", getEnemyData(monsterTeamList));
|
||||
//
|
||||
// if (data.equals("") || data==null){
|
||||
// return new LuaTable();
|
||||
|
|
|
@ -604,6 +604,7 @@ public class ItemUtil {
|
|||
case GlobalItemType.LikableCostItem:
|
||||
case GlobalItemType.MOUNT_FRAGMENTS_ITEM:
|
||||
case GlobalItemType.TRUMP_CHIP:
|
||||
case GlobalItemType.LIFE_STONE:
|
||||
case GlobalItemType.TRANSFORMATION_CARD:
|
||||
case GlobalItemType.HOOK_PROP:
|
||||
itemType = GlobalItemType.ITEM;
|
||||
|
@ -1471,15 +1472,6 @@ public class ItemUtil {
|
|||
return true;
|
||||
}
|
||||
|
||||
public static boolean itemCostLong(User user,Map<Integer, Long> costItems,int reason,int subReson) throws Exception {
|
||||
boolean result = checkCostLong(user, costItems);
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
useItemLong(user, costItems,reason,subReson);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean itemCost(User user,int[][] costItems,int times,int reason,int subReason) throws Exception {
|
||||
Map<Integer, Integer> itemMap = new HashMap<>();
|
||||
selectCost(costItems,itemMap,times);
|
||||
|
@ -1491,6 +1483,15 @@ public class ItemUtil {
|
|||
return true;
|
||||
}
|
||||
|
||||
public static boolean itemCostLong(User user,Map<Integer, Long> costItems,int reason,int subReson) throws Exception {
|
||||
boolean result = checkCostLong(user, costItems);
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
useItemLong(user, costItems,reason,subReson);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean checkCost(User user, Map<Integer, Integer> itemMap) throws Exception {
|
||||
HashMap<Integer, Long> longMap = new HashMap<>();
|
||||
itemMap.forEach((k,v)->longMap.put(k,v.longValue()));
|
||||
|
|
|
@ -101,4 +101,15 @@ public class SErrorCodeEerverConfig implements BaseConfig {
|
|||
return value.getvalue()+str.toString();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static String getFormatMessage(String key, Object[] obj) {
|
||||
SErrorCodeEerverConfig value = errorCodeMap.get(key);
|
||||
if (value == null) {
|
||||
return "";
|
||||
}
|
||||
String string = MessageFormat.format(value.getvalue(), obj);
|
||||
return string;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
@Table(name ="GemConfig")
|
||||
public class SGemConfig implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int quality;
|
||||
|
||||
private int type;
|
||||
|
||||
private int level;
|
||||
|
||||
private int[][] property;
|
||||
|
||||
private int upgradeNum;
|
||||
|
||||
private int[] upgradeCost;
|
||||
|
||||
private int nextGem;
|
||||
|
||||
public static TreeMap<Integer, TreeMap<Integer,SGemConfig>>gemConfigMapByType;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
gemConfigMapByType=new TreeMap<>();
|
||||
Map<Integer, SGemConfig> config = STableManager.getConfig(SGemConfig.class);
|
||||
for(SGemConfig sGemConfig : config.values()){
|
||||
if (!gemConfigMapByType.containsKey(sGemConfig.getType())){
|
||||
TreeMap<Integer,SGemConfig>lvMap=new TreeMap<>();
|
||||
gemConfigMapByType.put(sGemConfig.getType(),lvMap);
|
||||
}
|
||||
gemConfigMapByType.get(sGemConfig.getType()).put(sGemConfig.getLevel(),sGemConfig);
|
||||
}
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getQuality() {
|
||||
return quality;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public int[][] getProperty() {
|
||||
return property;
|
||||
}
|
||||
|
||||
public int getUpgradeNum() {
|
||||
return upgradeNum;
|
||||
}
|
||||
|
||||
public int[] getUpgradeCost() {
|
||||
return upgradeCost;
|
||||
}
|
||||
|
||||
public int getNextGem() {
|
||||
return nextGem;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue