【四象心法】bug修改
parent
3f2c236333
commit
3a29dc0ce3
|
@ -35,62 +35,78 @@ public class SixiangUpRequestHandler extends BaseHandler<HeroInfoProto.SixiangUp
|
|||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
SixiangProfessionInfo professionInfo = user.getHeroManager().getSixiangDataMap().get(professionId);
|
||||
int professionLv=professionInfo==null?0:professionInfo.level;
|
||||
SFourQuadrantConfig fourConfig=SFourQuadrantConfig.configByStrtMap.get(professionLv);
|
||||
|
||||
int[][]costArr=fourConfig.getLvupCost();
|
||||
boolean costResult = ItemUtil.itemCost(user,costArr, BIReason.SIXIANG_UP_COST,professionId);
|
||||
if (costResult) {
|
||||
if (professionInfo==null) {
|
||||
professionInfo=new SixiangProfessionInfo();
|
||||
professionInfo.level=0;
|
||||
professionInfo.propertyMap = new HashMap<>();
|
||||
if (CheckCurUpIsLimit(professionInfo)) {
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
|
||||
}else{
|
||||
int professionLv=professionInfo==null?0:professionInfo.level;
|
||||
SFourQuadrantConfig fourConfig=SFourQuadrantConfig.configByStrtMap.get(professionLv);
|
||||
int[][]costArr=fourConfig.getLvupCost();
|
||||
boolean costResult = ItemUtil.itemCost(user,costArr, BIReason.SIXIANG_UP_COST,professionId);
|
||||
if (costResult) {
|
||||
if (professionInfo==null) {
|
||||
professionInfo=new SixiangProfessionInfo();
|
||||
professionInfo.level=0;
|
||||
professionInfo.propertyMap = new HashMap<>();
|
||||
for (int i=0;i<fourConfig.getPropLimit().length;i++){
|
||||
int[]limit=fourConfig.getPropLimit()[i];
|
||||
professionInfo.propertyMap.put(limit[0],0);
|
||||
}
|
||||
}
|
||||
ArrayList<Integer>_randomList=new ArrayList<>();
|
||||
for (int i=0;i<fourConfig.getPropLimit().length;i++){
|
||||
int[]limit=fourConfig.getPropLimit()[i];
|
||||
professionInfo.propertyMap.put(limit[0],0);
|
||||
if (professionInfo.propertyMap.get(limit[0])<limit[1]){
|
||||
_randomList.add(limit[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
ArrayList<Integer>_randomList=new ArrayList<>();
|
||||
for (int i=0;i<fourConfig.getPropLimit().length;i++){
|
||||
int[]limit=fourConfig.getPropLimit()[i];
|
||||
if (professionInfo.propertyMap.get(limit[0])<limit[1]){
|
||||
_randomList.add(limit[0]);
|
||||
int[][]propLvup=fourConfig.getPropLvup();
|
||||
Random random=new Random();
|
||||
for (int i=0;i<10;i++){
|
||||
int index=random.nextInt(_randomList.size());
|
||||
int propId=_randomList.get(index);
|
||||
int addPropNum=propLvup[propId-1][1];
|
||||
int curPropNum= professionInfo.propertyMap.get(propId)+addPropNum;
|
||||
professionInfo.propertyMap.put(propId,curPropNum);
|
||||
}
|
||||
}
|
||||
int[][]propLvup=fourConfig.getPropLvup();
|
||||
Random random=new Random();
|
||||
for (int i=0;i<10;i++){
|
||||
int index=random.nextInt(_randomList.size());
|
||||
int propId=_randomList.get(index);
|
||||
int addPropNum=propLvup[propId-1][1];
|
||||
int curPropNum= professionInfo.propertyMap.get(propId)+addPropNum;
|
||||
professionInfo.propertyMap.put(propId,curPropNum);
|
||||
}
|
||||
|
||||
for (int i=0;i<fourConfig.getPropLimit().length;i++){
|
||||
int[]limit=fourConfig.getPropLimit()[i];//当前等级属性加成上限信息
|
||||
if (professionInfo.propertyMap.get(limit[0])>limit[1]){
|
||||
professionInfo.propertyMap.put(limit[0],limit[1]);
|
||||
for (int i=0;i<fourConfig.getPropLimit().length;i++){
|
||||
int[]limit=fourConfig.getPropLimit()[i];//当前等级属性加成上限信息
|
||||
if (professionInfo.propertyMap.get(limit[0])>limit[1]){
|
||||
professionInfo.propertyMap.put(limit[0],limit[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
user.getHeroManager().putSixiangDataMap(professionId,professionInfo);
|
||||
List<CommonProto.SixiangxinfaPropertyInfo> _list=new ArrayList<>();
|
||||
for (Map.Entry<Integer, Integer> dic : professionInfo.propertyMap.entrySet()) {
|
||||
CommonProto.SixiangxinfaPropertyInfo propertyInfo= CommonProto.SixiangxinfaPropertyInfo.newBuilder()
|
||||
.setPropertyId(dic.getKey())
|
||||
.setPropertyNum(dic.getValue())
|
||||
user.getHeroManager().putSixiangDataMap(professionId,professionInfo);
|
||||
List<CommonProto.SixiangxinfaPropertyInfo> _list=new ArrayList<>();
|
||||
for (Map.Entry<Integer, Integer> dic : professionInfo.propertyMap.entrySet()) {
|
||||
CommonProto.SixiangxinfaPropertyInfo propertyInfo= CommonProto.SixiangxinfaPropertyInfo.newBuilder()
|
||||
.setPropertyId(dic.getKey())
|
||||
.setPropertyNum(dic.getValue())
|
||||
.build();
|
||||
_list.add(propertyInfo);
|
||||
}
|
||||
LOGGER.info("属性值:{}",professionInfo.propertyMap.get(1));
|
||||
HeroInfoProto.SixiangUpResponse response=HeroInfoProto.SixiangUpResponse.newBuilder()
|
||||
.addAllInfoList(_list)
|
||||
.build();
|
||||
_list.add(propertyInfo);
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.SIXIANG_UP_RESPONSE_VALUE,response,true);
|
||||
}else{
|
||||
LOGGER.error("四象心法强化材料不足");
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
|
||||
}
|
||||
LOGGER.info("属性值:{}",professionInfo.propertyMap.get(1));
|
||||
HeroInfoProto.SixiangUpResponse response=HeroInfoProto.SixiangUpResponse.newBuilder()
|
||||
.addAllInfoList(_list)
|
||||
.build();
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.SIXIANG_UP_RESPONSE_VALUE,response,true);
|
||||
}else{
|
||||
LOGGER.error("四象心法强化材料不足");
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
|
||||
}
|
||||
}
|
||||
|
||||
///检测当前强化是否已达上限
|
||||
private boolean CheckCurUpIsLimit(SixiangProfessionInfo professionInfo){
|
||||
if (professionInfo==null){
|
||||
return false;
|
||||
}
|
||||
SFourQuadrantConfig fourConfig=SFourQuadrantConfig.configByStrtMap.get(professionInfo.level);
|
||||
for (int[] ints : fourConfig.getPropLimit()) {
|
||||
if (professionInfo.propertyMap.get(ints[0])<ints[1]){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package com.ljsd.jieling.handler.hero;
|
||||
|
||||
import com.ljsd.jieling.chat.logic.ChatLogic;
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.globals.Global;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.dao.SixiangProfessionInfo;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
|
@ -11,6 +13,7 @@ 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;
|
||||
import config.SErrorCodeEerverConfig;
|
||||
import config.SFourQuadrantConfig;
|
||||
import config.SXiuXian;
|
||||
import manager.STableManager;
|
||||
|
@ -36,7 +39,7 @@ public class SixiangUpStarRequestHandler extends BaseHandler<HeroInfoProto.Sixia
|
|||
User user = UserManager.getUser(uid);
|
||||
SixiangProfessionInfo professionInfo = user.getHeroManager().getSixiangDataMap().get(professionId);
|
||||
SFourQuadrantConfig fourConfig=SFourQuadrantConfig.configByStrtMap.get(professionInfo.level);
|
||||
if (CheckUpStar(user,professionInfo)) {
|
||||
// if (CheckUpStar(user,professionInfo)) {
|
||||
int[][]costArr=fourConfig.getRankupCost();
|
||||
boolean costResult = ItemUtil.itemCost(user,costArr, BIReason.SIXIANG_UP_STAR_COST,professionId);
|
||||
if (costResult) {
|
||||
|
@ -57,14 +60,18 @@ public class SixiangUpStarRequestHandler extends BaseHandler<HeroInfoProto.Sixia
|
|||
.addAllInfoList(_list)
|
||||
.build();
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.SIXIANG_UP_STAR_RESPONSE_VALUE,response,true);
|
||||
String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert("Sixiangjinjie_Hint",
|
||||
new Object[]{user.getPlayerInfoManager().getNameColor(), user.getPlayerInfoManager().getNickName(), GetProfessionName(professionId),professionInfo.level},
|
||||
new int[]{0,0,1});
|
||||
ChatLogic.getInstance().sendSysChatMessage(message, Global.DILIGENT, "1", 0, 0, 0, 0, 0);
|
||||
}else {
|
||||
LOGGER.error("四象心法进阶材料不足");
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
|
||||
}
|
||||
}else{
|
||||
LOGGER.error("四象心法进阶条件不满足");
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
|
||||
}
|
||||
// }else{
|
||||
// LOGGER.error("四象心法进阶条件不满足");
|
||||
// throw new ErrorCodeException(ErrorCode.SERVER_DEFINE_SELF);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
@ -103,4 +110,14 @@ public class SixiangUpStarRequestHandler extends BaseHandler<HeroInfoProto.Sixia
|
|||
}
|
||||
return propMap;
|
||||
}
|
||||
private String GetProfessionName(int _professionId){
|
||||
String professionName="";
|
||||
switch (_professionId){
|
||||
case 1:professionName="肉盾";break;
|
||||
case 2:professionName="输出";break;
|
||||
case 3:professionName="控制";break;
|
||||
case 4:professionName="辅助";break;
|
||||
}
|
||||
return professionName;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -492,5 +492,19 @@ public class HeroManager extends MongoBase {
|
|||
wishOpenHeroList.add(heroTid);
|
||||
updateString("wishOpenHeroList", wishOpenHeroList);
|
||||
}
|
||||
|
||||
public int GetSiXiangGongMingLv(){
|
||||
int gongmingLv=0;
|
||||
if (this.sixiangDataMap.size()<4){
|
||||
return gongmingLv;
|
||||
}
|
||||
gongmingLv=this.sixiangDataMap.get(1).level;
|
||||
for (Map.Entry<Integer, SixiangProfessionInfo> infoEntry : this.sixiangDataMap.entrySet()) {
|
||||
if (infoEntry.getValue().level<gongmingLv){
|
||||
gongmingLv=infoEntry.getValue().level;
|
||||
}
|
||||
}
|
||||
return gongmingLv;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2310,6 +2310,16 @@ public class HeroLogic{
|
|||
combinedAttribute(upStarProp,heroAllAttribute);
|
||||
}
|
||||
}
|
||||
///四象心法共鸣属性加成
|
||||
if (user.getHeroManager().GetSiXiangGongMingLv()>0){
|
||||
SFourQuadrantConfig fourConfig=SFourQuadrantConfig.configByStrtMap.get(user.getHeroManager().GetSiXiangGongMingLv());
|
||||
Map<Integer,Integer>gongmingPropertyMap=new HashMap<>(fourConfig.getPropResonance().length);
|
||||
for (int[] ints : fourConfig.getPropResonance()) {
|
||||
gongmingPropertyMap.put(ints[0],ints[1]);
|
||||
}
|
||||
int[][]gongmingProp=ItemUtil.mapToArray(gongmingPropertyMap);
|
||||
combinedAttribute(gongmingProp,heroAllAttribute);
|
||||
}
|
||||
|
||||
|
||||
//装备总战力评分
|
||||
|
|
Loading…
Reference in New Issue