神王第一版
parent
31ae65a99c
commit
6942d1660a
|
|
@ -472,4 +472,5 @@ public interface BIReason {
|
|||
int EVERYDAY_DISCOUNT_CLEAN_MISSION_COUNT = 1357;//天天折扣清零次数
|
||||
|
||||
int TRAINGING_SPEED_ITEM_COST = 1358;//特训加速道具消耗
|
||||
int SHENWANG_UP_LV = 1359;//神王升级
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.ljsd.jieling.handler.hero;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.hero.HeroLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.HeroInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
||||
/**
|
||||
* 神王升级
|
||||
*/
|
||||
@Component
|
||||
public class ShenwangUpLvHandler extends BaseHandler<HeroInfoProto.shenwangUpLvRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.ShenwangUpLvRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession session, HeroInfoProto.shenwangUpLvRequest proto) throws Exception {
|
||||
HeroLogic.getInstance().shenwangUpLevel(session, proto);
|
||||
}
|
||||
}
|
||||
|
|
@ -20,6 +20,6 @@ public class WanderDispatchHandler extends BaseHandler<PlayerInfoProto.WanderDis
|
|||
|
||||
@Override
|
||||
public void processWithProto(ISession session, PlayerInfoProto.WanderDispatchRequest proto) throws Exception {
|
||||
HomeLogic.getInstance().wanderDispatch(session,proto);
|
||||
// HomeLogic.getInstance().wanderDispatch(session,proto);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,15 +48,15 @@ public class Hero extends MongoBase implements Comparable<Hero>,Cloneable {
|
|||
private Map<String,Integer> godSoulBeBindMap = new HashMap<>();//被神魂绑定英雄 英雄动态id:英雄神魂等级(反绑)
|
||||
private Set<Integer> heroGiftEquipList = new HashSet<>();//礼物装备列表
|
||||
private Map<Integer, Integer> potentialUpLvMap = new HashMap<>();//潜能升级
|
||||
|
||||
private Training training = new Training(); // 特训信息
|
||||
private int shenwangLv;//神王等级
|
||||
|
||||
public Hero() {
|
||||
//绑定关系
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
}
|
||||
|
||||
// 置换
|
||||
// 置换 已废弃
|
||||
public Hero(int uid, int heroTid, int initStar, Hero hero) {
|
||||
this.setRootCollection(User._COLLECTION_NAME);
|
||||
this.id = KeyGenUtils.produceIdByModule(UUIDEnum.HERO, uid);
|
||||
|
|
@ -155,7 +155,7 @@ public class Hero extends MongoBase implements Comparable<Hero>,Cloneable {
|
|||
equipByPositionMap = new HashMap<>();
|
||||
}
|
||||
|
||||
// 克隆
|
||||
// 克隆 已废弃
|
||||
public Hero(User user, Hero hero) {
|
||||
this.id = hero.getId();
|
||||
this.templateId = hero.getTemplateId();
|
||||
|
|
@ -619,6 +619,15 @@ public class Hero extends MongoBase implements Comparable<Hero>,Cloneable {
|
|||
updateString("training", training);
|
||||
}
|
||||
|
||||
public int getShenwangLv() {
|
||||
return shenwangLv;
|
||||
}
|
||||
|
||||
public void setShenwangLv(int shenwangLv) {
|
||||
this.shenwangLv = shenwangLv;
|
||||
updateString("shenwangLv", shenwangLv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Hero clone(){
|
||||
Hero clone = null;
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ public class HeroVo {
|
|||
private Map<String, PropertyItem> faxiangMap = new HashMap<>();
|
||||
private Baubles baubles;
|
||||
private Training training;
|
||||
private int shenwangLv;
|
||||
|
||||
public HeroVo() {
|
||||
}
|
||||
|
|
@ -58,6 +59,7 @@ public class HeroVo {
|
|||
heroVo.jewelMap = CBean2Proto.propertyItemOfLocal(user,hero.getJewelInfo());
|
||||
heroVo.faxiangMap = CBean2Proto.propertyItemOfLocal(user,hero.getFaxiangList());
|
||||
heroVo.training = hero.getTraining();
|
||||
heroVo.shenwangLv = hero.getShenwangLv();
|
||||
return heroVo;
|
||||
}
|
||||
|
||||
|
|
@ -136,4 +138,8 @@ public class HeroVo {
|
|||
public Map<Integer, Integer> getTrumpBookStarMap() {
|
||||
return trumpBookStarMap;
|
||||
}
|
||||
|
||||
public int getShenwangLv() {
|
||||
return shenwangLv;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -146,6 +146,10 @@ public class HeroLogic {
|
|||
return HeroLogic.Instance.instance;
|
||||
}
|
||||
|
||||
public static class Instance {
|
||||
public final static HeroLogic instance = new HeroLogic();
|
||||
}
|
||||
|
||||
/**
|
||||
* 每次抽取
|
||||
*/
|
||||
|
|
@ -852,7 +856,7 @@ public class HeroLogic {
|
|||
int[] result = new int[2];
|
||||
result[0] = user.getHeroManager().getBeautyBagCardInfoMap().get(index + 1);
|
||||
result[1] = sLotteryRewardConfig.getReward()[1];
|
||||
LOGGER.info("抽到了UP---->" + sLotteryRewardConfig.getReward()[0] + "替换为---->" + result[0]);
|
||||
LOGGER.info("抽到了UP---->{}替换为---->{}", sLotteryRewardConfig.getReward()[0], result[0]);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -888,7 +892,7 @@ public class HeroLogic {
|
|||
int[] result = new int[2];
|
||||
result[0] = user.getHeroManager().getTrumpSelectItemMap().get(index + 1);
|
||||
result[1] = sLotteryRewardConfig.getReward()[1];
|
||||
LOGGER.info("天地洪炉抽到了UP---->" + sLotteryRewardConfig.getReward()[0] + "替换为---->" + result[0]);
|
||||
LOGGER.info("天地洪炉抽到了UP---->{}替换为---->{}", sLotteryRewardConfig.getReward()[0], result[0]);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -1526,128 +1530,23 @@ public class HeroLogic {
|
|||
if (targetHero.getOriginalLevel() < scHeroRankUpConfig.getLimitLevel()) {
|
||||
throw new ErrorCodeException(ErrorCode.HERO_LEVE_DOWN);
|
||||
}
|
||||
|
||||
// 验证鸿蒙阵等级
|
||||
// boolean verifyHomgmeng = upStarVerifyHomgmeng(user, targetHero);
|
||||
// if (!verifyHomgmeng) {
|
||||
// throw new ErrorCodeException(ErrorCode.HONGMENG_LEVEL_NOT);
|
||||
// }
|
||||
|
||||
int[][] consumeMaterial = scHeroRankUpConfig.getConsumeMaterial();
|
||||
boolean enoughCost = ItemUtil.checkCost(user, consumeMaterial);
|
||||
if (!enoughCost) {
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
Map<Integer, SCHero.ConsumeMaterialInfo> consumeMaterialInfoByPosition = scHero.getConsumeMaterialInfoOfPositionByStar(oldStar + 1);
|
||||
if (consumeMaterialInfoByPosition == null) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
|
||||
int needTotalHeroNums = 0;
|
||||
if (consumeMaterialInfoByPosition.size() != consumeMaterialsList.size()) {
|
||||
throw new ErrorCodeException(ErrorCode.HERO_UN_MATCH);
|
||||
}
|
||||
//判断编队
|
||||
for (HeroInfoProto.ConsumeMaterial consumeMaterial1 : consumeMaterialsList) {
|
||||
List<String> heroIdsList = new ArrayList<>();
|
||||
consumeMaterial1.getHeroIdsList().stream().filter(v -> v.getType() == 1).forEach(v -> heroIdsList.add(v.getItemId()));
|
||||
ErrorCode err = null;
|
||||
if (!heroIdsList.isEmpty()) {
|
||||
err = ItemLogic.getInstance().checkHeroResolve(heroIdsList, user);
|
||||
}
|
||||
if (null != err) {
|
||||
throw new ErrorCodeException(err);
|
||||
}
|
||||
}
|
||||
|
||||
List<String> removeHeroIds = new ArrayList<>();
|
||||
HashMap<Integer, Integer> removeItemMap = new HashMap<>();
|
||||
StringBuilder reportConsumeHero = new StringBuilder();
|
||||
|
||||
for (HeroInfoProto.ConsumeMaterial consumeMaterial1 : consumeMaterialsList) {
|
||||
int position = consumeMaterial1.getPosition();
|
||||
SCHero.ConsumeMaterialInfo consumeMaterialInfo = consumeMaterialInfoByPosition.get(position);
|
||||
int nums = consumeMaterialInfo.getNums();
|
||||
needTotalHeroNums += nums;
|
||||
List<HeroInfoProto.ConsumeItem> list = consumeMaterial1.getHeroIdsList();
|
||||
SHeroRankupGroup sHeroRankupGroup = STableManager.getConfig(SHeroRankupGroup.class).get(consumeMaterialInfo.getGroupID());
|
||||
int isSame = sHeroRankupGroup.getIssame();
|
||||
int starLimit = sHeroRankupGroup.getStarLimit();
|
||||
int isSameClan = sHeroRankupGroup.getIsSameClan();
|
||||
int isId = sHeroRankupGroup.getIsId();
|
||||
// 万能道具代替
|
||||
List<Integer> items = Arrays.stream(sHeroRankupGroup.getItems()).boxed().collect(Collectors.toList());
|
||||
// 专属道具代替
|
||||
int[][] itemCamp = sHeroRankupGroup.getItemCamp();
|
||||
for (HeroInfoProto.ConsumeItem consume : list) {
|
||||
// 英雄
|
||||
if (consume.getType() == 1) {
|
||||
Hero hero = heroManager.getHero(consume.getItemId());
|
||||
if (null == hero) {
|
||||
throw new ErrorCodeException(ErrorCode.HERO_UN_MATCH);
|
||||
}
|
||||
//上报消耗的英雄数据
|
||||
if (reportConsumeHero.length() > 0) {
|
||||
reportConsumeHero.append("|");
|
||||
}
|
||||
reportConsumeHero.append(hero.getTemplateId()).append("-").append(hero.getStar()).append("-").append(hero.getOriginalLevel());
|
||||
|
||||
if (1 == isSame && hero.getTemplateId() != targetHero.getTemplateId()) {
|
||||
throw new ErrorCodeException(ErrorCode.HERO_UN_MATCH);
|
||||
}
|
||||
if (starLimit != 0 && hero.getStar() != starLimit) {
|
||||
throw new ErrorCodeException(ErrorCode.HERO_UN_MATCH);
|
||||
}
|
||||
if (1 == isSameClan && hero.getPropertyId() != targetHero.getPropertyId()) {
|
||||
throw new ErrorCodeException(ErrorCode.HERO_UN_MATCH);
|
||||
}
|
||||
|
||||
if (isId != 0 && hero.getTemplateId() != isId) {
|
||||
throw new ErrorCodeException(ErrorCode.HERO_UN_MATCH);
|
||||
}
|
||||
removeHeroIds.add(consume.getItemId());
|
||||
}
|
||||
// 万能和专属道具检测
|
||||
else if (consume.getType() == 2) {
|
||||
int itemId = Integer.parseInt(consume.getItemId());
|
||||
if (!items.contains(itemId)) {
|
||||
boolean camp = upStartItemCamp(targetHero.getPropertyId(), itemCamp, itemId);
|
||||
if (!camp) {
|
||||
throw new ErrorCodeException(ErrorCode.HERO_ITEM_NOT);
|
||||
}
|
||||
}
|
||||
Integer num = removeItemMap.getOrDefault(itemId, 0);
|
||||
removeItemMap.put(itemId, num + 1);
|
||||
}
|
||||
//配置在格子里特殊显示道具消耗
|
||||
else {
|
||||
int itemId = Integer.parseInt(consume.getItemId());
|
||||
Integer num = removeItemMap.getOrDefault(itemId, 0);
|
||||
removeItemMap.put(itemId, num + 1);
|
||||
}
|
||||
}
|
||||
// 校验道具数量
|
||||
boolean cost = ItemUtil.checkCost(user, removeItemMap);
|
||||
if (!cost) {
|
||||
throw new ErrorCodeException(ErrorCode.HERO_ITEM_NOT);
|
||||
}
|
||||
}
|
||||
int itemNum = 0;
|
||||
for (Integer value : removeItemMap.values()) {
|
||||
itemNum += value;
|
||||
}
|
||||
if (needTotalHeroNums != (removeHeroIds.size() + itemNum)) {
|
||||
LOGGER.error("hero num not enough");
|
||||
throw new ErrorCodeException(ErrorCode.HERO_UN_MATCH);
|
||||
}
|
||||
|
||||
int[][] consumeMaterial = scHeroRankUpConfig.getConsumeMaterial();
|
||||
boolean enoughCost = ItemUtil.itemCost(user, consumeMaterial, BIReason.UP_HEROSTAR_CONSUME, targetHero.getTemplateId());
|
||||
if (!enoughCost) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
}
|
||||
|
||||
//改成归元获得,同时返还法宝获得
|
||||
CommonProto.Drop.Builder baseBuilder = consumeBackDrop(user, removeHeroIds);
|
||||
|
||||
// 消耗道具
|
||||
ItemUtil.itemCost(user, removeItemMap, BIReason.COMPLEX_EQUIP_CONSUME, 0);
|
||||
|
||||
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder();
|
||||
checkAndUpdateConsumeHero(user, heroId, consumeMaterialInfoByPosition, consumeMaterialsList, drop);
|
||||
ItemUtil.itemCost(user, consumeMaterial, BIReason.UP_HEROSTAR_CONSUME, targetHero.getTemplateId());
|
||||
rankUpHeroExecute(user, targetHero);
|
||||
user.getHeroManager().addHeroStar(targetHero.getTemplateId(), targetHero.getStar());
|
||||
Poster.getPoster().dispatchEvent(new HeroUpStarEvent(user.getId(), targetHero.getTemplateId(), targetHero.getStar()));
|
||||
|
|
@ -1666,11 +1565,9 @@ public class HeroLogic {
|
|||
heroManager.setHongmengMaxLevel(hongmengMaxLevel);
|
||||
}
|
||||
}
|
||||
|
||||
//鸿蒙阵
|
||||
// addOrUpdateHongmeng(session);
|
||||
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.UP_HERO_STAR_RESPONSE_VALUE, baseBuilder.build(), true);
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.UP_HERO_STAR_RESPONSE_VALUE, drop.build(), true);
|
||||
if (targetHero.getStar() >= SSpecialConfig.getIntegerValue(SSpecialConfig.ChangeGodHeroContentParm)) {
|
||||
int feishengNum = targetHero.getStar() - 11;//计算飞升阶数
|
||||
String codeKey = "hero_feisheng_broadcast_content" + feishengNum;
|
||||
|
|
@ -1692,11 +1589,209 @@ public class HeroLogic {
|
|||
ChatLogic.getInstance().sendSysChatMessage(message, Global.DILIGENT, String.valueOf(targetHero.getTemplateId()), 0, 0, 0, 0, 0);
|
||||
|
||||
}
|
||||
String consume = StringUtil.parseArrayToString(consumeMaterial);
|
||||
Poster.getPoster().dispatchEvent(new WelfareRedPackEvent(user.getId(), WelfareRedPacketType.hero_star.getType(), targetHero.getStar()));
|
||||
ReportUtil.onReportEvent(user, ReportEventEnum.HERO_STRENGTHEN.getType(), String.valueOf(targetHero.getTemplateId()), String.valueOf(oldStar), String.valueOf(targetHero.getStar()), consume, reportConsumeHero.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 妖灵师进阶 升星==进阶==觉醒==化神
|
||||
*/
|
||||
// public void upHeroStar(ISession session, String heroId, List<HeroInfoProto.ConsumeMaterial> consumeMaterialsList) throws Exception {
|
||||
// int uid = session.getUid();
|
||||
// User user = UserManager.getUser(uid);
|
||||
// HeroManager heroManager = user.getHeroManager();
|
||||
// Hero targetHero = heroManager.getHero(heroId);
|
||||
// if (null == targetHero) {
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
// }
|
||||
//
|
||||
// int oldStar = targetHero.getStar();
|
||||
// SCHero scHero = SCHero.getsCHero().get(targetHero.getTemplateId());
|
||||
// if (targetHero.getStar() >= scHero.getMaxRank()) {
|
||||
// throw new ErrorCodeException(ErrorCode.HAS_AWAKE);
|
||||
// }
|
||||
// int[] growthSwitch = scHero.getGrowthSwitch();
|
||||
// if (growthSwitch != null && growthSwitch.length > 0) {
|
||||
// Set<Integer> operateSet = Arrays.stream(growthSwitch).boxed().collect(Collectors.toSet());
|
||||
// if (operateSet.contains(2)) {
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
// }
|
||||
// }
|
||||
// Map<Integer, SCHeroRankUpConfig> scHeroRankUpConfigByType = STableManager.getFigureConfig(HeroStaticConfig.class).getScHeroRankUpConfigByShow(GlobalsDef.UP_STAR_TYPE, scHero.getStar());
|
||||
// SCHeroRankUpConfig scHeroRankUpConfig = scHeroRankUpConfigByType.get(oldStar);
|
||||
// if (targetHero.getOriginalLevel() < scHeroRankUpConfig.getLimitLevel()) {
|
||||
// throw new ErrorCodeException(ErrorCode.HERO_LEVE_DOWN);
|
||||
// }
|
||||
//
|
||||
// // 验证鸿蒙阵等级
|
||||
//// boolean verifyHomgmeng = upStarVerifyHomgmeng(user, targetHero);
|
||||
//// if (!verifyHomgmeng) {
|
||||
//// throw new ErrorCodeException(ErrorCode.HONGMENG_LEVEL_NOT);
|
||||
//// }
|
||||
//
|
||||
// Map<Integer, SCHero.ConsumeMaterialInfo> consumeMaterialInfoByPosition = scHero.getConsumeMaterialInfoOfPositionByStar(oldStar + 1);
|
||||
// if (consumeMaterialInfoByPosition == null) {
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
// }
|
||||
//
|
||||
// int needTotalHeroNums = 0;
|
||||
// if (consumeMaterialInfoByPosition.size() != consumeMaterialsList.size()) {
|
||||
// throw new ErrorCodeException(ErrorCode.HERO_UN_MATCH);
|
||||
// }
|
||||
// //判断编队
|
||||
// for (HeroInfoProto.ConsumeMaterial consumeMaterial1 : consumeMaterialsList) {
|
||||
// List<String> heroIdsList = new ArrayList<>();
|
||||
// consumeMaterial1.getHeroIdsList().stream().filter(v -> v.getType() == 1).forEach(v -> heroIdsList.add(v.getItemId()));
|
||||
// ErrorCode err = null;
|
||||
// if (!heroIdsList.isEmpty()) {
|
||||
// err = ItemLogic.getInstance().checkHeroResolve(heroIdsList, user);
|
||||
// }
|
||||
// if (null != err) {
|
||||
// throw new ErrorCodeException(err);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// List<String> removeHeroIds = new ArrayList<>();
|
||||
// HashMap<Integer, Integer> removeItemMap = new HashMap<>();
|
||||
// StringBuilder reportConsumeHero = new StringBuilder();
|
||||
//
|
||||
// for (HeroInfoProto.ConsumeMaterial consumeMaterial1 : consumeMaterialsList) {
|
||||
// int position = consumeMaterial1.getPosition();
|
||||
// SCHero.ConsumeMaterialInfo consumeMaterialInfo = consumeMaterialInfoByPosition.get(position);
|
||||
// int nums = consumeMaterialInfo.getNums();
|
||||
// needTotalHeroNums += nums;
|
||||
// List<HeroInfoProto.ConsumeItem> list = consumeMaterial1.getHeroIdsList();
|
||||
// SHeroRankupGroup sHeroRankupGroup = STableManager.getConfig(SHeroRankupGroup.class).get(consumeMaterialInfo.getGroupID());
|
||||
// int isSame = sHeroRankupGroup.getIssame();
|
||||
// int starLimit = sHeroRankupGroup.getStarLimit();
|
||||
// int isSameClan = sHeroRankupGroup.getIsSameClan();
|
||||
// int isId = sHeroRankupGroup.getIsId();
|
||||
// // 万能道具代替
|
||||
// List<Integer> items = Arrays.stream(sHeroRankupGroup.getItems()).boxed().collect(Collectors.toList());
|
||||
// // 专属道具代替
|
||||
// int[][] itemCamp = sHeroRankupGroup.getItemCamp();
|
||||
// for (HeroInfoProto.ConsumeItem consume : list) {
|
||||
// // 英雄
|
||||
// if (consume.getType() == 1) {
|
||||
// Hero hero = heroManager.getHero(consume.getItemId());
|
||||
// if (null == hero) {
|
||||
// throw new ErrorCodeException(ErrorCode.HERO_UN_MATCH);
|
||||
// }
|
||||
// //上报消耗的英雄数据
|
||||
// if (reportConsumeHero.length() > 0) {
|
||||
// reportConsumeHero.append("|");
|
||||
// }
|
||||
// reportConsumeHero.append(hero.getTemplateId()).append("-").append(hero.getStar()).append("-").append(hero.getOriginalLevel());
|
||||
//
|
||||
// if (1 == isSame && hero.getTemplateId() != targetHero.getTemplateId()) {
|
||||
// throw new ErrorCodeException(ErrorCode.HERO_UN_MATCH);
|
||||
// }
|
||||
// if (starLimit != 0 && hero.getStar() != starLimit) {
|
||||
// throw new ErrorCodeException(ErrorCode.HERO_UN_MATCH);
|
||||
// }
|
||||
// if (1 == isSameClan && hero.getPropertyId() != targetHero.getPropertyId()) {
|
||||
// throw new ErrorCodeException(ErrorCode.HERO_UN_MATCH);
|
||||
// }
|
||||
//
|
||||
// if (isId != 0 && hero.getTemplateId() != isId) {
|
||||
// throw new ErrorCodeException(ErrorCode.HERO_UN_MATCH);
|
||||
// }
|
||||
// removeHeroIds.add(consume.getItemId());
|
||||
// }
|
||||
// // 万能和专属道具检测
|
||||
// else if (consume.getType() == 2) {
|
||||
// int itemId = Integer.parseInt(consume.getItemId());
|
||||
// if (!items.contains(itemId)) {
|
||||
// boolean camp = upStartItemCamp(targetHero.getPropertyId(), itemCamp, itemId);
|
||||
// if (!camp) {
|
||||
// throw new ErrorCodeException(ErrorCode.HERO_ITEM_NOT);
|
||||
// }
|
||||
// }
|
||||
// Integer num = removeItemMap.getOrDefault(itemId, 0);
|
||||
// removeItemMap.put(itemId, num + 1);
|
||||
// }
|
||||
// //配置在格子里特殊显示道具消耗
|
||||
// else {
|
||||
// int itemId = Integer.parseInt(consume.getItemId());
|
||||
// Integer num = removeItemMap.getOrDefault(itemId, 0);
|
||||
// removeItemMap.put(itemId, num + 1);
|
||||
// }
|
||||
// }
|
||||
// // 校验道具数量
|
||||
// boolean cost = ItemUtil.checkCost(user, removeItemMap);
|
||||
// if (!cost) {
|
||||
// throw new ErrorCodeException(ErrorCode.HERO_ITEM_NOT);
|
||||
// }
|
||||
// }
|
||||
// int itemNum = 0;
|
||||
// for (Integer value : removeItemMap.values()) {
|
||||
// itemNum += value;
|
||||
// }
|
||||
// if (needTotalHeroNums != (removeHeroIds.size() + itemNum)) {
|
||||
// LOGGER.error("hero num not enough");
|
||||
// throw new ErrorCodeException(ErrorCode.HERO_UN_MATCH);
|
||||
// }
|
||||
//
|
||||
// int[][] consumeMaterial = scHeroRankUpConfig.getConsumeMaterial();
|
||||
// boolean enoughCost = ItemUtil.itemCost(user, consumeMaterial, BIReason.UP_HEROSTAR_CONSUME, targetHero.getTemplateId());
|
||||
// if (!enoughCost) {
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
|
||||
// }
|
||||
//
|
||||
// //改成归元获得,同时返还法宝获得
|
||||
// CommonProto.Drop.Builder baseBuilder = consumeBackDrop(user, removeHeroIds);
|
||||
//
|
||||
// // 消耗道具
|
||||
// ItemUtil.itemCost(user, removeItemMap, BIReason.COMPLEX_EQUIP_CONSUME, 0);
|
||||
//
|
||||
// rankUpHeroExecute(user, targetHero);
|
||||
// user.getHeroManager().addHeroStar(targetHero.getTemplateId(), targetHero.getStar());
|
||||
// Poster.getPoster().dispatchEvent(new HeroUpStarEvent(user.getId(), targetHero.getTemplateId(), targetHero.getStar()));
|
||||
// Poster.getPoster().dispatchEvent(new NewWelfareEvent(user, NewWelfareTypeEnum.UPSTAR.getType(), targetHero.getTemplateId()));
|
||||
// targetHero.setStarBreakId(scHeroRankUpConfig.getId());
|
||||
// user.getUserMissionManager().onGameEvent(user, GameEvent.HERO_UP, 2, targetHero.getTemplateId(), targetHero.getStar());
|
||||
// user.getUserMissionManager().onGameEvent(user, GameEvent.GET_HERO, targetHero.getTemplateId(), targetHero.getStar());
|
||||
// // 更新战力
|
||||
// Poster.getPoster().dispatchEvent(new SaveHeroForceEvent(user.getId(), heroId));
|
||||
//
|
||||
// if (targetHero.getStar() >= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_awaken_hero_content_parm)) {
|
||||
// Set<Integer> hongmengMaxLevel = heroManager.getHongmengMaxLevel();
|
||||
// boolean add = hongmengMaxLevel.add(targetHero.getTemplateId());
|
||||
// if (add) {
|
||||
// // 增加鸿蒙碑神将等级
|
||||
// heroManager.setHongmengMaxLevel(hongmengMaxLevel);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //鸿蒙阵
|
||||
//// addOrUpdateHongmeng(session);
|
||||
//
|
||||
// MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.UP_HERO_STAR_RESPONSE_VALUE, baseBuilder.build(), true);
|
||||
// if (targetHero.getStar() >= SSpecialConfig.getIntegerValue(SSpecialConfig.ChangeGodHeroContentParm)) {
|
||||
// int feishengNum = targetHero.getStar() - 11;//计算飞升阶数
|
||||
// String codeKey = "hero_feisheng_broadcast_content" + feishengNum;
|
||||
// //飞升飘字
|
||||
// String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert(codeKey,
|
||||
// new Object[]{user.getPlayerInfoManager().getNameColor(), user.getPlayerInfoManager().getNickName(), scHero.getReadingName()},
|
||||
// new int[]{0, 0, 1});
|
||||
// ChatLogic.getInstance().sendSysChatMessage(message, Global.DILIGENT, String.valueOf(targetHero.getTemplateId()), 0, 0, 0, 0, 0);
|
||||
// } else if (targetHero.getStar() >= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_awaken_hero_content_parm)) {
|
||||
// // 觉醒飘字
|
||||
// String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert("animal_awaken_broadcast_content",
|
||||
// new Object[]{user.getPlayerInfoManager().getNameColor(), user.getPlayerInfoManager().getNickName(), scHero.getReadingName()},
|
||||
// new int[]{0, 0, 1});
|
||||
// ChatLogic.getInstance().sendSysChatMessage(message, Global.DILIGENT, String.valueOf(targetHero.getTemplateId()), 0, 0, 0, 0, 0);
|
||||
// } else if (targetHero.getStar() >= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_rankup_hero_content_parm)) {
|
||||
// String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert("lamp_rankup_hero_content",
|
||||
// new Object[]{user.getPlayerInfoManager().getNameColor(), user.getPlayerInfoManager().getNickName(), scHero.getReadingName(), targetHero.getStar()},
|
||||
// new int[]{0, 0, 1, 0});
|
||||
// ChatLogic.getInstance().sendSysChatMessage(message, Global.DILIGENT, String.valueOf(targetHero.getTemplateId()), 0, 0, 0, 0, 0);
|
||||
//
|
||||
// }
|
||||
// String consume = StringUtil.parseArrayToString(consumeMaterial);
|
||||
// Poster.getPoster().dispatchEvent(new WelfareRedPackEvent(user.getId(), WelfareRedPacketType.hero_star.getType(), targetHero.getStar()));
|
||||
// ReportUtil.onReportEvent(user, ReportEventEnum.HERO_STRENGTHEN.getType(), String.valueOf(targetHero.getTemplateId()), String.valueOf(oldStar), String.valueOf(targetHero.getStar()), consume, reportConsumeHero.toString());
|
||||
// }
|
||||
|
||||
/**
|
||||
* 升星验证鸿蒙阵等级
|
||||
*/
|
||||
|
|
@ -2194,6 +2289,23 @@ public class HeroLogic {
|
|||
}
|
||||
}
|
||||
|
||||
// 神王技能
|
||||
Map<Integer, SShenWang> shenWangMap = SShenWang.heroMap.get(heroVo.getTemplateId());
|
||||
for (Map.Entry<Integer, SShenWang> entry : shenWangMap.entrySet()) {
|
||||
Integer lv = entry.getKey();
|
||||
if (heroVo.getShenwangLv() < lv) {
|
||||
continue;
|
||||
}
|
||||
SShenWang shenWang = entry.getValue();
|
||||
int[] passiveSkill = shenWang.getPassiveSkill();
|
||||
if (passiveSkill == null) {
|
||||
continue;
|
||||
}
|
||||
for (int skill : passiveSkill) {
|
||||
skillList.add(skill);
|
||||
}
|
||||
}
|
||||
|
||||
return skillList;
|
||||
}
|
||||
|
||||
|
|
@ -2790,6 +2902,8 @@ public class HeroLogic {
|
|||
applyBaublesAndFaxiangAttribute(heroAllAttribute, hero, user);
|
||||
// 小兵加成
|
||||
applySoldierAttribute(heroAllAttribute, hero, user);
|
||||
// 神王加成
|
||||
applyShenwangAttribute(heroAllAttribute, hero);
|
||||
// 魂印和神印属性加成
|
||||
applySoulEquipAndGodSealAttribute(heroAllAttribute, hero, user);
|
||||
// 助阵
|
||||
|
|
@ -3187,6 +3301,31 @@ public class HeroLogic {
|
|||
combinedAttribute(map, heroAllAttribute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 神王加成
|
||||
*/
|
||||
private void applyShenwangAttribute(Map<Integer, Long> heroAllAttribute, Hero hero) {
|
||||
HashMap<Integer, Long> map = new HashMap<>();
|
||||
Map<Integer, SShenWang> shenWangMap = SShenWang.heroMap.get(hero.getTemplateId());
|
||||
for (Map.Entry<Integer, SShenWang> entry : shenWangMap.entrySet()) {
|
||||
Integer lv = entry.getKey();
|
||||
if (hero.getShenwangLv() < lv) {
|
||||
continue;
|
||||
}
|
||||
SShenWang shenWang = entry.getValue();
|
||||
int[][] settingID = shenWang.getTrainSettingID();
|
||||
if (settingID == null) {
|
||||
continue;
|
||||
}
|
||||
for (int[] ints : settingID) {
|
||||
int id = ints[0];
|
||||
int value = ints[1];
|
||||
map.put(id, map.getOrDefault(id, 0L) + value);
|
||||
}
|
||||
}
|
||||
combinedAttribute(map, heroAllAttribute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 礼物装备属性加成
|
||||
*
|
||||
|
|
@ -7384,8 +7523,158 @@ public class HeroLogic {
|
|||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.QueryBookImageResponse_VALUE, builder.build(), true);
|
||||
}
|
||||
|
||||
public static class Instance {
|
||||
public final static HeroLogic instance = new HeroLogic();
|
||||
/**
|
||||
* 神王升级解锁技能
|
||||
* @param iSession
|
||||
* @param request
|
||||
* @throws Exception
|
||||
*/
|
||||
public void shenwangUpLevel(ISession iSession, HeroInfoProto.shenwangUpLvRequest request) throws Exception {
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
String heroId = request.getHeroId();
|
||||
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
Hero hero = heroManager.getHero(heroId);
|
||||
if (hero == null){
|
||||
throw new ErrorTableException(192);//英雄不存在
|
||||
}
|
||||
int openHeroStar = SSpecialConfig.getIntegerValue("ShenWang_OpenHeroStar");
|
||||
if (hero.getStar() < openHeroStar){
|
||||
throw new ErrorTableException(204);//英雄星级不够
|
||||
}
|
||||
Map<Integer, SShenWang> shenWangLvMap = SShenWang.heroMap.get(hero.getTemplateId());
|
||||
int maxKey = ToolsUtil.getMaxKey(shenWangLvMap.keySet());
|
||||
int shenwangLv = hero.getShenwangLv();
|
||||
if (shenwangLv >= maxKey){
|
||||
throw new ErrorTableException(205);//神王等级已满
|
||||
}
|
||||
int targetLv = shenwangLv + 1;
|
||||
SShenWang shenWang = shenWangLvMap.get(targetLv);
|
||||
if (shenWang == null){
|
||||
throw new ErrorTableException(206);//神王等级已满
|
||||
}
|
||||
if (hero.getStar() < shenWang.getNeedStar()){
|
||||
throw new ErrorTableException(207);//英雄星级不够,无法升级神王等级
|
||||
}
|
||||
boolean checked = ItemUtil.checkCost(user, shenWang.getNeedItem());
|
||||
if (!checked){
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);//道具不足
|
||||
}
|
||||
Map<Integer, SCHero.ConsumeMaterialInfo> map = shenWang.getConsumeMaterialInfoOfPositionByLv().get(targetLv);
|
||||
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder();
|
||||
if (map != null){
|
||||
checkAndUpdateConsumeHero(user, heroId, map, request.getConsumeMaterialsList(), drop);
|
||||
}
|
||||
ItemUtil.itemCost(user, shenWang.getNeedItem(), BIReason.SHENWANG_UP_LV, 0);
|
||||
Poster.getPoster().dispatchEvent(new SaveHeroForceEvent(user.getId(), heroId));
|
||||
HeroInfoProto.shenwangUpLvResponse.Builder builder = HeroInfoProto.shenwangUpLvResponse.newBuilder().setDrop(drop);
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.QueryBookImageResponse_VALUE, builder.build(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查并处理消耗英雄
|
||||
* @param user
|
||||
* @param heroId
|
||||
* @param consumeMaterialInfoByPosition
|
||||
* @param consumeMaterialsList
|
||||
* @throws Exception
|
||||
*/
|
||||
public void checkAndUpdateConsumeHero(User user, String heroId, Map<Integer, SCHero.ConsumeMaterialInfo> consumeMaterialInfoByPosition, List<HeroInfoProto.ConsumeMaterial> consumeMaterialsList, CommonProto.Drop.Builder drop) throws Exception {
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
Hero targetHero = heroManager.getHero(heroId);
|
||||
SCHero scHero = SCHero.getSCHero(targetHero.getTemplateId());
|
||||
if (consumeMaterialInfoByPosition.size() != consumeMaterialsList.size()) {
|
||||
throw new ErrorCodeException(ErrorCode.HERO_UN_MATCH);
|
||||
}
|
||||
//判断编队
|
||||
for (HeroInfoProto.ConsumeMaterial consumeMaterial1 : consumeMaterialsList) {
|
||||
List<String> heroIdsList = new ArrayList<>();
|
||||
consumeMaterial1.getHeroIdsList().stream().filter(v -> v.getType() == 1).forEach(v -> heroIdsList.add(v.getItemId()));
|
||||
ErrorCode err = null;
|
||||
if (!heroIdsList.isEmpty()) {
|
||||
err = ItemLogic.getInstance().checkHeroResolve(heroIdsList, user);
|
||||
}
|
||||
if (null != err) {
|
||||
throw new ErrorCodeException(err);
|
||||
}
|
||||
}
|
||||
List<String> removeHeroIds = new ArrayList<>();
|
||||
HashMap<Integer, Integer> removeItemMap = new HashMap<>();
|
||||
int needTotalHeroNums = 0;
|
||||
for (HeroInfoProto.ConsumeMaterial consumeMaterial1 : consumeMaterialsList) {
|
||||
int position = consumeMaterial1.getPosition();
|
||||
SCHero.ConsumeMaterialInfo consumeMaterialInfo = consumeMaterialInfoByPosition.get(position);
|
||||
int nums = consumeMaterialInfo.getNums();
|
||||
needTotalHeroNums += nums;
|
||||
List<HeroInfoProto.ConsumeItem> list = consumeMaterial1.getHeroIdsList();
|
||||
SHeroRankupGroup sHeroRankupGroup = STableManager.getConfig(SHeroRankupGroup.class).get(consumeMaterialInfo.getGroupID());
|
||||
int isSame = sHeroRankupGroup.getIssame();
|
||||
int starLimit = sHeroRankupGroup.getStarLimit();
|
||||
int isSameClan = sHeroRankupGroup.getIsSameClan();
|
||||
int isId = sHeroRankupGroup.getIsId();
|
||||
// 万能道具代替
|
||||
List<Integer> items = Arrays.stream(sHeroRankupGroup.getItems()).boxed().collect(Collectors.toList());
|
||||
// 专属道具代替
|
||||
int[][] itemCamp = sHeroRankupGroup.getItemCamp();
|
||||
for (HeroInfoProto.ConsumeItem consume : list) {
|
||||
// 英雄
|
||||
if (consume.getType() == 1) {
|
||||
Hero hero = heroManager.getHero(consume.getItemId());
|
||||
if (null == hero) {
|
||||
throw new ErrorCodeException(ErrorCode.HERO_UN_MATCH);
|
||||
}
|
||||
if (1 == isSame && hero.getTemplateId() != targetHero.getTemplateId()) {
|
||||
throw new ErrorCodeException(ErrorCode.HERO_UN_MATCH);
|
||||
}
|
||||
if (starLimit != 0 && hero.getStar() != starLimit) {
|
||||
throw new ErrorCodeException(ErrorCode.HERO_UN_MATCH);
|
||||
}
|
||||
if (1 == isSameClan && hero.getPropertyId() != targetHero.getPropertyId()) {
|
||||
throw new ErrorCodeException(ErrorCode.HERO_UN_MATCH);
|
||||
}
|
||||
|
||||
if (isId != 0 && hero.getTemplateId() != isId) {
|
||||
throw new ErrorCodeException(ErrorCode.HERO_UN_MATCH);
|
||||
}
|
||||
removeHeroIds.add(consume.getItemId());
|
||||
}
|
||||
// 万能和专属道具检测
|
||||
else if (consume.getType() == 2) {
|
||||
int itemId = Integer.parseInt(consume.getItemId());
|
||||
if (!items.contains(itemId)) {
|
||||
boolean camp = upStartItemCamp(targetHero.getPropertyId(), itemCamp, itemId);
|
||||
if (!camp) {
|
||||
throw new ErrorCodeException(ErrorCode.HERO_ITEM_NOT);
|
||||
}
|
||||
}
|
||||
Integer num = removeItemMap.getOrDefault(itemId, 0);
|
||||
removeItemMap.put(itemId, num + 1);
|
||||
}
|
||||
//配置在格子里特殊显示道具消耗
|
||||
else {
|
||||
int itemId = Integer.parseInt(consume.getItemId());
|
||||
Integer num = removeItemMap.getOrDefault(itemId, 0);
|
||||
removeItemMap.put(itemId, num + 1);
|
||||
}
|
||||
}
|
||||
// 校验道具数量
|
||||
boolean cost = ItemUtil.checkCost(user, removeItemMap);
|
||||
if (!cost) {
|
||||
throw new ErrorCodeException(ErrorCode.HERO_ITEM_NOT);
|
||||
}
|
||||
}
|
||||
int itemNum = 0;
|
||||
for (Integer value : removeItemMap.values()) {
|
||||
itemNum += value;
|
||||
}
|
||||
if (needTotalHeroNums != (removeHeroIds.size() + itemNum)) {
|
||||
LOGGER.error("hero num not enough");
|
||||
throw new ErrorCodeException(ErrorCode.HERO_UN_MATCH);
|
||||
}
|
||||
//改成归元获得,同时返还法宝获得
|
||||
drop = consumeBackDrop(user, removeHeroIds);
|
||||
// 消耗道具
|
||||
ItemUtil.itemCost(user, removeItemMap, BIReason.COMPLEX_EQUIP_CONSUME, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -518,7 +518,6 @@ public class TrainingLogic {
|
|||
*/
|
||||
public CommonProto.Drop unlockSkillCost(User user, STrain sTrain, HeroInfoProto.TrainingUnlockSkillRequest proto) throws Exception {
|
||||
CommonProto.Drop.Builder builder = CommonProto.Drop.newBuilder();
|
||||
HeroManager heroManager = user.getHeroManager();
|
||||
PokemonManager pokemonManager = user.getPokemonManager();
|
||||
MagicSoldierManager soldierManager = user.getMagicSoldierManager();
|
||||
// 消耗英雄验证
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@ package com.ljsd.jieling.logic.home;
|
|||
import com.ljsd.jieling.core.VipPrivilegeType;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.exception.ErrorTableException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.logic.activity.event.Poster;
|
||||
import com.ljsd.jieling.logic.dao.ArchitectureInfo;
|
||||
import com.ljsd.jieling.logic.dao.Item;
|
||||
import com.ljsd.jieling.logic.dao.LandInfo;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
import com.ljsd.jieling.logic.home.event.HomeEvent;
|
||||
|
|
@ -28,7 +28,10 @@ import rpc.protocols.MessageTypeProto;
|
|||
import rpc.protocols.PlayerInfoProto;
|
||||
import util.TimeUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
public class HomeLogic {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(HomeLogic.class);
|
||||
|
|
@ -46,9 +49,6 @@ public class HomeLogic {
|
|||
|
||||
/**
|
||||
* 建筑升级
|
||||
* @param session
|
||||
* @param proto
|
||||
* @throws Exception
|
||||
*/
|
||||
public void architectureUpLv(ISession session, PlayerInfoProto.ArchitectureOperateRequest proto) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
|
|
@ -60,29 +60,40 @@ public class HomeLogic {
|
|||
// 建筑信息验证
|
||||
ArchitectureInfo info = user.getPlayerInfoManager().getArchitectureInfoMap().get(id);
|
||||
if (info == null) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"浮生门建筑升级,数据库内找不到建筑poolId:"+id);
|
||||
LOGGER.error("浮生门建筑升级,建筑未解锁,升级建筑levelId:"+id);
|
||||
throw new ErrorTableException(196);
|
||||
}
|
||||
SHomeLandLevel landLevel = config.get(info.getId());
|
||||
if (landLevel == null){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"浮生门建筑升级,策划表内找不到建筑levelId:"+info.getId());
|
||||
LOGGER.error("浮生门建筑升级,策划表内找不到建筑levelId:"+info.getId());
|
||||
throw new ErrorTableException(197);
|
||||
}
|
||||
// 最高等级验证
|
||||
int maxId = config.values().stream().filter(v->v.getPoolID()==landLevel.getPoolID()).mapToInt(SHomeLandLevel::getlevel).max().orElse(0);
|
||||
if (info.getId() == maxId) {
|
||||
throw new ErrorCodeException(ErrorCode.LEVE_MAX,"浮生门建筑升级,建筑等级最高,升级建筑levelId:"+info.getId());
|
||||
LOGGER.error("浮生门建筑升级,建筑等级最高,升级建筑levelId:"+info.getId());
|
||||
throw new ErrorTableException(198);
|
||||
}
|
||||
//升级前置条件
|
||||
int[] rule = landLevel.getRule();
|
||||
if (rule != null && rule.length > 1){
|
||||
ArchitectureInfo info1 = user.getPlayerInfoManager().getArchitectureInfoMap().get(rule[0]);
|
||||
if (info1 == null){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"浮生门建筑升级,前置建筑未解锁,升级建筑levelId:"+info.getId()+",前置建筑poolId:"+rule[0]);
|
||||
LOGGER.error("浮生门建筑升级,前置建筑未解锁,升级建筑levelId:"+info.getId()+",前置建筑poolId:"+rule[0]);
|
||||
throw new ErrorTableException(199);
|
||||
}
|
||||
int level = Optional.ofNullable(config.get(info1.getId())).map(SHomeLandLevel::getlevel).orElse(0);
|
||||
if (level < rule[1]){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"浮生门建筑升级,前置建筑等级不足,升级建筑levelId:"+info.getId()+",前置建筑levelId:"+info1.getId());
|
||||
LOGGER.error("浮生门建筑升级,前置建筑等级不足,升级建筑levelId:"+info.getId()+",前置建筑levelId:"+rule[0]);
|
||||
throw new ErrorTableException(200);
|
||||
}
|
||||
}
|
||||
|
||||
int playerLevel = landLevel.getPlayerLevel();
|
||||
if (user.getPlayerInfoManager().getLevel() < playerLevel){
|
||||
throw new ErrorCodeException(ErrorCode.PLAYER_LEVE_NOT);//玩家等级不足
|
||||
}
|
||||
|
||||
// 特殊情况
|
||||
if (info.getUpLvEndTime() != 0 && info.getUpLvEndTime() <= now){
|
||||
throw new ErrorCodeException(ErrorCode.SYS_ERROR_CODE);
|
||||
|
|
@ -92,7 +103,8 @@ public class HomeLogic {
|
|||
if (type == 1 && info.getUpLvEndTime() == 0){
|
||||
boolean cost = ItemUtil.itemCost(user, landLevel.getCost(), BIReason.ARCHITECTURE_UP_LEVEL, 0);
|
||||
if (!cost) {
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH, "浮生门建筑普通升级,建筑levelId:"+info.getId()+",道具:"+Arrays.toString(landLevel.getCost()));
|
||||
LOGGER.error("浮生门建筑普通升级,建筑levelId:"+info.getId()+",道具:"+Arrays.toString(landLevel.getCost()));
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
info.setUpLvEndTime(now + landLevel.getTime());
|
||||
}
|
||||
|
|
@ -120,7 +132,8 @@ public class HomeLogic {
|
|||
int[][] arrayObject = Utils.getTwoArrayInt(costList);
|
||||
boolean itemCost = ItemUtil.itemCost(user, arrayObject, BIReason.ARCHITECTURE_UP_LEVEL, 0);
|
||||
if (!itemCost){
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH, "浮生门建筑立即升级,建筑levelId:"+info.getId()+",道具:"+Arrays.toString(arrayObject));
|
||||
LOGGER.error("浮生门建筑立即升级,建筑levelId:"+info.getId()+",道具:"+Arrays.toString(arrayObject));
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
// 升级
|
||||
architectureUpLvEnd(user, landLevel.getPoolID(), info);
|
||||
|
|
@ -132,7 +145,8 @@ public class HomeLogic {
|
|||
// 验证特权次数
|
||||
boolean countBol = PlayerLogic.getInstance().checkAndUpdate(user, VipPrivilegeType.HOME_DAY_TIME_NUM, 1);
|
||||
if (!countBol) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"特权加速,特权次数不足");
|
||||
LOGGER.error("浮生门建筑加速升级,建筑levelId:"+info.getId()+",特权次数不足");
|
||||
throw new ErrorTableException(201);
|
||||
}
|
||||
int value = SSpecialConfig.getIntegerValue(SSpecialConfig.BUILDING_TIME_REDUCE);
|
||||
int time = now + value;
|
||||
|
|
@ -157,9 +171,6 @@ public class HomeLogic {
|
|||
|
||||
/**
|
||||
* 建筑升级结束,封装
|
||||
* @param user
|
||||
* @param key
|
||||
* @param info
|
||||
*/
|
||||
public void architectureUpLvEnd(User user, int key, ArchitectureInfo info) throws Exception {
|
||||
// 升级时间清零
|
||||
|
|
@ -175,9 +186,6 @@ public class HomeLogic {
|
|||
|
||||
/**
|
||||
* 家园,一键领取和单个建筑领取
|
||||
* @param session
|
||||
* @param proto
|
||||
* @throws Exception
|
||||
*/
|
||||
public void homeAllGain(ISession session, PlayerInfoProto.HomeAllGainRequset proto) throws Exception {
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
|
|
@ -196,7 +204,8 @@ public class HomeLogic {
|
|||
else {
|
||||
ArchitectureInfo info = infoMap.get(poolId);
|
||||
if (info == null){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"当前玩家未解锁改建筑,poolId:"+poolId);
|
||||
LOGGER.error("当前玩家未解锁该建筑,poolId:"+poolId);
|
||||
throw new ErrorTableException(202);
|
||||
}
|
||||
oneArchitectureEarnings(user,info,nowInt,drop);
|
||||
}
|
||||
|
|
@ -206,11 +215,6 @@ public class HomeLogic {
|
|||
|
||||
/**
|
||||
* 单个建筑收益获取
|
||||
* @param user
|
||||
* @param info
|
||||
* @param nowInt
|
||||
* @param drop
|
||||
* @throws Exception
|
||||
*/
|
||||
private void oneArchitectureEarnings(User user, ArchitectureInfo info, int nowInt, CommonProto.Drop.Builder drop) throws Exception {
|
||||
Map<Integer, SHomeLandLevel> config = STableManager.getConfig(SHomeLandLevel.class);
|
||||
|
|
@ -225,12 +229,14 @@ public class HomeLogic {
|
|||
LOGGER.error("建筑收获,功能类建筑不能收获,levelId:{}", info.getId());
|
||||
return;
|
||||
}
|
||||
// 分钟
|
||||
int minute = homeLandLevel.getGain()[0];
|
||||
// 收益时间/分
|
||||
int time = Math.max(0, nowInt - info.getProductionStartTime()) / 60;
|
||||
int time = Math.max(0, nowInt - info.getProductionStartTime()) / 60 / minute;
|
||||
// 配置表参数,生产道具id
|
||||
int itemId = homeLandLevel.getGain()[0];
|
||||
int itemId = homeLandLevel.getGain()[1];
|
||||
// 每分钟生产数量
|
||||
double minutesNum = homeLandLevel.getGain()[1];
|
||||
double minutesNum = homeLandLevel.getGain()[2];
|
||||
// 特权
|
||||
boolean allowed = user.getPlayerInfoManager().checkFunctionIsAllowed(VipPrivilegeType.HOME_ADD_EARNINGS);
|
||||
if (allowed){
|
||||
|
|
@ -268,88 +274,80 @@ public class HomeLogic {
|
|||
/**
|
||||
* 单个地块收益获取
|
||||
* TODO: 2021/12/22 未完成
|
||||
* @param user
|
||||
* @param info
|
||||
* @param nowInt
|
||||
* @param drop
|
||||
* @throws Exception
|
||||
*/
|
||||
private void oneLandEarnings(User user, LandInfo info, int nowInt, CommonProto.Drop.Builder drop) throws Exception {
|
||||
if (info.getEndTime() > nowInt || info.getEndTime() == 0){
|
||||
LOGGER.error("栖云阁,地块奖励不可领取,地块id:{}",info.getId());
|
||||
return;
|
||||
}
|
||||
info.setHeroTid(0);
|
||||
info.setEndTime(0);
|
||||
// TODO: 2021/12/20 奖励
|
||||
int[][] reward = {};
|
||||
ItemUtil.drop(user, reward, 1, BIReason.WENDER_EARNINGS, drop);
|
||||
}
|
||||
|
||||
/**
|
||||
* 栖云阁 派遣
|
||||
* @param session
|
||||
* @param proto
|
||||
* @throws Exception
|
||||
*/
|
||||
public void wanderDispatch(ISession session, PlayerInfoProto.WanderDispatchRequest proto) throws Exception{
|
||||
User user = UserManager.getUser(session.getUid());
|
||||
LandInfo landInfo = user.getPlayerInfoManager().getLandInfoMap().get(proto.getId());
|
||||
if (landInfo == null){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"地块未解锁,地块id:"+proto.getId());
|
||||
}
|
||||
HashSet<Integer> agos = user.getPlayerInfoManager().getHeroDispatchAgos();
|
||||
PlayerInfoProto.WanderDispatchResponse.Builder builder = PlayerInfoProto.WanderDispatchResponse.newBuilder();
|
||||
int type = proto.getType();
|
||||
int nowInt = TimeUtils.nowInt();
|
||||
// 普通派遣
|
||||
if (type == 1){
|
||||
if (landInfo.getEndTime() != 0){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"地块已存在派遣英雄,地块id:"+proto.getId());
|
||||
}
|
||||
if (agos.contains(proto.getHeroTid())){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"一个英雄一天只能派遣一次,heroTid:"+proto.getHeroTid());
|
||||
}
|
||||
// 验证特权次数
|
||||
boolean countBol = PlayerLogic.getInstance().checkAndUpdate(user, proto.getPrivilageTypeId(),1);
|
||||
if (!countBol){
|
||||
throw new ErrorCodeException(ErrorCode.REFRESH_WHEL_TIME_NOT,"次数不足,地块id:"+proto.getId());
|
||||
}
|
||||
user.getPlayerInfoManager().addHeroDispatchAgos(proto.getHeroTid());
|
||||
// TODO: 2021/12/20 派遣时间
|
||||
int time = 0;
|
||||
landInfo.setEndTime(nowInt+time);
|
||||
landInfo.setHeroTid(proto.getHeroTid());
|
||||
CommonProto.LandInfo.Builder info = CommonProto.LandInfo.newBuilder().setId(landInfo.getId()).setEndTime(landInfo.getEndTime()).setHeroTid(landInfo.getHeroTid());
|
||||
builder.setLand(info);
|
||||
}
|
||||
CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder();
|
||||
// 立即完成
|
||||
if (type == 2){
|
||||
if (landInfo.getEndTime() != 0){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"地块已存在派遣英雄,地块id:"+proto.getId());
|
||||
}
|
||||
if (agos.contains(proto.getHeroTid())){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"一个英雄一天只能派遣一次,heroTid:"+proto.getHeroTid());
|
||||
}
|
||||
// 验证特权次数
|
||||
boolean countBol = PlayerLogic.getInstance().checkAndUpdate(user, proto.getPrivilageTypeId(),1);
|
||||
if (!countBol){
|
||||
throw new ErrorCodeException(ErrorCode.REFRESH_WHEL_TIME_NOT,"次数不足,地块id:"+proto.getId());
|
||||
}
|
||||
user.getPlayerInfoManager().addHeroDispatchAgos(proto.getHeroTid());
|
||||
// TODO: 2021/12/20 奖励
|
||||
int[][] reward = {};
|
||||
ItemUtil.drop(user, reward, 1, BIReason.WENDER_EARNINGS, drop);
|
||||
builder.setDrop(drop);
|
||||
}
|
||||
// 领取
|
||||
if (type == 3){
|
||||
oneLandEarnings(user,landInfo,nowInt,drop);
|
||||
builder.setDrop(drop);
|
||||
}
|
||||
user.getPlayerInfoManager().putLandInfo(landInfo);
|
||||
builder.addAllHeroTids(user.getPlayerInfoManager().getHeroDispatchAgos());
|
||||
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.WanderDispatchResponse_VALUE, builder.build());
|
||||
}
|
||||
// private void oneLandEarnings(User user, LandInfo info, int nowInt, CommonProto.Drop.Builder drop) throws Exception {
|
||||
// if (info.getEndTime() > nowInt || info.getEndTime() == 0){
|
||||
// LOGGER.error("栖云阁,地块奖励不可领取,地块id:{}",info.getId());
|
||||
// return;
|
||||
// }
|
||||
// info.setHeroTid(0);
|
||||
// info.setEndTime(0);
|
||||
// // TODO: 2021/12/20 奖励
|
||||
// int[][] reward = {};
|
||||
// ItemUtil.drop(user, reward, 1, BIReason.WENDER_EARNINGS, drop);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 栖云阁 派遣
|
||||
// */
|
||||
// public void wanderDispatch(ISession session, PlayerInfoProto.WanderDispatchRequest proto) throws Exception{
|
||||
// User user = UserManager.getUser(session.getUid());
|
||||
// LandInfo landInfo = user.getPlayerInfoManager().getLandInfoMap().get(proto.getId());
|
||||
// if (landInfo == null){
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"地块未解锁,地块id:"+proto.getId());
|
||||
// }
|
||||
// HashSet<Integer> agos = user.getPlayerInfoManager().getHeroDispatchAgos();
|
||||
// PlayerInfoProto.WanderDispatchResponse.Builder builder = PlayerInfoProto.WanderDispatchResponse.newBuilder();
|
||||
// int type = proto.getType();
|
||||
// int nowInt = TimeUtils.nowInt();
|
||||
// // 普通派遣
|
||||
// if (type == 1){
|
||||
// if (landInfo.getEndTime() != 0){
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"地块已存在派遣英雄,地块id:"+proto.getId());
|
||||
// }
|
||||
// if (agos.contains(proto.getHeroTid())){
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"一个英雄一天只能派遣一次,heroTid:"+proto.getHeroTid());
|
||||
// }
|
||||
// // 验证特权次数
|
||||
// boolean countBol = PlayerLogic.getInstance().checkAndUpdate(user, proto.getPrivilageTypeId(),1);
|
||||
// if (!countBol){
|
||||
// throw new ErrorCodeException(ErrorCode.REFRESH_WHEL_TIME_NOT,"次数不足,地块id:"+proto.getId());
|
||||
// }
|
||||
// user.getPlayerInfoManager().addHeroDispatchAgos(proto.getHeroTid());
|
||||
// // TODO: 2021/12/20 派遣时间
|
||||
// int time = 0;
|
||||
// landInfo.setEndTime(nowInt+time);
|
||||
// landInfo.setHeroTid(proto.getHeroTid());
|
||||
// CommonProto.LandInfo.Builder info = CommonProto.LandInfo.newBuilder().setId(landInfo.getId()).setEndTime(landInfo.getEndTime()).setHeroTid(landInfo.getHeroTid());
|
||||
// builder.setLand(info);
|
||||
// }
|
||||
// CommonProto.Drop.Builder drop = CommonProto.Drop.newBuilder();
|
||||
// // 立即完成
|
||||
// if (type == 2){
|
||||
// if (landInfo.getEndTime() != 0){
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"地块已存在派遣英雄,地块id:"+proto.getId());
|
||||
// }
|
||||
// if (agos.contains(proto.getHeroTid())){
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_DEFINE,"一个英雄一天只能派遣一次,heroTid:"+proto.getHeroTid());
|
||||
// }
|
||||
// // 验证特权次数
|
||||
// boolean countBol = PlayerLogic.getInstance().checkAndUpdate(user, proto.getPrivilageTypeId(),1);
|
||||
// if (!countBol){
|
||||
// throw new ErrorCodeException(ErrorCode.REFRESH_WHEL_TIME_NOT,"次数不足,地块id:"+proto.getId());
|
||||
// }
|
||||
// user.getPlayerInfoManager().addHeroDispatchAgos(proto.getHeroTid());
|
||||
// // TODO: 2021/12/20 奖励
|
||||
// int[][] reward = {};
|
||||
// ItemUtil.drop(user, reward, 1, BIReason.WENDER_EARNINGS, drop);
|
||||
// builder.setDrop(drop);
|
||||
// }
|
||||
// // 领取
|
||||
// if (type == 3){
|
||||
// oneLandEarnings(user,landInfo,nowInt,drop);
|
||||
// builder.setDrop(drop);
|
||||
// }
|
||||
// user.getPlayerInfoManager().putLandInfo(landInfo);
|
||||
// builder.addAllHeroTids(user.getPlayerInfoManager().getHeroDispatchAgos());
|
||||
// MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.WanderDispatchResponse_VALUE, builder.build());
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1424,12 +1424,7 @@ public class ItemUtil {
|
|||
public static boolean itemCost(User user,int[][] costItems,int reason,int subReson) throws Exception {
|
||||
Map<Integer, Integer> itemMap = new HashMap<>();
|
||||
selectCost(costItems,itemMap);
|
||||
boolean result = checkCost(user, itemMap);
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
useItem(user, itemMap,reason,subReson);
|
||||
return true;
|
||||
return itemCost(user, itemMap, reason, subReson);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1440,12 +1435,7 @@ public class ItemUtil {
|
|||
for(int[][] itemArr : itemArrs){
|
||||
selectCost(itemArr,itemMap);
|
||||
}
|
||||
boolean result = checkCost(user, itemMap);
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
useItem(user, itemMap,reason,subReson);
|
||||
return true;
|
||||
return itemCost(user, itemMap, reason, subReson);
|
||||
}
|
||||
|
||||
public static boolean itemCost(User user,Map<Integer, Integer> costItems,int reason,int subReson) throws Exception {
|
||||
|
|
@ -1460,12 +1450,7 @@ public class ItemUtil {
|
|||
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);
|
||||
boolean result = checkCost(user, itemMap);
|
||||
if (!result) {
|
||||
return false;
|
||||
}
|
||||
useItem(user, itemMap,reason,subReason);
|
||||
return true;
|
||||
return itemCost(user, itemMap, reason, subReason);
|
||||
}
|
||||
|
||||
public static boolean itemCostLong(User user,Map<Integer, Long> costItems,int reason,int subReson) throws Exception {
|
||||
|
|
|
|||
|
|
@ -245,4 +245,24 @@ public class ToolsUtil {
|
|||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取map中最大的key
|
||||
*/
|
||||
public static int getMaxKey(Set<Integer> set) {
|
||||
if (set == null) return -1;
|
||||
Object[] obj = set.toArray();
|
||||
Arrays.sort(obj);
|
||||
return (int) obj[obj.length - 1];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取map中最小的key
|
||||
*/
|
||||
public static int getMinKey(Set<Integer> set) {
|
||||
if (set == null) return -1;
|
||||
Object[] obj = set.toArray();
|
||||
Arrays.sort(obj);
|
||||
return (int) obj[0];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="HomeLandLevel")
|
||||
public class SHomeLandLevel implements BaseConfig {
|
||||
|
||||
|
|
@ -14,6 +11,8 @@ public class SHomeLandLevel implements BaseConfig {
|
|||
|
||||
private int level;
|
||||
|
||||
private int playerLevel;
|
||||
|
||||
private int[] rule;
|
||||
|
||||
private int[][] cost;
|
||||
|
|
@ -44,6 +43,10 @@ public class SHomeLandLevel implements BaseConfig {
|
|||
return level;
|
||||
}
|
||||
|
||||
public int getPlayerLevel() {
|
||||
return playerLevel;
|
||||
}
|
||||
|
||||
public int[] getRule() {
|
||||
return rule;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,101 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="ShenWang")
|
||||
public class SShenWang implements BaseConfig {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SShenWang.class);
|
||||
private int id;
|
||||
|
||||
private int heroID;
|
||||
|
||||
private int level;
|
||||
|
||||
private int[][] trainSettingID;
|
||||
|
||||
private int needStar;
|
||||
|
||||
private int[] passiveSkill;
|
||||
|
||||
private int[][] needHero;
|
||||
|
||||
private int[][] needItem;
|
||||
|
||||
public static Map<Integer, SShenWang> defaultMap = new HashMap<>();
|
||||
|
||||
// heroid=》level=》SShenWang
|
||||
public static Map<Integer, Map<Integer, SShenWang>> heroMap = new HashMap<>();
|
||||
// 升星消耗物品 lv=》position=》ConsumeMaterialInfo
|
||||
private Map<Integer, Map<Integer, SCHero.ConsumeMaterialInfo>> consumeMaterialInfoOfPositionByLv = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
defaultMap = STableManager.getConfig(SShenWang.class);
|
||||
for (SShenWang shenWang : defaultMap.values()) {
|
||||
heroMap.putIfAbsent(shenWang.getHeroID(), new HashMap<>());
|
||||
heroMap.get(shenWang.getHeroID()).put(shenWang.getLevel(), shenWang);
|
||||
|
||||
Map<Integer, Map<Integer, SCHero.ConsumeMaterialInfo>> consumeMaterialInfoByStarTmp = new HashMap<>();
|
||||
int[][] rankupConsumeMaterial = shenWang.getNeedHero();
|
||||
for (int[] ints : rankupConsumeMaterial) {
|
||||
int star = ints[0];
|
||||
int position = ints[1];
|
||||
int groupID = ints[2];
|
||||
int nums = ints[3];
|
||||
if (!consumeMaterialInfoByStarTmp.containsKey(star)) {
|
||||
consumeMaterialInfoByStarTmp.put(star, new HashMap<>());
|
||||
}
|
||||
consumeMaterialInfoByStarTmp.get(star).put(position, new SCHero.ConsumeMaterialInfo(groupID, nums));
|
||||
}
|
||||
shenWang.setConsumeMaterialInfoOfPositionByLv(consumeMaterialInfoByStarTmp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getHeroID() {
|
||||
return heroID;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public int[][] getTrainSettingID() {
|
||||
return trainSettingID;
|
||||
}
|
||||
|
||||
public int getNeedStar() {
|
||||
return needStar;
|
||||
}
|
||||
|
||||
public int[] getPassiveSkill() {
|
||||
return passiveSkill;
|
||||
}
|
||||
|
||||
public int[][] getNeedHero() {
|
||||
return needHero;
|
||||
}
|
||||
|
||||
public int[][] getNeedItem() {
|
||||
return needItem;
|
||||
}
|
||||
|
||||
public Map<Integer, Map<Integer, SCHero.ConsumeMaterialInfo>> getConsumeMaterialInfoOfPositionByLv() {
|
||||
return consumeMaterialInfoOfPositionByLv;
|
||||
}
|
||||
|
||||
public void setConsumeMaterialInfoOfPositionByLv(Map<Integer, Map<Integer, SCHero.ConsumeMaterialInfo>> consumeMaterialInfoOfPositionByLv) {
|
||||
this.consumeMaterialInfoOfPositionByLv = consumeMaterialInfoOfPositionByLv;
|
||||
}
|
||||
}
|
||||
|
|
@ -2,14 +2,14 @@ import java.io.IOException;
|
|||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lvxinran
|
||||
* @date 2019/11/5
|
||||
* @discribe
|
||||
* @discribe 目前弃用,代替脚本找FileConverter.java
|
||||
*/
|
||||
@Deprecated
|
||||
public class BIUtil {
|
||||
public static void main(String[] args) {
|
||||
outBIReasonFile("serverlogic\\src\\main\\java\\com\\ljsd\\jieling\\globals\\BIReason.java","conf\\BIoutput.txt");
|
||||
|
|
|
|||
|
|
@ -26,17 +26,17 @@ public class ExcelUtils {
|
|||
oldFileNames.addAll(Arrays.asList(list));
|
||||
readExcelData();
|
||||
// //只加载新文件
|
||||
// Set<String> newFileNames = new HashSet<>();
|
||||
// File newfile = new File(path);
|
||||
// String[] newList = newfile.list();
|
||||
// newFileNames.addAll(Arrays.asList(newList));
|
||||
// newFileNames.removeAll(oldFileNames);
|
||||
// if(!newFileNames.isEmpty()) {
|
||||
// for (String newFileName : newFileNames) {
|
||||
// String finalNewFileName = newFileName.replaceAll(".txt", "");
|
||||
// genJavaFile(finalNewFileName);
|
||||
// }
|
||||
// }
|
||||
Set<String> newFileNames = new HashSet<>();
|
||||
File newfile = new File(path);
|
||||
String[] newList = newfile.list();
|
||||
newFileNames.addAll(Arrays.asList(newList));
|
||||
newFileNames.removeAll(oldFileNames);
|
||||
if(!newFileNames.isEmpty()) {
|
||||
for (String newFileName : newFileNames) {
|
||||
String finalNewFileName = newFileName.replaceAll(".txt", "");
|
||||
genJavaFile(finalNewFileName);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
public static void genJavaFile(String fileName){
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
package com.ljsd.jieling.util;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
Loading…
Reference in New Issue