羁绊激活

back_recharge
whb 2021-03-19 18:41:28 +08:00
parent cfd88aa051
commit 61ffca630c
11 changed files with 178 additions and 72 deletions

View File

@ -88,8 +88,8 @@ public class HeroNodeGetInfoRequestHandler extends BaseHandler<Expedition.HeroNo
if (hero == null) {
throw new ErrorCodeException("招募节点英雄掉落失败");
}
HeroLogic herolevel =new HeroLogic();
int level = herolevel.getAverageLevel(user,6);
int level = HeroLogic.getInstance().getAverageLevel(user,6);
int star = STableManager.getConfig(SRobotProperty.class).get(level).getStar();
for (Integer integer:randomTid) {
SExpeditionRecruitConfig sExpeditionRecruitConfig = STableManager.getConfig(SExpeditionRecruitConfig.class).get(integer);

View File

@ -13,14 +13,14 @@ import org.springframework.stereotype.Component;
* @discribe
*/
@Component
public class PokemonBookEnableHandler extends BaseHandler<HeroInfoProto.PokemonBookEnableRequest> {
public class AllBookEnableHandler extends BaseHandler<HeroInfoProto.AllBookEnableRequest> {
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.POKEMON_BOOK_ENABLE_REQUEST;
}
@Override
public void processWithProto(ISession iSession, HeroInfoProto.PokemonBookEnableRequest proto) throws Exception {
HeroLogic.getInstance().pokemonBookEnable(iSession,proto.getBookId(),MessageTypeProto.MessageType.POKEMON_BOOK_ENABLE_REPONSE);
public void processWithProto(ISession iSession, HeroInfoProto.AllBookEnableRequest proto) throws Exception {
HeroLogic.getInstance().AllBookEnable(iSession,proto.getBookId(),MessageTypeProto.MessageType.POKEMON_BOOK_ENABLE_REPONSE);
}
}

View File

@ -0,0 +1,24 @@
package com.ljsd.jieling.handler.pokemon;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.netty.cocdex.PacketNetData;
import com.ljsd.jieling.network.session.ISession;
import rpc.protocols.MessageTypeProto;
/**
* Description: des
* Author: zsx
* CreateDate: 2021/3/19 16:40
*/
public class GetAllPropertyInfoHandler extends BaseHandler {
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.GET_ALL_PROPERTY_INFO_REQUEST;
}
@Override
public void process(ISession iSession, PacketNetData netData) throws Exception {
HeroLogic.getInstance().allBookFetter(iSession,MessageTypeProto.MessageType.GET_ALL_PROPERTY_INFO_RESPONSE);
}
}

View File

@ -1,18 +1,19 @@
package com.ljsd.jieling.logic.dao;
import com.ljsd.common.mogodb.MongoBase;
import com.ljsd.jieling.logic.activity.event.EquipEvent;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.mission.GameEvent;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
public class EquipManager extends MongoBase {
private Map<String,PropertyItem> equipMap;
private Set<Integer> equipBookEnabled = new HashSet<>();
private Set<Integer> equipList;
private Equip unDetermined;
@ -81,4 +82,15 @@ public class EquipManager extends MongoBase {
return equipHandBook;
}
public Set<Integer> getEquipBookEnabled() {
return equipBookEnabled;
}
public void addEquipBookEnabled(int bookId) {
equipBookEnabled.add(bookId);
updateString("equipBookEnabled", equipBookEnabled);
}
}

View File

@ -6,9 +6,11 @@ import com.ljsd.jieling.logic.activity.event.RemoveHeroEvent;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.hero.HongMengAttributeEnum;
import config.SSpecialConfig;
import org.luaj.vm2.ast.Str;
import java.util.*;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
public class HeroManager extends MongoBase {
@ -21,6 +23,7 @@ public class HeroManager extends MongoBase {
private Map<Integer,Integer> mustRandomCount= new HashMap<>();
private Map<Integer,Integer> heroHandBook = new HashMap<>();
private Set<Integer> heroHandBookEnabled = new HashSet<>();
private Map<Integer,Integer> skinInfo = new HashMap<>();
@ -240,5 +243,15 @@ public class HeroManager extends MongoBase {
}
}
public Set<Integer> getHeroHandBookEnabled() {
return heroHandBookEnabled;
}
public void addHeroHandBookEnabled(int bookId) {
heroHandBookEnabled.add(bookId);
updateString("heroHandBookEnabled", heroHandBookEnabled);
}
}

View File

@ -1,13 +1,9 @@
package com.ljsd.jieling.logic.dao;
import com.ljsd.common.mogodb.MongoBase;
import com.ljsd.jieling.db.mongo.MongoKey;
import com.ljsd.jieling.globals.Global;
import com.ljsd.jieling.logic.dao.root.User;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
public class ItemManager extends MongoBase {

View File

@ -1,7 +1,6 @@
package com.ljsd.jieling.logic.dao;
import com.ljsd.common.mogodb.MongoBase;
import com.ljsd.jieling.db.mongo.MongoKey;
import com.ljsd.jieling.logic.dao.root.User;
import java.util.HashMap;

View File

@ -1,50 +1,40 @@
package com.ljsd.jieling.logic.expedition;
import com.ljsd.fight.FamilyHeroInfo;
import com.ljsd.jieling.config.clazzStaticCfg.*;
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
import com.ljsd.jieling.config.clazzStaticCfg.PlayStaticConfig;
import com.ljsd.jieling.config.clazzStaticCfg.WorldBossTreasureStaticConfig;
import com.ljsd.jieling.core.FunctionIdEnum;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.core.HandlerLogicThread;
import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.globals.Global;
import com.ljsd.jieling.handler.map.behavior.BehaviorUtil;
import com.ljsd.jieling.logic.GlobalDataManaager;
import com.ljsd.jieling.logic.OnlineUserManager;
import com.ljsd.jieling.logic.blood.BloodLogic;
import com.ljsd.jieling.logic.dao.*;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.fight.FightUtil;
import com.ljsd.jieling.logic.fight.robot.RobotInfo;
import com.ljsd.jieling.logic.fight.specialparm.SpecialForTeamBuildEnum;
import com.ljsd.jieling.logic.hero.HeroAttributeEnum;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.mail.MailLogic;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.rank.RankContext;
import com.ljsd.jieling.logic.rank.RankEnum;
import com.ljsd.jieling.logic.rank.RankLogic;
import com.ljsd.jieling.logic.rank.rankImpl.AbstractRank;
import com.ljsd.jieling.logic.store.BuyGoodsLogic;
import com.ljsd.jieling.logic.store.StoreLogic;
import com.ljsd.jieling.network.session.ISession;
import rpc.protocols.CommonProto;
import rpc.protocols.Expedition;
import rpc.protocols.MessageTypeProto;
import com.ljsd.jieling.util.*;
import com.ljsd.jieling.util.ItemUtil;
import com.ljsd.jieling.util.MessageUtil;
import com.ljsd.jieling.util.MonsterUtil;
import config.*;
import manager.STableManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.redis.core.ZSetOperations;
import rpc.protocols.PlayerInfoProto;
import rpc.protocols.CommonProto;
import rpc.protocols.Expedition;
import rpc.protocols.MessageTypeProto;
import util.MathUtils;
import util.StringUtil;
import util.TimeUtils;
import java.rmi.server.UID;
import java.util.*;
import java.util.stream.Collectors;

View File

@ -60,7 +60,6 @@ public class HeroLogic{
Poster.getPoster().listenEvent(new LeveGiftEventHander(), UserLevelEvent.class);
}
public static List<Integer> transTemplate = new ArrayList<>();
public static List<Integer> equipSkillPositionTemaplge = new ArrayList<>(6);
private static Map<Integer,List<Integer>> transTemplateByHeroPropertyName = new HashMap<>();
@ -3074,7 +3073,94 @@ public class HeroLogic{
}
//============= 灵兽(异妖)系统 ========================
public void allBookFetter(ISession session,MessageTypeProto.MessageType messageType) throws Exception {
int uid = session.getUid();
User user = UserManager.getUser(uid);
EquipManager equipManager = user.getEquipManager();
Map<Integer, Integer> equipHandBook = equipManager.getEquipHandBook();
HeroInfoProto.GetAllPropertyInfoResponse.Builder builder = HeroInfoProto.GetAllPropertyInfoResponse.newBuilder();
//添加灵兽羁绊
for(int enabled:user.getPokemonManager().getPokemonBookEnabled()){
builder.addAllBookEnabled(enabled);
}
//添加英雄羁绊
for (int enabled:user.getHeroManager().getHeroHandBookEnabled()){
builder.addAllBookEnabled(enabled);
}
//添加魂印羁绊
for (int enabled:user.getEquipManager().getEquipBookEnabled()){
builder.addAllBookEnabled(enabled);
}
for (Map.Entry<Integer, Integer> entry:equipHandBook.entrySet()){
if (entry.getValue()!=0){
builder.addEquipGot(entry.getKey());
}
}
MessageUtil.sendMessage(session,1,MessageTypeProto.MessageType.GET_ALL_PROPERTY_INFO_RESPONSE_VALUE,builder.build(),true);
}
/**
*
* @param session
* @param bookId
* @param messageType
*/
public void AllBookEnable(ISession session, int bookId, MessageTypeProto.MessageType messageType) throws Exception {
int uid = session.getUid();
User user = UserManager.getUser(uid);
SSpiritAnimalBook bookConfig = STableManager.getConfig(SSpiritAnimalBook.class).get(bookId);
if(bookConfig==null){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
if(user.getPlayerInfoManager().getLevel()<bookConfig.getOpenLevel()){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
int[] teamers = bookConfig.getTeamers();
//神将激活
if (bookConfig.getFetterType()==1){
HeroManager heroManager=user.getHeroManager();
if (heroManager.getHeroHandBookEnabled().contains(bookId)){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
Map<Integer, Integer> heroHandBook = heroManager.getHeroHandBook();
Set<Integer> hero=new HashSet<>();
//将拥有的神将放到set集和中
for(Map.Entry<Integer, Integer> entry:heroHandBook.entrySet()){
if (entry.getValue()!=0){
hero.add(entry.getKey());
}
}
//判断羁绊神将是否在集合
for(int tmp:teamers){
if(!hero.contains(tmp)){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
}
//将羁绊加入神将羁绊集合
heroManager.addHeroHandBookEnabled(bookId);
}
//魂印激活
if(bookConfig.getFetterType()==2){
}
//灵兽激活
if(bookConfig.getFetterType()==3){
PokemonManager pokemonManager = user.getPokemonManager();
if(pokemonManager.getPokemonBookEnabled().contains(bookId)){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
for(int pokemon:teamers){
if(!pokemonManager.getPokemonGot().contains(pokemon)){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
}
pokemonManager.addPokemonBookEnabled(bookId);
}
Poster.getPoster().dispatchEvent(new UserMainTeamForceEvent(session.getUid()));
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
}
/**
*
* @param iSession
@ -3118,8 +3204,8 @@ public class HeroLogic{
teamPokemonInfos.add(teamPokemonInfo);
}
builder.addAllTeamPokemonInfos(teamPokemonInfos)
.addAllPokemonGot(pokemonManager.getPokemonGot())
.addAllPokemonBookEnabled(pokemonManager.getPokemonBookEnabled());
.addAllPokemonGot(pokemonManager.getPokemonGot());
/*.addAllPokemonBookEnabled(pokemonManager.getPokemonBookEnabled());*/
}
MessageUtil.sendMessage(iSession,1,MessageTypeProto.MessageType.GET_ALL_POKEMON_RESPONSE_VALUE,builder.build(),true);
}
@ -3501,38 +3587,6 @@ public class HeroLogic{
}
/**
*
* @param session
* @param bookId
* @param messageType
*/
public void pokemonBookEnable(ISession session, int bookId, MessageTypeProto.MessageType messageType) throws Exception {
int uid = session.getUid();
User user = UserManager.getUser(uid);
PokemonManager pokemonManager = user.getPokemonManager();
if(pokemonManager.getPokemonBookEnabled().contains(bookId)){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
SSpiritAnimalBook bookConfig = STableManager.getConfig(SSpiritAnimalBook.class).get(bookId);
if(bookConfig==null){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
int[] teamers = bookConfig.getTeamers();
for(int pokemon:teamers){
if(!pokemonManager.getPokemonGot().contains(pokemon)){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
}
pokemonManager.addPokemonBookEnabled(bookId);
Poster.getPoster().dispatchEvent(new UserMainTeamForceEvent(session.getUid()));
MessageUtil.sendMessage(session,1,messageType.getNumber(),null,true);
}
/**
*

View File

@ -1,5 +1,5 @@
#server info
server.id = 10153
server.id = 10161
server.openTime = 20190101000101
server.num = 1
server.debug = true
@ -33,7 +33,7 @@ spring.redis.expireTime = -1
#spring.data.mongodb.uri = mongodb://mongouser:ysj#2017#ljsd@111.231.54.96:27017/ysj_wx_1
#spring.data.mongodb2.uri = mongodb://mongouser:ysj#2017#ljsd@111.231.54.96:27017/develop_ysj_wx_1
#mongodb2 develop
spring.data.mongodb.uri = mongodb://60.1.1.14:27017/jieling_10153
spring.data.mongodb.uri = mongodb://60.1.1.14:27017/jieling_10161
spring.data.mongodbcore.uri = mongodb://60.1.1.14:27017/jl_core
#spring.data.mongodb.uri = mongodb://60.1.1.14:27017/jieling_10212
mongodb.options.maxWaitTime = 120000
@ -62,7 +62,7 @@ netty.allTimeout=35
#core
services.core.ip=60.1.1.153
services.core.ip=60.1.1.161
services.core.port=7900
services.core.area=1000
services.core.id=1

View File

@ -16,6 +16,12 @@ public class SSpiritAnimalBook implements BaseConfig {
private int activeForce;
private int fetterType;
private int[][] reward;
private int openLevel;
@Override
public void init() throws Exception {
@ -39,5 +45,17 @@ public class SSpiritAnimalBook implements BaseConfig {
return activeForce;
}
public int getFetterType() {
return fetterType;
}
public int[][] getReward() {
return reward;
}
public int getOpenLevel() {
return openLevel;
}
}