修行技能逻辑提交
parent
31a31cbcd2
commit
4b3a1a1e42
|
@ -174,6 +174,7 @@ public enum ErrorCode implements IErrorCode {
|
|||
CHAT_NOT_CROSS(143,"聊天检查,没有跨服分组"),
|
||||
SIXIANG_UP_LIMIT(144,"强化已达上限"),
|
||||
CROSS_YXLD_OVER(145,"赛季结算中"),
|
||||
PRACTICE_LEVE_DOWN(146,"修行等级不足"),
|
||||
;
|
||||
private static final Set<Integer> CodeSet = new HashSet<>();
|
||||
|
||||
|
|
|
@ -359,4 +359,5 @@ public interface BIReason {
|
|||
int SEVEN_WORLD_ACTIVITY_END = 1213;//七界活动结束
|
||||
int SEVEN_WORLD_TREASURE = 1214;//七界秘宝
|
||||
int LEVEL_UP_REWARD = 1220;// 玩家升级赠与的道具
|
||||
int PRACTICE_SKILL_UP_COST=1221;//修行技能升级消耗
|
||||
}
|
|
@ -4,6 +4,7 @@ import com.ljsd.jieling.exception.ErrorCode;
|
|||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.globals.BIReason;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.dao.HeroManager;
|
||||
import com.ljsd.jieling.logic.dao.SixiangProfessionInfo;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
|
@ -11,6 +12,7 @@ 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 org.springframework.stereotype.Component;
|
||||
import rpc.protocols.CommonProto;
|
||||
import rpc.protocols.HeroInfoProto;
|
||||
|
@ -30,9 +32,27 @@ public class PracticeSkillUpRequestHandler extends BaseHandler<HeroInfoProto.Pra
|
|||
public void processWithProto(ISession session, HeroInfoProto.PracticeSkillUpRequest proto) throws Exception {
|
||||
int skillId=proto.getSkillId();//修行技能id
|
||||
int uid = session.getUid();
|
||||
|
||||
User user = UserManager.getUser(uid);
|
||||
Map<Integer, Integer> skillMap = user.getHeroManager().getPracticeSkillMap();
|
||||
HeroManager heroManager=user.getHeroManager();
|
||||
int practiceLv=heroManager.getPracticeLevel();
|
||||
int skillLv=0;
|
||||
if (heroManager.getPracticeSkillMap().containsKey(skillId)){
|
||||
skillLv=heroManager.getPracticeSkillMap().get(skillId);
|
||||
}
|
||||
int nextSkillLv=skillLv+1;
|
||||
SPlayerSkill nextPlayerSkill=SPlayerSkill.GetSPlayerSkill(skillId,nextSkillLv);
|
||||
if (nextPlayerSkill==null||practiceLv<nextPlayerSkill.getXiuxianId()){
|
||||
LOGGER.error("修行等级不足");
|
||||
throw new ErrorCodeException(ErrorCode.PRACTICE_LEVE_DOWN);
|
||||
}
|
||||
SPlayerSkill curPlayerSkill=SPlayerSkill.GetSPlayerSkill(skillId,skillLv);
|
||||
int[][]costArr=curPlayerSkill.getLvupCost();
|
||||
boolean costResult = ItemUtil.itemCost(user,costArr, BIReason.PRACTICE_SKILL_UP_COST,skillId);
|
||||
if (!costResult){
|
||||
LOGGER.error("修行技能升级材料不足");
|
||||
throw new ErrorCodeException(ErrorCode.HERO_ITEM_NOT);
|
||||
}
|
||||
heroManager.setPracticeSkillMap(skillId,nextSkillLv);
|
||||
MessageUtil.sendMessage(session,1, MessageTypeProto.MessageType.SIXIANG_UP_RESPONSE_VALUE,null,true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import com.ljsd.jieling.network.session.ISession;
|
|||
import com.ljsd.jieling.util.CBean2Proto;
|
||||
import com.ljsd.jieling.util.ItemUtil;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SPlayerSkill;
|
||||
import config.SXiuXian;
|
||||
import config.SXiuXianSkill;
|
||||
import manager.STableManager;
|
||||
|
@ -24,6 +25,7 @@ import rpc.protocols.HeroInfoProto;
|
|||
import rpc.protocols.MessageTypeProto;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
|
@ -90,6 +92,15 @@ public class UpPracticeLevelHandler extends BaseHandler<HeroInfoProto.UpPractice
|
|||
// 推送神印信息
|
||||
HeroLogic.sendMessageBySeal(user.getId());
|
||||
}
|
||||
///判断修行技能解锁
|
||||
if (xiuXian2.getRealmId()>xiuXian.getRealmId()){
|
||||
for (Map.Entry<Integer, Map<Integer, SPlayerSkill>> interMap : SPlayerSkill.getMapData().entrySet()) {
|
||||
SPlayerSkill defaultSkill=interMap.getValue().get(1);
|
||||
if (user.getHeroManager().getPracticeSkillMap().containsKey(defaultSkill.getSkillID()))continue;
|
||||
if (xiuXian2.getRealmId()<defaultSkill.getXiuxianId())continue;
|
||||
user.getHeroManager().setPracticeSkillMap(defaultSkill.getSkillID(),1);
|
||||
}
|
||||
}
|
||||
|
||||
// 升级返回
|
||||
HeroInfoProto.UpPracticeLevelResponse build = HeroInfoProto.UpPracticeLevelResponse.newBuilder().setPracticeLevel(xiuXian2.getId()).build();
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="PlayerSkill")
|
||||
public class SPlayerSkill implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int skillID;
|
||||
|
||||
private int xiuxianId;
|
||||
|
||||
private int[]skillIDList;
|
||||
|
||||
private int[]releasePoint;
|
||||
|
||||
private int[][]releaseLimit;
|
||||
|
||||
private int cDCount;
|
||||
|
||||
private int level;
|
||||
|
||||
private int[][] lvupCost;
|
||||
|
||||
private int sort;
|
||||
|
||||
private static Map<Integer, Map<Integer,SPlayerSkill>>mapData;
|
||||
|
||||
public static Map<Integer,SPlayerSkill> sPrivilegeTypeConfigMap;
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
mapData=new HashMap<>();
|
||||
sPrivilegeTypeConfigMap= STableManager.getConfig(SPlayerSkill.class);
|
||||
for (Map.Entry<Integer, SPlayerSkill> integer : sPrivilegeTypeConfigMap.entrySet()) {
|
||||
SPlayerSkill skill=integer.getValue();
|
||||
if (!mapData.containsKey(skill.getSkillID())){
|
||||
Map<Integer,SPlayerSkill>skillMap=new HashMap<>();
|
||||
mapData.put(skill.getSkillID(),skillMap);
|
||||
}
|
||||
mapData.get(skill.getSkillID()).put(skill.getLevel(),skill);
|
||||
}
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getSkillID() {
|
||||
return skillID;
|
||||
}
|
||||
|
||||
public int getXiuxianId() {
|
||||
return xiuxianId;
|
||||
}
|
||||
|
||||
public int[] getSkillIDList() {
|
||||
return skillIDList;
|
||||
}
|
||||
|
||||
public int[] getReleasePoint() {
|
||||
return releasePoint;
|
||||
}
|
||||
|
||||
public int[][] getReleaseLimit() {
|
||||
return releaseLimit;
|
||||
}
|
||||
|
||||
public int getcDCount() {
|
||||
return cDCount;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public int[][] getLvupCost() {
|
||||
return lvupCost;
|
||||
}
|
||||
|
||||
public int getSort() {
|
||||
return sort;
|
||||
}
|
||||
|
||||
public static SPlayerSkill GetSPlayerSkill(int skillId,int skillLv){
|
||||
if (!mapData.containsKey(skillId)||!mapData.get(skillId).containsKey(skillLv))return null;
|
||||
return mapData.get(skillId).get(skillLv);
|
||||
}
|
||||
|
||||
public static Map<Integer, Map<Integer, SPlayerSkill>> getMapData() {
|
||||
return mapData;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue