back_recharge
whb 2021-03-25 16:05:35 +08:00
parent 61ffca630c
commit 7c14f87a04
7 changed files with 78 additions and 23 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

@ -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

@ -16,11 +16,11 @@ import org.springframework.stereotype.Component;
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.AllBookEnableRequest proto) throws Exception {
HeroLogic.getInstance().AllBookEnable(iSession,proto.getBookId(),MessageTypeProto.MessageType.POKEMON_BOOK_ENABLE_REPONSE);
HeroLogic.getInstance().AllBookEnable(iSession,proto.getBookId(),MessageTypeProto.MessageType.ALL_BOOK_ENABLE_REPONSE);
}
}

View File

@ -13,7 +13,7 @@ public class EquipManager extends MongoBase {
private Map<String,PropertyItem> equipMap;
private Set<Integer> equipBookEnabled = new HashSet<>();
private Set<Integer> equipList;
private Set<Integer> equipList = new HashSet<>();
private Equip unDetermined;
@ -93,4 +93,11 @@ public class EquipManager extends MongoBase {
}
public Set<Integer> getEquipList() {
return equipList;
}
public void addEquipList(int equipId){
equipList.add(equipId);
updateString("equipList",equipList);
}
}

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;
@ -1614,6 +1611,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));
@ -1621,6 +1628,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();
@ -1635,13 +1645,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){
@ -3087,17 +3097,17 @@ public class HeroLogic{
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);
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);
}
/**
*
@ -3112,10 +3122,13 @@ public class HeroLogic{
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();
@ -3133,14 +3146,28 @@ public class HeroLogic{
//判断羁绊神将是否在集合
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);
}
//灵兽激活
@ -3155,10 +3182,15 @@ public class HeroLogic{
}
}
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(),null,true);
MessageUtil.sendMessage(session,1,messageType.getNumber(),useAndPriceItemResponse.build(),true);
}
/**
@ -3205,7 +3237,6 @@ public class HeroLogic{
}
builder.addAllTeamPokemonInfos(teamPokemonInfos)
.addAllPokemonGot(pokemonManager.getPokemonGot());
/*.addAllPokemonBookEnabled(pokemonManager.getPokemonBookEnabled());*/
}
MessageUtil.sendMessage(iSession,1,MessageTypeProto.MessageType.GET_ALL_POKEMON_RESPONSE_VALUE,builder.build(),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();