Merge branch 'master_test_gn' of http://60.1.1.230/backend/jieling_server into master_test_gn

back_recharge
lvxinran 2021-04-01 13:57:43 +08:00
commit 0228b97402
15 changed files with 243 additions and 83 deletions

View File

@ -168,6 +168,11 @@ public interface BIReason {
int GOOD_LUCK_DROP = 96;//扭转乾坤获得
int ACTIVATION_HERO_FETTER = 97; //激活神将羁绊获得
int ACTIVATION_EQUIP_FETTER = 98; //激活魂印羁绊获得
int ACTIVATION_POKEMON_FETTER = 99; //激活灵兽羁绊获得
int ADVENTURE_UPLEVEL_CONSUME = 1000;//秘境升级
int SECRETBOX_CONSUME = 1001;//秘盒抽卡
int DECOMPOSE_ITEM_CONSUME = 1002;//分解道具消耗

View File

@ -79,7 +79,6 @@ public class HeroNodeGetInfoRequestHandler extends BaseHandler<Expedition.HeroNo
if (hero == null) {
throw new ErrorCodeException("招募节点英雄掉落失败");
}
// 等级
int level = HeroLogic.getInstance().getAverageLevel(user,6);
for (Integer integer:randomTid) {

View File

@ -144,6 +144,10 @@ public class GetPlayerInfoHandler extends BaseHandler{
}
//图鉴信息
Map<Integer, Integer> heroHandBook = heroManager.getHeroHandBook();
for (Map.Entry<Integer, Integer> entry:heroHandBook.entrySet()){
System.out.println(entry.getKey()+":"+entry.getValue()+"神将图鉴");
}
List<CommonProto.EveryHeroHandBook> heroHandBookList = new ArrayList<>();
heroHandBook.forEach((k,v)->heroHandBookList.add(CommonProto.EveryHeroHandBook.newBuilder().setHeroId(k).setMaxStar(v).build()));

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;
return MessageTypeProto.MessageType.ALL_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.ALL_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 = new HashSet<>();
private Equip unDetermined;
@ -81,4 +82,22 @@ public class EquipManager extends MongoBase {
return equipHandBook;
}
public Set<Integer> getEquipBookEnabled() {
return equipBookEnabled;
}
public void addEquipBookEnabled(int bookId) {
equipBookEnabled.add(bookId);
updateString("equipBookEnabled", equipBookEnabled);
}
public Set<Integer> getEquipList() {
return equipList;
}
public void addEquipList(int equipId){
equipList.add(equipId);
updateString("equipList",equipList);
}
}

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

@ -37,10 +37,7 @@ import config.*;
import manager.STableManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import rpc.protocols.CommonProto;
import rpc.protocols.HeroInfoProto;
import rpc.protocols.MapInfoProto;
import rpc.protocols.MessageTypeProto;
import rpc.protocols.*;
import util.MathUtils;
import util.StringUtil;
import util.TimeUtils;
@ -61,7 +58,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<>();
@ -1623,6 +1619,16 @@ public class HeroLogic{
return pokenSkillPassiveResult.toString();
}
//图鉴属性加成
public void bonuses(Set<Integer> bookEnabled,Map<Integer, Long> heroAllAttribute){
if (!bookEnabled.isEmpty()){
Map<Integer, SSpiritAnimalBook> config = STableManager.getConfig(SSpiritAnimalBook.class);
for(int bootId:bookEnabled){
int[][] activePara = config.get(bootId).getActivePara();
combinedAttribute(activePara,heroAllAttribute);
}
}
}
public Map<Integer,Long> calHeroNotBufferAttribute(User user, Hero hero,boolean isForce,int teamId){
Map<Integer, Long> heroAllAttribute = calHeroAllAttribute(user, hero,isForce);
heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(),heroAllAttribute.get(GlobalsDef.HP_TYPE));
@ -1630,6 +1636,9 @@ public class HeroLogic{
Map<String, PropertyItem> equipMap = hero.getCreateType()==1?user.getExpeditionManager().getEquipMap():user.getEquipManager().getEquipMap();
PokemonManager pokemonManager = user.getPokemonManager();
HeroManager heroManager=user.getHeroManager();
EquipManager equipManager=user.getEquipManager();
SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId());
if(teamId!=0){
int heroNum = user.getTeamPosManager().getTeamPosForHero().get(teamId).size();
@ -1644,13 +1653,13 @@ public class HeroLogic{
}
//灵兽图鉴加成
Set<Integer> pokemonBookEnabled = pokemonManager.getPokemonBookEnabled();
if(!pokemonBookEnabled.isEmpty()){
Map<Integer, SSpiritAnimalBook> config = STableManager.getConfig(SSpiritAnimalBook.class);
for(int bootId:pokemonBookEnabled){
int[][] activePara = config.get(bootId).getActivePara();
combinedAttribute(activePara,heroAllAttribute);
}
}
bonuses(pokemonBookEnabled,heroAllAttribute);
//神将羁绊加成
Set<Integer> heroBookEnabled = heroManager.getHeroHandBookEnabled();
bonuses(heroBookEnabled,heroAllAttribute);
//魂印图鉴加成
Set<Integer> equipBookEnabled = equipManager.getEquipBookEnabled();
bonuses(equipBookEnabled,heroAllAttribute);
//英雄皮肤加成 记得判断皮肤过期
int skin = hero.getSkin();
if(skin!=0){
@ -3094,7 +3103,116 @@ 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 (Integer equip:equipManager.getEquipList()) {
builder.addEquipGot(equip);
}
System.out.println(builder.getAllBookEnabledList()+"羁绊");
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);
}
System.out.println(user.getPlayerInfoManager().getLevel()+":"+bookConfig.getOpenLevel());
if(user.getPlayerInfoManager().getLevel()<bookConfig.getOpenLevel()){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
int[] teamers = bookConfig.getTeamers();
int[][] reward = bookConfig.getReward();
CommonProto.Drop.Builder drop = null;
//神将激活
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)){
System.out.println(tmp);
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
}
//将羁绊加入神将羁绊集合
heroManager.addHeroHandBookEnabled(bookId);
drop = ItemUtil.drop(user,reward , BIReason.ACTIVATION_HERO_FETTER);
}
//魂印激活
if(bookConfig.getFetterType()==2){
EquipManager equipManager = user.getEquipManager();
if(equipManager.getEquipBookEnabled().contains(bookId)){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
for (int equip:teamers){
if (!equipManager.getEquipList().contains(equip)){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
}
equipManager.addEquipBookEnabled(bookId);
drop = ItemUtil.drop(user,reward , BIReason.ACTIVATION_HERO_FETTER);
}
//灵兽激活
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);
drop = ItemUtil.drop(user,reward , BIReason.ACTIVATION_HERO_FETTER);
}
PlayerInfoProto.UseAndPriceItemResponse.Builder useAndPriceItemResponse = PlayerInfoProto.UseAndPriceItemResponse.newBuilder();
if (drop != null) {
useAndPriceItemResponse.setDrop(drop);
}
Poster.getPoster().dispatchEvent(new UserMainTeamForceEvent(session.getUid()));
MessageUtil.sendMessage(session,1,messageType.getNumber(),useAndPriceItemResponse.build(),true);
}
/**
*
* @param iSession
@ -3138,8 +3256,7 @@ public class HeroLogic{
teamPokemonInfos.add(teamPokemonInfo);
}
builder.addAllTeamPokemonInfos(teamPokemonInfos)
.addAllPokemonGot(pokemonManager.getPokemonGot())
.addAllPokemonBookEnabled(pokemonManager.getPokemonBookEnabled());
.addAllPokemonGot(pokemonManager.getPokemonGot());
}
MessageUtil.sendMessage(iSession,1,MessageTypeProto.MessageType.GET_ALL_POKEMON_RESPONSE_VALUE,builder.build(),true);
}
@ -3521,38 +3638,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

@ -141,6 +141,7 @@ public class ItemLogic {
int msgId = MessageTypeProto.MessageType.USER_AND_PRICE_ITEM_RESPONSE_VALUE;
int uid = iSession.getUid();
User user = UserManager.getUser(uid);
EquipManager equipManager=user.getEquipManager();
if (itemList.size() == 0) {
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}

View File

@ -568,6 +568,7 @@ public class ItemUtil {
if (itemMap.isEmpty()) {
return;
}
EquipManager equipManager=user.getEquipManager();
List<CommonProto.Item> itemProtoList = new CopyOnWriteArrayList<>();
ItemManager itemManager = user.getItemManager();
List<CommonProto.Item> sendToFront = new CopyOnWriteArrayList<>();
@ -575,6 +576,12 @@ public class ItemUtil {
Map<Integer,Integer> extraItem = new HashMap<>(itemMap.size());
for (Map.Entry<Integer, Long> entry : itemMap.entrySet()) {
SItem itemConfig = STableManager.getConfig(SItem.class).get(entry.getKey());
if (itemConfig.getItemBaseType()==6){
equipManager.addEquipList(entry.getKey());
System.out.println(entry.getKey() + "魂印id");
}
SItem sItem = SItem.getsItemMap().get (entry.getKey());
long itemNumlimit = sItem.getItemNumlimit();
long itemNum = entry.getValue().intValue();

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;
}
}