身外化身提交
parent
7dd2521295
commit
cbf61cfafc
|
@ -36,6 +36,7 @@ public interface GlobalItemType {
|
|||
int AllPowerful_DogFood = 25;
|
||||
int LikableCostItem=27;//好感度功能消耗道具
|
||||
int MOUNT_FRAGMENTS_ITEM = 28;//坐骑碎片
|
||||
int TRANSFORMATION_CARD = 29;//化身卡
|
||||
//物品使用类型
|
||||
int NO_USE = 0 ; //不使用
|
||||
int RANDOM_USE = 1; // 随机使用
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.ljsd.jieling.handler.ridingsward;
|
||||
|
||||
import com.google.protobuf.GeneratedMessage;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.ridingSward.RidingSwardLogic;
|
||||
import com.ljsd.jieling.network.session.ISession;
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
package com.ljsd.jieling.handler.transformation;
|
||||
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
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.CBean2Proto;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.HeroInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/11/11 17:06:42
|
||||
* @Description: 获取变身卡信息
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Component
|
||||
public class GetTransformationHandler extends BaseHandler<HeroInfoProto.GetTransformationRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.GetTransformationRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, HeroInfoProto.GetTransformationRequest proto) throws Exception {
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
HeroInfoProto.GetTransformationResponse.Builder builder = HeroInfoProto.GetTransformationResponse.newBuilder()
|
||||
.addAllList(CBean2Proto.getTransformationInfoList(user));
|
||||
MessageUtil.sendMessage(user.getId(),1, MessageTypeProto.MessageType.GetTransformationResponse_VALUE,builder.build(),true);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
package com.ljsd.jieling.handler.transformation;
|
||||
|
||||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.dao.TransformationInfo;
|
||||
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.CBean2Proto;
|
||||
import com.ljsd.jieling.util.MessageUtil;
|
||||
import config.SChangingCard;
|
||||
import manager.STableManager;
|
||||
import org.springframework.stereotype.Component;
|
||||
import rpc.protocols.HeroInfoProto;
|
||||
import rpc.protocols.MessageTypeProto;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/11/11 17:06:42分时系统的进程出现如图所示的状态变化 inurl:wenku
|
||||
* @Description: 上阵或卸下变身卡信息
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Component
|
||||
public class UpOrDownTransformationHandler extends BaseHandler<HeroInfoProto.UpOrDownTransformationRequest> {
|
||||
@Override
|
||||
public MessageTypeProto.MessageType getMessageCode() {
|
||||
return MessageTypeProto.MessageType.UpOrDownTransformationRequest;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processWithProto(ISession iSession, HeroInfoProto.UpOrDownTransformationRequest proto) throws Exception {
|
||||
User user = UserManager.getUser(iSession.getUid());
|
||||
|
||||
int id = proto.getId();
|
||||
|
||||
Map<Integer, SChangingCard> cardMap = STableManager.getConfig(SChangingCard.class);
|
||||
SChangingCard changingCard = cardMap.get(id);
|
||||
if (changingCard == null || changingCard.getIsOpen() == 0){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"该卡片版本错误");
|
||||
}
|
||||
|
||||
Map<Integer, TransformationInfo> infoMap = user.getHeroManager().getTransformationList();
|
||||
TransformationInfo info = infoMap.get(id);
|
||||
if (info != null && info.getStatus() == 0){
|
||||
// 上阵变身卡
|
||||
int index = proto.getIndex();
|
||||
for (TransformationInfo value : infoMap.values()) {
|
||||
if (value.getIndex() == index){
|
||||
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"位置错误,该位置已存在变身卡信息");
|
||||
}
|
||||
}
|
||||
info = new TransformationInfo(id, index, 1);
|
||||
}
|
||||
else {
|
||||
// 激活或者卸下变身卡
|
||||
info = new TransformationInfo(id, 0, 0);
|
||||
}
|
||||
user.getHeroManager().putTransformationList(info);
|
||||
// 返回值
|
||||
HeroInfoProto.GetTransformationResponse.Builder builder = HeroInfoProto.GetTransformationResponse.newBuilder()
|
||||
.addAllList(CBean2Proto.getTransformationInfoList(user));
|
||||
MessageUtil.sendMessage(user.getId(),1, MessageTypeProto.MessageType.GetTransformationResponse_VALUE,builder.build(),true);
|
||||
}
|
||||
|
||||
}
|
|
@ -155,6 +155,20 @@ public class HeroManager extends MongoBase {
|
|||
*/
|
||||
private Set<Integer> wishOpenHeroList = new HashSet<>();
|
||||
|
||||
/**
|
||||
* 变身卡列表
|
||||
*/
|
||||
private Map<Integer,TransformationInfo> transformationList = new HashMap<>();
|
||||
|
||||
public Map<Integer,TransformationInfo> getTransformationList() {
|
||||
return transformationList;
|
||||
}
|
||||
|
||||
public void putTransformationList(TransformationInfo info) {
|
||||
this.transformationList.put(info.getCardId(),info);
|
||||
updateString("transformationList", transformationList);
|
||||
}
|
||||
|
||||
public Map<Integer, Integer> getRandomCountByType() {
|
||||
return randomCountByType;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,58 @@
|
|||
package com.ljsd.jieling.logic.dao;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Date 2021/11/16 15:50:15
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class TransformationInfo {
|
||||
private int cardId;
|
||||
private int index;
|
||||
private int status;
|
||||
|
||||
public TransformationInfo(int cardId, int index, int status) {
|
||||
this.cardId = cardId;
|
||||
this.index = index;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public int getCardId() {
|
||||
return cardId;
|
||||
}
|
||||
|
||||
public void setCardId(int cardId) {
|
||||
this.cardId = cardId;
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public void setIndex(int index) {
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
TransformationInfo that = (TransformationInfo) o;
|
||||
return cardId == that.cardId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(cardId, index, status);
|
||||
}
|
||||
}
|
|
@ -2252,24 +2252,42 @@ public class HeroLogic {
|
|||
return sb;
|
||||
}
|
||||
|
||||
///获取修行技能数据
|
||||
public void getPracticeSkill(List<CommonProto.FightUnitInfo> infoList, Map<Integer, Integer> practiceSkillMap,long maxForce,int sex,int userLv) {
|
||||
/**
|
||||
* 主角技能数据
|
||||
*/
|
||||
public void getPracticeSkill(List<CommonProto.FightUnitInfo> infoList,
|
||||
Map<Integer, Integer> practiceSkillMap,
|
||||
long maxForce,int sex,int userLv,List<Integer> tfInfoList) {
|
||||
if (practiceSkillMap.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
StringBuilder skillStr = new StringBuilder();
|
||||
// 修行技能
|
||||
for (Map.Entry<Integer, Integer> entry : practiceSkillMap.entrySet()) {
|
||||
int skillId = SPlayerSkill.GetSPlayerSkill(entry.getKey(), entry.getValue()).getId();
|
||||
if (skillStr.toString().isEmpty()) {
|
||||
skillStr.append(skillId);
|
||||
} else {
|
||||
skillStr.append("#").append(skillId);
|
||||
SPlayerSkill playerSkill = SPlayerSkill.GetSPlayerSkill(entry.getKey(), entry.getValue());
|
||||
if (playerSkill != null){
|
||||
skillStr.append(playerSkill.getId()).append("#");
|
||||
}
|
||||
}
|
||||
// 身外化身技能
|
||||
Map<Integer, SChangingCard> cardMap = STableManager.getConfig(SChangingCard.class);
|
||||
for (int cardId : tfInfoList) {
|
||||
SChangingCard card = cardMap.get(cardId);
|
||||
if (card != null){
|
||||
skillStr.append(card.getSkill()).append("#");
|
||||
}
|
||||
}
|
||||
|
||||
// 去除最后一位得#号
|
||||
String skill = skillStr.toString();
|
||||
if (!StringUtil.isEmpty(skill)){
|
||||
skill = skill.substring(0,skill.length()-1);
|
||||
}
|
||||
|
||||
CommonProto.FightUnitInfo skillInfo = CommonProto.FightUnitInfo
|
||||
.newBuilder()
|
||||
.setUnitId("0")
|
||||
.setUnitSkillIds(skillStr.toString())
|
||||
.setUnitSkillIds(skill)
|
||||
.setProperty("0")
|
||||
.setPosition(100)
|
||||
.setStar(userLv)
|
||||
|
@ -2280,22 +2298,15 @@ public class HeroLogic {
|
|||
infoList.add(skillInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 这里放全部得主动技能
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
public List<CommonProto.FightUnitInfo> getPokemonSkills(User user) {
|
||||
//todo 灵兽
|
||||
Map<Integer, String> pokemonTeamMap = user.getPokemonManager().getPokemonTeamMap();
|
||||
PokemonManager pokemonManager = user.getPokemonManager();
|
||||
// for(int i = 0;i<blockUnlockLevel.length;i++){
|
||||
// if(pokemonTeamMap.containsKey(i+1)){
|
||||
// String s = pokemonTeamMap.get(i + 1);
|
||||
// Pokemon pokemon = pokemonManager.getPokemonMap().get(s);
|
||||
// if(pokemon!=null){
|
||||
// SSpiritAnimalSkill sSpiritAnimalSkill = SSpiritAnimalSkill.skillByAnimalAndStar.get(pokemon.getTmpId()).get(pokemon.getStar());
|
||||
// pokenSkillResult.append(pokenSkillResult.length()==0?sSpiritAnimalSkill.getId():"#"+sSpiritAnimalSkill.getId());
|
||||
// }
|
||||
// }else{
|
||||
// pokenSkillResult.append(pokenSkillResult.length()==0?0:"#"+0);
|
||||
// }
|
||||
// }
|
||||
List<CommonProto.FightUnitInfo> pokemonInfos = new ArrayList<>();
|
||||
for (Map.Entry<Integer, String> entry : pokemonTeamMap.entrySet()) {
|
||||
Pokemon pokemon = pokemonManager.getPokemonMap().get(entry.getValue());
|
||||
|
@ -2315,7 +2326,16 @@ public class HeroLogic {
|
|||
.build();
|
||||
pokemonInfos.add(info);
|
||||
}
|
||||
getPracticeSkill(pokemonInfos, user.getHeroManager().getPracticeSkillMap(),user.getPlayerInfoManager().getMaxForce(),user.getPlayerInfoManager().getSex(),user.getPlayerInfoManager().getLevel());
|
||||
|
||||
// 获取已上阵得变身卡
|
||||
List<Integer> list = user.getHeroManager().getTransformationList().values().stream()
|
||||
.filter(v -> v.getStatus() == 1)
|
||||
.mapToInt(TransformationInfo::getCardId)
|
||||
.boxed().collect(Collectors.toList());
|
||||
|
||||
getPracticeSkill(pokemonInfos, user.getHeroManager().getPracticeSkillMap(),
|
||||
user.getPlayerInfoManager().getMaxForce(),user.getPlayerInfoManager().getSex(),
|
||||
user.getPlayerInfoManager().getLevel(),list);
|
||||
return pokemonInfos;
|
||||
}
|
||||
|
||||
|
@ -2371,7 +2391,9 @@ public class HeroLogic {
|
|||
.setUnitId(String.valueOf(pokemon.getTmpId())).setUnitSkillIds(String.valueOf(sSpiritAnimalSkill.getId())).build();
|
||||
pokemonInfos.add(info);
|
||||
}
|
||||
getPracticeSkill(pokemonInfos,crossArenaManager.getPracticeSkillMap(),crossArenaManager.getMaxHistoryForce(),csPlayer.getSex(),csPlayer.getLevel());
|
||||
getPracticeSkill(pokemonInfos,crossArenaManager.getPracticeSkillMap(),
|
||||
crossArenaManager.getMaxHistoryForce(),csPlayer.getSex(),
|
||||
csPlayer.getLevel(),crossArenaManager.getTfInfoList());
|
||||
return pokemonInfos;
|
||||
}
|
||||
|
||||
|
@ -2404,7 +2426,14 @@ public class HeroLogic {
|
|||
.setUnitId(String.valueOf(pokemon.getTmpId())).setUnitSkillIds(String.valueOf(sSpiritAnimalSkill.getId())).build();
|
||||
pokemonInfos.add(info);
|
||||
}
|
||||
getPracticeSkill(pokemonInfos,user.getHeroManager().getPracticeSkillMap(),user.getPlayerInfoManager().getMaxForce(),user.getPlayerInfoManager().getSex(),user.getPlayerInfoManager().getLevel());
|
||||
// 获取已上阵得变身卡
|
||||
List<Integer> list = user.getHeroManager().getTransformationList().values().stream()
|
||||
.filter(v -> v.getStatus() == 1)
|
||||
.mapToInt(TransformationInfo::getCardId)
|
||||
.boxed().collect(Collectors.toList());
|
||||
getPracticeSkill(pokemonInfos,user.getHeroManager().getPracticeSkillMap(),
|
||||
user.getPlayerInfoManager().getMaxForce(),user.getPlayerInfoManager().getSex(),
|
||||
user.getPlayerInfoManager().getLevel(),list);
|
||||
return pokemonInfos;
|
||||
}
|
||||
|
||||
|
@ -2592,6 +2621,20 @@ public class HeroLogic {
|
|||
combinedAttribute(allLikableProp, heroAllAttribute);
|
||||
}
|
||||
|
||||
// 身外化身加成
|
||||
Map<Integer, TransformationInfo> transformationList = user.getHeroManager().getTransformationList();
|
||||
Map<Integer, SChangingCard> changingCardMap = STableManager.getConfig(SChangingCard.class);
|
||||
int[][] arrayValue = SSpecialConfig.getTwiceArrayValue(SSpecialConfig.PER_CHANGING_CART_PROP);
|
||||
for (TransformationInfo info : transformationList.values()) {
|
||||
SChangingCard card = changingCardMap.get(info.getCardId());
|
||||
if (card != null){
|
||||
// 变身卡单独提供得属性
|
||||
combinedAttribute(card.getPropList(), heroAllAttribute);
|
||||
// 每张变身卡提供得额外属性
|
||||
combinedAttribute(arrayValue, heroAllAttribute);
|
||||
}
|
||||
}
|
||||
|
||||
//装备总战力评分
|
||||
int equipForce = 0;
|
||||
Iterator<Map.Entry<Integer, Integer>> iterator = hero.getEquipByHongmengPositionMap(user.getHeroManager()).entrySet().iterator();
|
||||
|
|
|
@ -1241,4 +1241,22 @@ public class CBean2Proto {
|
|||
});
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取变身卡列表信息
|
||||
* @param user
|
||||
* @return
|
||||
*/
|
||||
public static List<CommonProto.TransformationCardInfo> getTransformationInfoList(User user){
|
||||
List<CommonProto.TransformationCardInfo> list = new ArrayList<>();
|
||||
user.getHeroManager().getTransformationList().values().forEach((value)->{
|
||||
CommonProto.TransformationCardInfo builder = CommonProto.TransformationCardInfo.newBuilder()
|
||||
.setId(value.getIndex())
|
||||
.setIndex(value.getIndex())
|
||||
.setStatus(value.getStatus())
|
||||
.build();
|
||||
list.add(builder);
|
||||
});
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -567,6 +567,7 @@ public class ItemUtil {
|
|||
case GlobalItemType.SpecialMonsterItem:
|
||||
case GlobalItemType.AllPowerful_DogFood:
|
||||
case GlobalItemType.MOUNT_FRAGMENTS_ITEM:
|
||||
case GlobalItemType.TRANSFORMATION_CARD:
|
||||
itemType = GlobalItemType.ITEM;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -92,6 +92,7 @@ struct CrossArenaManager{
|
|||
13:optional i32 fourSpirit;
|
||||
14:optional map<i32,i32> practiceSkillMap;//修行技能数据
|
||||
15:optional i64 maxHistoryForce;//用户历史最高战力
|
||||
16:optional list<i32> tfInfoList;//身外化身技能
|
||||
}
|
||||
|
||||
service RPCRequestIFace{
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
package config;
|
||||
|
||||
import manager.Table;
|
||||
|
||||
@Table(name ="ChangingCard")
|
||||
public class SChangingCard implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int cardId;
|
||||
|
||||
private int[][] propList;
|
||||
|
||||
private int skill;
|
||||
|
||||
private int isOpen;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getCardId() {
|
||||
return cardId;
|
||||
}
|
||||
|
||||
public int[][] getPropList() {
|
||||
return propList;
|
||||
}
|
||||
|
||||
public int getSkill() {
|
||||
return skill;
|
||||
}
|
||||
|
||||
public int getIsOpen() {
|
||||
return isOpen;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="LodeRankReward")
|
||||
public class SLodeRankReward implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int minRank;
|
||||
|
||||
private int maxRank;
|
||||
|
||||
private int[][] seasonReward;
|
||||
|
||||
private int[][] titleReward;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int getMinRank() {
|
||||
return minRank;
|
||||
}
|
||||
|
||||
public int getMaxRank() {
|
||||
return maxRank;
|
||||
}
|
||||
|
||||
public int[][] getSeasonReward() {
|
||||
return seasonReward;
|
||||
}
|
||||
|
||||
public int[][] getTitleReward() {
|
||||
return titleReward;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -122,6 +122,7 @@ public class SSpecialConfig implements BaseConfig {
|
|||
public static final String LIKE_ABILITY = "LikeAbility";//好感度功能,每日赠予礼物次数上限
|
||||
public static final String DAYS_FOR_RECHARGE_SUM = "DaysForRechargeSum";//近期累计充值金额累计时长
|
||||
public static final String DAYS_FOR_RECHARGE_SINGLE = "DaysForRechargeSingle";//近期最大单笔充值金额累计时长
|
||||
public static final String PER_CHANGING_CART_PROP = "PerChangingCartProp";//每激活一张变身卡所增加的全体属性
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package config;
|
||||
|
||||
import manager.STableManager;
|
||||
import manager.Table;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Table(name ="TrumpBook")
|
||||
public class STrumpBook implements BaseConfig {
|
||||
|
||||
private int id;
|
||||
|
||||
private int[] trumpList;
|
||||
|
||||
private int[][] skillList;
|
||||
|
||||
|
||||
@Override
|
||||
public void init() throws Exception {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public int[] getTrumpList() {
|
||||
return trumpList;
|
||||
}
|
||||
|
||||
public int[][] getSkillList() {
|
||||
return skillList;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue