图鉴神技功能同步到西游
parent
87952418dd
commit
537ee4f13a
|
|
@ -264,6 +264,7 @@ public class GetPlayerInfoHandler extends BaseHandler{
|
|||
.setPlayerGodLevel(playerInfoManager.getPlayerGodLevel())
|
||||
.setPlayerGodTowerNum(playerInfoManager.getPlayerGodTowerNum())
|
||||
.addAllPlayerMeridiansLevel(playerInfoManager.getAllPlayerGodMeridiansLevels())
|
||||
.addAllHandBookSkills(user.getPlayerInfoManager().getHandBookSkillList())
|
||||
.build();
|
||||
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
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 rpc.protocols.MessageTypeProto;
|
||||
import rpc.protocols.PlayerInfoProto;
|
||||
|
||||
/**
|
||||
* 解锁图鉴技能请求
|
||||
*/
|
||||
public class UnLockHandBookSkillRequestHandler extends BaseHandler<PlayerInfoProto.UnLockHandBookSkillRequest> {
|
||||
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.UnLockHandBookSkillRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, PlayerInfoProto.UnLockHandBookSkillRequest proto) throws Exception {
|
||||
HeroLogic.getInstance().unLockHandBookSkill(proto.getHandBookSkillId(),iSession);
|
||||
}
|
||||
}
|
||||
|
|
@ -246,6 +246,8 @@ public class PlayerManager extends MongoBase {
|
|||
//按排行榜id存储的冲榜活动次数奖励信息
|
||||
private Map<Integer, ChongRankTimesInfo> chongRankTimesInfoMaps = new HashMap<>();
|
||||
|
||||
private Map<Integer,Integer> handBookSkills = new HashMap<>();//图鉴神技
|
||||
|
||||
public void putDesireDraw(int type, int tempId) {
|
||||
this.desireDraw.put(type, tempId);
|
||||
updateString("desireDraw", desireDraw);
|
||||
|
|
@ -1674,4 +1676,27 @@ public class PlayerManager extends MongoBase {
|
|||
return null;
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getHandBookSkills() {
|
||||
return handBookSkills;
|
||||
}
|
||||
|
||||
public List<Integer> getHandBookSkillList() {
|
||||
List<Integer> list = new ArrayList<>();
|
||||
Map<Integer, Integer> map = this.getHandBookSkills();
|
||||
if(map != null){
|
||||
for(int id:map.values()){
|
||||
list.add(id);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setHandBookSkills(Map<Integer, Integer> handBookSkills) {
|
||||
if(handBookSkills == null){
|
||||
handBookSkills = new HashMap<>();
|
||||
}
|
||||
this.handBookSkills = handBookSkills;
|
||||
updateString("handBookSkills", this.handBookSkills);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ public class HeroVo {
|
|||
private Map<String, PropertyItem> faxiangMap = new HashMap<>();
|
||||
private Baubles baubles;
|
||||
private Training training;
|
||||
private Map<Integer,Integer> handBookSkills = new HashMap<>();
|
||||
|
||||
public HeroVo() {
|
||||
}
|
||||
|
|
@ -58,6 +59,10 @@ public class HeroVo {
|
|||
heroVo.jewelMap = CBean2Proto.propertyItemOfLocal(user,hero.getJewelInfo());
|
||||
heroVo.faxiangMap = CBean2Proto.propertyItemOfLocal(user,hero.getFaxiangList());
|
||||
heroVo.training = hero.getTraining();
|
||||
Map<Integer,Integer> handBookSills = user.getPlayerInfoManager().getHandBookSkills();
|
||||
if(handBookSills != null){
|
||||
heroVo.handBookSkills = new HashMap<>(handBookSills);
|
||||
}
|
||||
return heroVo;
|
||||
}
|
||||
|
||||
|
|
@ -136,4 +141,8 @@ public class HeroVo {
|
|||
public Map<Integer, Integer> getTrumpBookStarMap() {
|
||||
return trumpBookStarMap;
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getHandBookSkills() {
|
||||
return handBookSkills;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2079,21 +2079,25 @@ public class HeroLogic {
|
|||
|
||||
int propertyId = heroVo.getPropertyId();
|
||||
// 紫府神印技能
|
||||
for (PurpleMansionSeal seal : heroVo.getPurpleMansionSealMap().values()) {
|
||||
// 使用中神印
|
||||
if (seal.getState() != 1) {
|
||||
continue;
|
||||
}
|
||||
// 通用神印
|
||||
if (seal.getType() == 0) {
|
||||
getPurpleMansionSealSkill(seal.getSealId(), propertyId, skillList);
|
||||
}
|
||||
// 附身神印
|
||||
if (seal.getType() == 1 && seal.getSubId().equals(heroVo.getId())) {
|
||||
getPurpleMansionSealSkill(seal.getSealId(), propertyId, skillList);
|
||||
}
|
||||
// for (PurpleMansionSeal seal : heroVo.getPurpleMansionSealMap().values()) {
|
||||
// // 使用中神印
|
||||
// if (seal.getState() != 1) {
|
||||
// continue;
|
||||
// }
|
||||
// // 通用神印
|
||||
// if (seal.getType() == 0) {
|
||||
// getPurpleMansionSealSkill(seal.getSealId(), propertyId, skillList);
|
||||
// }
|
||||
// // 附身神印
|
||||
// if (seal.getType() == 1 && seal.getSubId().equals(heroVo.getId())) {
|
||||
// getPurpleMansionSealSkill(seal.getSealId(), propertyId, skillList);
|
||||
// }
|
||||
// }
|
||||
//图鉴技能
|
||||
Map<Integer,Integer> handBookSkills = heroVo.getHandBookSkills();
|
||||
for(int handBookSkillId : handBookSkills.values()){
|
||||
getHandBookSkill(handBookSkillId,propertyId,skillList);
|
||||
}
|
||||
|
||||
// 装备套装list初始化
|
||||
getEquipSuiteSkill(heroVo.getEquipPositionMap(), skillList);
|
||||
|
||||
|
|
@ -7560,4 +7564,115 @@ public class HeroLogic {
|
|||
return attrMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解锁天书密卷神技
|
||||
*/
|
||||
public void unLockHandBookSkill(int handBookSkillId,ISession iSession) throws Exception {
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
SXiuXianSkill sXiuXianSkill = STableManager.getConfig(SXiuXianSkill.class).get(handBookSkillId);
|
||||
if (sXiuXianSkill == null){
|
||||
return;
|
||||
}
|
||||
int skillType = sXiuXianSkill.getSkillTtype();
|
||||
if(skillType != 1){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"handBookSkill is not handBokkSkill:"+handBookSkillId);
|
||||
}
|
||||
Map<Integer,Integer> handBookSkills = user.getPlayerInfoManager().getHandBookSkills();
|
||||
if(handBookSkills == null){
|
||||
handBookSkills = new HashMap<>();
|
||||
}
|
||||
//已经解锁
|
||||
if(handBookSkills.containsKey(handBookSkillId)){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"handBookSkill is unlock:"+handBookSkillId);
|
||||
}
|
||||
int openType = sXiuXianSkill.getOpenType();
|
||||
boolean canUnlock = false;
|
||||
int[][] openValue = sXiuXianSkill.getOpenValue();
|
||||
//无条件,可直接解锁
|
||||
if(openValue == null || openValue.length <1){
|
||||
canUnlock = true;
|
||||
}else{
|
||||
for(int[] rule : openValue){
|
||||
boolean isRule = false;
|
||||
//指定英雄解锁
|
||||
if(openType == 1){
|
||||
int heroId = rule[0];
|
||||
int heroStar = rule[1];
|
||||
for(Hero hero : user.getHeroManager().getHeroMap().values()){
|
||||
if(hero.getTemplateId() == heroId){
|
||||
if(hero.getStar() >= heroStar){
|
||||
isRule = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{//指定法宝解锁
|
||||
int baubleId = rule[0];
|
||||
int baubleLevel = rule[1];
|
||||
List<Baubles> list = user.getEquipManager().getBaublesList();
|
||||
for(Baubles bauble : list){
|
||||
if(bauble.getEquipId() == baubleId){
|
||||
if(bauble.getLevel() >= baubleLevel){
|
||||
isRule = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//只要有一个条件不达标,就不能解锁
|
||||
if(!isRule){
|
||||
canUnlock = false;
|
||||
break;
|
||||
}else{
|
||||
canUnlock = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
//条件不满足,不能解锁
|
||||
if(!canUnlock){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"handBookSkill is not rule");
|
||||
}
|
||||
//扣除消耗的材料
|
||||
int[][] cost = sXiuXianSkill.getConsume();
|
||||
if(cost != null && cost.length >0){
|
||||
boolean itemCost = ItemUtil.itemCost(user, cost, BIReason.PLAYER_GOD_MERIDIANS_LEVEL, 0);
|
||||
if (!itemCost){
|
||||
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
|
||||
}
|
||||
}
|
||||
handBookSkills.put(handBookSkillId,handBookSkillId);
|
||||
user.getPlayerInfoManager().setHandBookSkills(handBookSkills);
|
||||
PlayerInfoProto.UnLockHandBookSkillResponse build = PlayerInfoProto.UnLockHandBookSkillResponse.newBuilder().
|
||||
setHandBookSkillId(handBookSkillId).build();
|
||||
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.UnLockHandBookSkillResponse_VALUE, build, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取图鉴技能
|
||||
*/
|
||||
private void getHandBookSkill(int sealId, int propertyId, List<Integer> skillList) {
|
||||
SXiuXianSkill xianSkill = STableManager.getConfig(SXiuXianSkill.class).get(sealId);
|
||||
// 技能数组转list
|
||||
int skillId = xianSkill.getSkillId()[0];
|
||||
if (skillId <= 0) {
|
||||
return;
|
||||
}
|
||||
// 适用范围
|
||||
int[] fitList = xianSkill.getFitList();
|
||||
switch (fitList[0]) {
|
||||
case 0:
|
||||
// 不限
|
||||
skillList.add(skillId);
|
||||
break;
|
||||
case 1:
|
||||
case 2:// 阵营限制,职业限制
|
||||
if (propertyId == fitList[1]) {
|
||||
skillList.add(skillId);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import java.util.Map;
|
|||
public class SXiuXianSkill implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
private int skillTtype;
|
||||
|
||||
private int type;
|
||||
|
||||
|
|
@ -17,6 +18,11 @@ public class SXiuXianSkill implements BaseConfig {
|
|||
|
||||
private int[]skillId;
|
||||
|
||||
private int[][] openSkillSet;
|
||||
private int[][] consume;
|
||||
private int openType;
|
||||
private int[][] openValue;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
|
|
@ -40,4 +46,24 @@ public class SXiuXianSkill implements BaseConfig {
|
|||
public int[] getSkillId() {
|
||||
return skillId;
|
||||
}
|
||||
|
||||
public int[][] getOpenSkillSet() {
|
||||
return openSkillSet;
|
||||
}
|
||||
|
||||
public int[][] getConsume() {
|
||||
return consume;
|
||||
}
|
||||
|
||||
public int getOpenType() {
|
||||
return openType;
|
||||
}
|
||||
|
||||
public int[][] getOpenValue() {
|
||||
return openValue;
|
||||
}
|
||||
|
||||
public int getSkillTtype() {
|
||||
return skillTtype;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue