Merge branch 'dev_dh_tree' into master_test_hw_four_challenge

# Conflicts:
#	luafight/Modules/Battle/Logic/Base/Passivity.lua
#	luafight/Modules/Battle/Logic/Misc/BattleUtil.lua
#	luafight/Modules/Battle/Logic/Role/RoleLogic.lua
#	serverlogic/src/main/java/com/ljsd/jieling/core/FunctionIdEnum.java
#	serverlogic/src/main/java/com/ljsd/jieling/globals/BIReason.java
#	serverlogic/src/main/java/com/ljsd/jieling/logic/dao/PlayerManager.java
back_recharge
duhui 2021-01-26 11:26:56 +08:00
commit ca1b4f3fa8
14 changed files with 288 additions and 6 deletions

View File

@ -64,7 +64,8 @@ public enum FunctionIdEnum {
Car_Delay(73,new CarDelayFunction()),
Situation_challenge(74,null),
Multiple_Arena(82,null),
Four_Challenge(83,null,MessageTypeProto.MessageType.FOUR_CHALLENGE_DO_REQUEST_VALUE)
Four_Challenge(83,null,MessageTypeProto.MessageType.FOUR_CHALLENGE_DO_REQUEST_VALUE),
GodTree(84,null),
;
private int functionType;

View File

@ -303,4 +303,5 @@ public interface BIReason {
int SUB_ACTIVITY_CONSUME_FINISH = 1075;//易经宝库活动结束补发消耗
int NEW_GENERAL_ATTACK = 1076;//新将来袭
int UPGRADE_GOD_TREE = 1086;// 升级神树
}

View File

@ -0,0 +1,74 @@
package com.ljsd.jieling.handler.activity;
import com.google.protobuf.GeneratedMessage;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.activity.event.UserMainTeamForceEvent;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.item.ItemLogic;
import com.ljsd.jieling.protocols.ActivityProto;
import com.ljsd.jieling.protocols.MessageTypeProto;
import com.ljsd.jieling.util.ItemUtil;
import config.SGodHoodTreeLevel;
import manager.STableManager;
import org.springframework.stereotype.Component;
/***
*
* @author hj
* @date 2020-12-14
*/
@Component
public class UpgradeGodTreeHandler extends BaseHandler<ActivityProto.UpgradeGodTreeRequest> {
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.UpgradeGodTreeRequest;
}
@Override
public GeneratedMessage processWithProto(int uid, ActivityProto.UpgradeGodTreeRequest proto) throws Exception {
// 用户信息
User user = UserManager.getUser(uid);
if (user == null) {
throw new ErrorCodeException(ErrorCode.UNKNOWN);
}
// 神树是否开启
boolean ifOpenGodTree = ItemLogic.getInstance().ifOpenGodTree(user);
if (!ifOpenGodTree){
throw new ErrorCodeException(ErrorCode.PLAYER_LEVE_NOT);
}
int treeLevel = user.getPlayerInfoManager().getTreeLevel();
// 读取升级配置表
SGodHoodTreeLevel sGodHoodTreeLevel = STableManager.getConfig(SGodHoodTreeLevel.class).get(treeLevel);
// 等级不存在或已满级
if (sGodHoodTreeLevel == null || sGodHoodTreeLevel.getLvupCost().length <= 0){
throw new ErrorCodeException(ErrorCode.HAS_AWAKE);
}
int[][] items = new int[1][];
items[0] = new int[]{sGodHoodTreeLevel.getLvupCost()[0],sGodHoodTreeLevel.getLvupCost()[1]};
// 消耗道具
boolean cost = ItemUtil.itemCost(user, items, BIReason.UPGRADE_GOD_TREE, 1);
if (!cost){
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
// 神树升级
user.getPlayerInfoManager().addTreeLevel(1);
// 阵容战力改变
Poster.getPoster().dispatchEvent(new UserMainTeamForceEvent(uid));
return ActivityProto.UpgradeGodTreeResponse.newBuilder().build();
}
}

View File

@ -2,9 +2,12 @@ package com.ljsd.jieling.logic.dao;
import com.ljsd.common.mogodb.MongoBase;
import com.ljsd.jieling.core.FunctionIdEnum;
import com.ljsd.jieling.core.HandlerLogicThread;
import com.ljsd.jieling.core.VipPrivilegeType;
import com.ljsd.jieling.globals.Global;
import com.ljsd.jieling.logic.dao.root.User;
import config.SGlobalSystemConfig;
import config.SMonthcardConfig;
import config.SPrivilegeTypeConfig;
import manager.STableManager;
@ -123,6 +126,7 @@ public class PlayerManager extends MongoBase {
private int sheJiOpenTime;
private int treeLevel;
private Map<Integer,Integer> situationPass = new HashMap<>();
@ -841,7 +845,22 @@ public class PlayerManager extends MongoBase {
public void setFourChallengeRemainTimes(int index,int value) {
fourChallengeRemainTimes[index] = value;
updateString("fourChallengeRemainTimes",fourChallengeRemainTimes);
updateString("fourChallengeRemainTimes", fourChallengeRemainTimes);
}
public int getTreeLevel(){
return treeLevel;
}
public void setTreeLevel(int treeLevel) {
this.treeLevel = treeLevel;
updateString("treeLevel",treeLevel);
}
public void addTreeLevel(int level){
this.treeLevel += level;
updateString("treeLevel",treeLevel);
}
}

View File

@ -11,6 +11,8 @@ import java.util.*;
public class TeamPosManager extends MongoBase {
private Map<Integer, List<TeamPosHeroInfo>> teamPosForHero;
// 编队--树神
private Map<Integer, List<TeamPosHeroInfo>> teamPosForTree;
private Map<Integer,String> teamNames;
@Transient
private int curTeamPosId;
@ -24,6 +26,7 @@ public class TeamPosManager extends MongoBase {
teamNames = new HashMap<>(3);
teamPosForHero = new HashMap<>(3);
teamPosForTree = new HashMap<>(5);
}
public void changeName(int teamId,String teamName) throws Exception {
@ -40,7 +43,23 @@ public class TeamPosManager extends MongoBase {
teamPosForHero.put(teamId,teamPosHeroInfoList);
updateString("teamPosForHero",teamPosForHero);
cacheTeamPro.remove(teamId);
}
/**
*
* @param teamId
* @param heroIds
* @throws Exception
*/
public void changeTreeTeamInfo(int teamId, List<CommonProto.TeamHeroInfo> heroIds) throws Exception {
List<TeamPosHeroInfo> teamPosHeroInfoList = new ArrayList<>(6);
for(CommonProto.TeamHeroInfo teamHeroInfo : heroIds){
TeamPosHeroInfo teamPosHeroInfo = new TeamPosHeroInfo(teamHeroInfo.getHeroId(), teamHeroInfo.getPosition());
teamPosHeroInfoList.add(teamPosHeroInfo);
}
teamPosForTree.put(teamId,teamPosHeroInfoList);
updateString("teamPosForTree",teamPosForTree);
cacheTeamPro.remove(teamId);
}
public void addTeamOfInitPlayer(Collection<Hero> heros) throws Exception {
@ -60,6 +79,23 @@ public class TeamPosManager extends MongoBase {
updateString("teamPosForHero",teamPosForHero);
}
public void addTreeTeamOfInitPlayer(Collection<Hero> heros) throws Exception {
List<TeamPosHeroInfo> teamPosHeroInfoList = new ArrayList<>(6);
int position =1;
for(Hero hero : heros){
if(position>5){
break;
}
TeamPosHeroInfo teamPosHeroInfo = new TeamPosHeroInfo(hero.getId(), position++);
teamPosHeroInfoList.add(teamPosHeroInfo);
}
teamPosForTree.put(0,new ArrayList<>(1));
teamPosForTree.put(1,new ArrayList<>(1));
teamPosForTree.put(2,new ArrayList<>(1));
teamPosForTree.put(3,new ArrayList<>(1));
teamPosForTree.put(4,new ArrayList<>(1));
updateString("teamPosForTree",teamPosForTree);
}
public Map<Integer, String> getTeamNames() {
return teamNames;

View File

@ -127,6 +127,7 @@ public class UserManager {
SPlayerLevelConfig sPlayerLevelConfig = SPlayerLevelConfig.getsPlayerLevelConfigMap().get(1);
playerManager.setMaxStamina(sPlayerLevelConfig.getMaxEnergy());
playerManager.setRideLevel(1);
playerManager.setTreeLevel(0);
PlayerLogic.getInstance().vipflushEveryDay(user,null);
ActivityLogic.getInstance().newPlayerOpenActivityMission(user);
PlayerLogic.getInstance().playerInfoUpdate(user);

View File

@ -1664,9 +1664,12 @@ public class HeroLogic{
continue;
Jewel j = (Jewel)propertyItem;
SJewelConfig config = STableManager.getConfig(SJewelConfig.class).get(j.getEquipId());
// 进阶
Map<Integer, Map<Integer, SJewelRankupConfig>> rankPoolMap = SJewelRankupConfig.rankupMap.get(config.getRankupPool());
// 升级
Map<Integer, Map<Integer, SJewelRankupConfig>> levelPoolMap = SJewelRankupConfig.rankupMap.get(config.getLevelupPool());
// 神应/神树
Map<Integer, Map<Integer, SJewelRankupConfig>> godTreePoolMap = SJewelRankupConfig.rankupMap.get(config.getGodHoodPool());
if(flashing){
if(minLevel==-1){
@ -1689,6 +1692,17 @@ public class HeroLogic{
property = rankPoolMap.get(2).get(j.getBuildLevel()).getProperty();
combinedAttribute(property,heroAllAttribute);
}
if (godTreePoolMap != null){
// 验证神树是否开启
boolean openGodTree = ItemLogic.getInstance().ifOpenGodTree(user);
if (openGodTree) {
// 获取神应等级
int level = user.getPlayerInfoManager().getTreeLevel() >= config.getGodHoodMaxlv() ? config.getGodHoodMaxlv() : user.getPlayerInfoManager().getTreeLevel();
// 获取加成属性
property = ItemLogic.getInstance().godTreeAdditon(user, godTreePoolMap, level);
combinedAttribute(property, heroAllAttribute);
}
}
}
//宝器共鸣
if(flashing){

View File

@ -3,6 +3,8 @@ package com.ljsd.jieling.logic.item;
import com.ljsd.jieling.chat.logic.ChatLogic;
import com.ljsd.jieling.config.clazzStaticCfg.CommonStaticConfig;
import com.ljsd.jieling.config.clazzStaticCfg.HeroStaticConfig;
import com.ljsd.jieling.core.FunctionIdEnum;
import com.ljsd.jieling.core.HandlerLogicThread;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.globals.BIReason;
@ -326,8 +328,9 @@ public class ItemLogic {
StringBuilder reward = new StringBuilder();
StringBuilder reportIdLevelQuality = new StringBuilder();
for (String jewelId : jewelList) {
if (!equipMap.containsKey(jewelId))
if (!equipMap.containsKey(jewelId)) {
throw new ErrorCodeException(ErrorCode.ITEM_DECOMPOSE_NO_EQUIP);
}
PropertyItem propertyItem = equipMap.get(jewelId);
if (!StringUtil.isEmpty(propertyItem.getHeroId())&&user.getHeroManager().getHero(propertyItem.getHeroId())!=null)
throw new ErrorCodeException(ErrorCode.ITEM_DECOMPOSE_SOULE_CANT);
@ -878,4 +881,60 @@ public class ItemLogic {
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.JEWEL_BUILD_RESPONSE_VALUE, null, true);
}
/**
*
* @param user
* @return
*/
public boolean ifOpenGodTree(User user){
SGlobalSystemConfig sGlobalSystemConfig = STableManager.getConfig(SGlobalSystemConfig.class).get(FunctionIdEnum.GodTree.getFunctionType());
return HandlerLogicThread.checkOpen(user, sGlobalSystemConfig);
}
/**
*
* @param user
* @param godTreePoolMap
* @param level
* @return
*/
public int[][] godTreeAdditon(User user, Map<Integer, Map<Integer, SJewelRankupConfig>> godTreePoolMap,int level){
//人族层数
int people = 10;
//妖族层数
int monster = 0;
//佛教层数
int monk = 0;
//道教层数
int mage = 0;
// 总层数
int count = people + monster + monk + mage;
// 解锁条数
int tier = 0;
// 读取配置表,获取属性值
SGodHoodTreeSetting sGodHoodTreeSetting = STableManager.getConfig(SGodHoodTreeSetting.class).get(0);
int[][] unlcokLevels = sGodHoodTreeSetting.getPropertyUnlcokLevels();
// 循环属性,总层数大于等于则赋值,小于直接返回
for (int i = 0; i < unlcokLevels.length; i++) {
if (count >= unlcokLevels[i][1]){
tier = unlcokLevels[i][0];
}else {
break;
}
}
// 读取配置表获取属性
int[][] property = godTreePoolMap.get(3).get(level).getProperty();
// 初始化数组,长度为上面循环获得
int[][] result = new int[tier][2];
// 两层循环,根据解锁的条数重新赋值到新的二维数组
for (int i = 0; i < tier; i++) {
for (int j = 0; j < property[i].length; j++) {
result[i][j] = property[i][j];
}
}
// 返回
return result;
}
}

View File

@ -691,7 +691,7 @@ public class PlayerLogic {
EquipManager equipManager = userInMem.getEquipManager();
Map<String, PropertyItem> equipMap = equipManager.getEquipMap();
for(String equipId : hero.getJewelInfo()){
builder.addEquip(CBean2Proto.getEquipProto(equipMap.get(equipId)));
builder.addEquip(CBean2Proto.getEquipProto(equipMap.get(equipId)).toBuilder().setTreeLv(userInMem.getPlayerInfoManager().getTreeLevel()));
}
for(int equipId : hero.getEquipByPositionMap().values()){
builder.addEquip(CBean2Proto.getEquipProto(equipId));

View File

@ -50,6 +50,7 @@ public class CBean2Proto {
.setRide(playerManager.getRide())
.setRideLevel(playerManager.getRideLevel())
.setSex(playerManager.getSex())
.setTreeLevel(playerManager.getTreeLevel())
.setDecrotion(playerManager.getDecoration());
String mathcInfo = RedisUtil.getInstence().getObject(RedisKey.MATCH_UID_KEY + ":" + uid, String.class);
if(!StringUtil.isEmpty(mathcInfo)){

View File

@ -0,0 +1,31 @@
package config;
import manager.STableManager;
import manager.Table;
import java.util.Map;
@Table(name ="GodHoodTreeLevel")
public class SGodHoodTreeLevel implements BaseConfig {
private int id;
private int[] lvupCost;
@Override
public void init() throws Exception {
}
public int getId() {
return id;
}
public int[] getLvupCost() {
return lvupCost;
}
}

View File

@ -0,0 +1,31 @@
package config;
import manager.STableManager;
import manager.Table;
import java.util.Map;
@Table(name ="GodHoodTreeSetting")
public class SGodHoodTreeSetting implements BaseConfig {
private int id;
private int[][] propertyUnlcokLevels;
@Override
public void init() throws Exception {
}
public int getId() {
return id;
}
public int[][] getPropertyUnlcokLevels() {
return propertyUnlcokLevels;
}
}

View File

@ -24,6 +24,9 @@ public class SJewelConfig implements BaseConfig {
private int[][] rankupResources;
private int godHoodPool;
private int godHoodMaxlv;
@Override
public void init() throws Exception {
@ -67,5 +70,11 @@ public class SJewelConfig implements BaseConfig {
return rankupResources;
}
public int getGodHoodPool() {
return godHoodPool;
}
public int getGodHoodMaxlv() {
return godHoodMaxlv;
}
}

View File

@ -23,6 +23,11 @@ public class SJewelRankupConfig implements BaseConfig {
private int[][] upExpend;
/**
* poolId,map
* type,map
* levelSJewelRankupConfig
*/
public static Map<Integer,Map<Integer,Map<Integer,SJewelRankupConfig>>> rankupMap = new HashMap<>();
@Override