增加主角成神系统

master_yuenan
DESKTOP-C3M45P4\dengdan 2025-12-24 23:04:23 +08:00
parent d455e89f33
commit 31fac9d662
27 changed files with 864 additions and 29 deletions

View File

@ -81,6 +81,7 @@ public enum FunctionIdEnum {
GemNewAdvanced(145, null),//命格新-高级
Assist(152,null),//助阵
WeekGood(9091,null),
PlayerGodTowerChallenge(159,null),//主角神塔(三队)
;
private int functionType;

View File

@ -35,6 +35,8 @@ public interface VipPrivilegeType {
int DUODUI_TWO_BUY = 43;//双队探索每日购买次数提升至%s
int DUODUI_THREE_FREE = 40;//三队探索每日免费次数提升至%s
int DUODUI_THREE_BUY = 41;//三队探索每日购买次数提升至%s
int PLAYER_GOD_TOWER_FREE = 10001;//主角神塔探索每日免费次数提升至%s
int PLAYER_GOD_TOWER_BUY = 10002;//主角神塔探索每日购买次数提升至%s
//功能项解锁
int UNLOCK_TWO_FIGHT = 501;//解锁2倍速战斗

View File

@ -474,4 +474,6 @@ public interface BIReason {
int TRAINGING_SPEED_ITEM_COST = 1358;//特训加速道具消耗
int YUXU_DEAL = 1359;//玉虚奖励修正
int PLAYER_GOD_MERIDIANS_LEVEL = 1360;//主角六道神脉升级
}

View File

@ -257,6 +257,9 @@ public class GetPlayerInfoHandler extends BaseHandler{
.addAllGiftIds(user.getPlayerInfoManager().getPlayerGiftEquipList())
.addAllGemLotteryCountByDay(EquipLogic.getInstance().getGemLotteryCountByDay(userId))
.setIsStart(PlayerLogic.getCrossStartWeek())
.setPlayerGodLevel(playerInfoManager.getPlayerGodLevel())
.setPlayerGodTowerNum(playerInfoManager.getPlayerGodTowerNum())
.addAllPlayerMeridiansLevel(playerInfoManager.getAllPlayerGodMeridiansLevels())
.build();
try {

View File

@ -0,0 +1,41 @@
package com.ljsd.jieling.handler.playerGod;
import com.ljsd.jieling.core.FunctionIdEnum;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.GlobleSystemLogic;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.activity.event.SaveHeroForceEvent;
import com.ljsd.jieling.logic.dao.Hero;
import com.ljsd.jieling.logic.dao.HeroManager;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.playerGod.PlayerGodLogic;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.util.MessageUtil;
import config.SCHero;
import config.SGlobalSystemConfig;
import manager.STableManager;
import rpc.protocols.PlayerInfoProto;
import rpc.protocols.MessageTypeProto;
import java.util.List;
/**
*
*/
public class PlayerGodLevelUpRequestHandler extends BaseHandler<PlayerInfoProto.PlayerGodLevelUpRequest> {
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.PlayerGodLevelUpRequest;
}
//主角成神神脉升级绑定协议
@Override
public void processWithProto(ISession session, PlayerInfoProto.PlayerGodLevelUpRequest proto) throws Exception {
PlayerGodLogic.getInstance().levelUpPlayerGodLevel(session);
}
}

View File

@ -0,0 +1,41 @@
package com.ljsd.jieling.handler.playerGod;
import com.ljsd.jieling.core.FunctionIdEnum;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.handler.BaseHandler;
import com.ljsd.jieling.logic.GlobleSystemLogic;
import com.ljsd.jieling.logic.activity.event.Poster;
import com.ljsd.jieling.logic.activity.event.SaveHeroForceEvent;
import com.ljsd.jieling.logic.dao.Hero;
import com.ljsd.jieling.logic.dao.HeroManager;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.hero.HeroLogic;
import com.ljsd.jieling.logic.playerGod.PlayerGodLogic;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.util.MessageUtil;
import config.SCHero;
import config.SGlobalSystemConfig;
import manager.STableManager;
import rpc.protocols.PlayerInfoProto;
import rpc.protocols.MessageTypeProto;
import java.util.List;
/**
*
*/
public class PlayerMeridiansLevelUpRequestHandler extends BaseHandler<PlayerInfoProto.PlayerMeridiansLevelUpRequest> {
@Override
public MessageTypeProto.MessageType getMessageCode() {
return MessageTypeProto.MessageType.PlayerMeridiansLevelUpRequest;
}
//主角成神神脉升级绑定协议
@Override
public void processWithProto(ISession session, PlayerInfoProto.PlayerMeridiansLevelUpRequest proto) throws Exception {
PlayerGodLogic.getInstance().levelUpPlayerMeridiansLevel(session,proto.getType());
}
}

View File

@ -162,4 +162,6 @@ public interface ActivityType {
int FENGSHEN_TREASURE_THREE = 116;//三队封神
int EVERY_DAY_DISCOUNT = 126;//天天0.1折扣
int FABAO_JULING_GIFT = 20019;//法宝聚灵礼包
int PLAYER_GOD_GIFT = 20020;//法宝聚灵礼包
}

View File

@ -124,6 +124,7 @@ public enum ActivityTypeEnum {
ADVANCED_GEM_CHEST(ActivityType.ADVANCED_GEM_CHEST, GemChestActivity::new),//高级命石宝箱
BAUBLES_SUMMON_GIFT(ActivityType.BAUBLES_SUMMON_GIFT, DefaultEmptyActivity::new),//法宝召唤礼包
FABAO_JULING_GIFT(ActivityType.FABAO_JULING_GIFT, DefaultEmptyActivity::new),//法宝聚灵礼包
PLAYER_GOD_GIFT(ActivityType.PLAYER_GOD_GIFT, DefaultEmptyActivity::new),//主角成神礼包
BAUBLES_BOOK(ActivityType.BAUBLES_BOOK, BaublesBookNumActivity::new),//法宝图鉴,专武活动
/****************************************************** bt **********************************************************/

View File

@ -270,6 +270,7 @@ public class CumulationData {
private int yuxuLv;//玉虚论道段位
private int accumulativeRechargeNum;// 累计充值金额
private int fabaojulingNum;//法宝聚灵召唤
private Map<Integer,Integer> missionIntDatas = new HashMap<>();//所有的int计数类任务统计,后续我所有的统计均在该字段扩充,放置该类字段越来越多
public Result updateData(MissionType missionType, Object...parm) throws Exception {
return DataManagerDistributor.updateData(this, missionType,parm);
@ -763,4 +764,29 @@ public class CumulationData {
public void setFabaojulingNum(int fabaojulingNum) {
this.fabaojulingNum = fabaojulingNum;
}
public Map<Integer, Integer> getMissionIntDatas() {
return missionIntDatas;
}
public void setMissionIntDatas(Map<Integer, Integer> missionIntDatas) {
this.missionIntDatas = missionIntDatas;
}
public void setMissionIntData(int missionType,int midddsionData){
if(this.missionIntDatas == null){
this.missionIntDatas = new HashMap<>();
}
this.missionIntDatas.put(missionType,midddsionData);
}
public int getMissionIntData(int missionType){
if(this.missionIntDatas == null){
this.missionIntDatas = new HashMap<>();
}
if(this.missionIntDatas.containsKey(missionType)){
return missionIntDatas.get(missionType);
}
return 0;
}
}

View File

@ -238,6 +238,10 @@ public class PlayerManager extends MongoBase {
return desireDraw;
}
public int playerGodTowerNum;//主角神觉塔层数
public int playerGodLevel;//主角成神阶数(1半神2神3神王)
public Map<Integer,Integer> playerGodMeridiansLevels = new HashMap<Integer,Integer>();//主角六道神脉等级
public void putDesireDraw(int type, int tempId) {
this.desireDraw.put(type, tempId);
updateString("desireDraw", desireDraw);
@ -1551,4 +1555,83 @@ public class PlayerManager extends MongoBase {
updateString("trainingArchitectureMap", this.trainingArchitectureMap);
}
public int getPlayerGodTowerNum() {
int num = 0;
//主角神塔类型为3
int[] tower = this.getDuoduiTower(3);
if(tower != null && tower.length > 0){
num = tower[0];
}
return num;
}
public void setPlayerGodTowerNum(int playerGodTowerNum) {
this.playerGodTowerNum = playerGodTowerNum;
updateString("playerGodTowerNum", this.playerGodTowerNum);
}
public int getPlayerGodLevel() {
return playerGodLevel;
}
public void setPlayerGodLevel(int playerGodLevel) {
this.playerGodLevel = playerGodLevel;
updateString("playerGodLevel", this.playerGodLevel);
}
public Map<Integer, Integer> getPlayerGodMeridiansLevels() {
return playerGodMeridiansLevels;
}
public void setPlayerGodMeridiansLevels(Map<Integer, Integer> playerGodMeridiansLevels) {
if(this.playerGodMeridiansLevels == null){
this.playerGodMeridiansLevels = new HashMap<Integer,Integer>();
}
if(playerGodMeridiansLevels != null){
this.playerGodMeridiansLevels = playerGodMeridiansLevels;
updateString("playerGodMeridiansLevels", this.playerGodMeridiansLevels);
}
}
/**
*
* @param type
* @param level
*/
public void setPlayerGodMeridiansLevel(int type,int level){
if(this.playerGodMeridiansLevels == null){
this.playerGodMeridiansLevels = new HashMap<Integer,Integer>();
}
this.playerGodMeridiansLevels.put(type,level);
updateString("playerGodMeridiansLevels", this.playerGodMeridiansLevels);
}
/**
*
* @param type
* @return
*/
public int getPlayerGodMeridiansLevel(int type){
int level = 0;
if(playerGodMeridiansLevels != null && playerGodMeridiansLevels.containsKey(type)){
if(playerGodMeridiansLevels.get(type) != null){
level = playerGodMeridiansLevels.get(type);
}
}
return level;
}
/**
* 0
* @return
*/
public List<Integer> getAllPlayerGodMeridiansLevels(){
List<Integer> list = new ArrayList<Integer>();
for(int type = 1;type <=6;type++){
int level = this.getPlayerGodMeridiansLevel(type);
list.add(level);
}
return list;
}
}

View File

@ -58,6 +58,10 @@ public enum TeamEnum {
LUOFU_TEMA_2(3209,"罗浮争锋队伍2",1,1,1),
LUOFU_TEMA_3(3210,"罗浮争锋队伍3",1,1,1),
LUOFU_TEMA_4(3211,"罗浮争锋队伍4",1,1,1),
PLAYER_GOD_THREE_TEAM_1(3301,"主角成神塔三队1",1,0),
PLAYER_GOD_THREE_TEAM_2(3302,"主角成神塔三队2",1,0),
PLAYER_GOD_THREE_TEAM_3(3303,"主角成神塔三队3",1,0),
;
/**

View File

@ -55,7 +55,7 @@ public class DuoduiTowerLogic {
User user = UserManager.getUser(iSession.getUid());
DuoduiRank duoduiRank = (DuoduiRank) RankEnum.toRank(RankEnum.DUO_DUI_RANK.getType());
FightInfoProto.DuoduiInfoResponse.Builder builder = FightInfoProto.DuoduiInfoResponse.newBuilder();
for (int i = 1; i < 3; i++) {
for (int i = 1; i <= 3; i++) {
int rank = (int) duoduiRank.getRank(i, user.getId());
int[] tower = user.getPlayerInfoManager().getDuoduiTower(i);
CommonProto.DuoduiInfo.Builder info = CommonProto.DuoduiInfo.newBuilder().setType(i).setTier(tower[0]).setRank(rank).setTime(tower[1]);
@ -83,6 +83,18 @@ public class DuoduiTowerLogic {
DuoduiRank duoduiRank = (DuoduiRank) RankEnum.toRank(RankEnum.DUO_DUI_RANK.getType());
// 当前层数
int rankTier = Math.max(user.getPlayerInfoManager().getDuoduiTower(type)[0], 0);
//主角神塔有挑战上限
if(type == 3){
int dayNum = SSpecialConfig.getIntegerValue("BecomeAGod_Tower");
long createTime = user.getPlayerInfoManager().getCreateTime();
long createBegin = TimeUtils.getBeginOfDay(createTime);
long nowBegin = TimeUtils.getBeginOfDay(System.currentTimeMillis());
int day = (int)((nowBegin - createBegin) / TimeUtils.ONE_DAY) + 1;
int total = dayNum * day;
if(rankTier + 1 >=total){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE, "playerGodTowerNum cannot channel");
}
}
// 最终结果
boolean result = true;
// 奖励
@ -208,8 +220,10 @@ public class DuoduiTowerLogic {
int vipId;
if (type == 1){
vipId = VipPrivilegeType.DUODUI_TWO_FREE;
}else {
}else if(type == 2){
vipId = VipPrivilegeType.DUODUI_THREE_FREE;
}else{
vipId = VipPrivilegeType.PLAYER_GOD_TOWER_FREE;
}
return PlayerLogic.getInstance().checkAndUpdate(user, vipId, 1);
}
@ -224,8 +238,10 @@ public class DuoduiTowerLogic {
SGlobalSystemConfig systemConfig;
if (type == 1) {
systemConfig = SGlobalSystemConfig.getConfigById(FunctionIdEnum.TwoTowerChallenge.getFunctionType());
} else {
} else if(type == 2){
systemConfig = SGlobalSystemConfig.getConfigById(FunctionIdEnum.ThereTowerChallenge.getFunctionType());
}else{
systemConfig = SGlobalSystemConfig.getConfigById(FunctionIdEnum.PlayerGodTowerChallenge.getFunctionType());
}
return GlobleSystemLogic.checkOpen(user, systemConfig);
}
@ -243,12 +259,19 @@ public class DuoduiTowerLogic {
LOGGER.error("双队阵容有空队伍");
result = false;
}
} else//三队塔
} else if(type == 2)//三队塔
{
if (!teams.containsKey(TeamEnum.DUODUI_TOWER_THREE_TEAM_1.getTeamId()) ||
!teams.containsKey(TeamEnum.DUODUI_TOWER_THREE_TEAM_2.getTeamId()) ||
!teams.containsKey(TeamEnum.DUODUI_TOWER_THREE_TEAM_3.getTeamId())) {
LOGGER.error("双队阵容有空队伍");
LOGGER.error("三队阵容有空队伍");
result = false;
}
}else{//主角成神三队塔
if (!teams.containsKey(TeamEnum.PLAYER_GOD_THREE_TEAM_1.getTeamId()) ||
!teams.containsKey(TeamEnum.PLAYER_GOD_THREE_TEAM_2.getTeamId()) ||
!teams.containsKey(TeamEnum.PLAYER_GOD_THREE_TEAM_3.getTeamId())) {
LOGGER.error("主角成神三队阵容有空队伍");
result = false;
}
}

View File

@ -39,6 +39,7 @@ import com.ljsd.jieling.logic.mail.MailLogic;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.logic.mission.MissionType;
import com.ljsd.jieling.logic.player.PlayerLogic;
import com.ljsd.jieling.logic.playerGod.PlayerGodAddSystemType;
import com.ljsd.jieling.logic.rank.RankEnum;
import com.ljsd.jieling.logic.redpacket.WelfareRedPackEvent;
import com.ljsd.jieling.logic.redpacket.WelfareRedPacketType;
@ -2795,10 +2796,12 @@ public class HeroLogic {
Map<Integer, Long> heroAllAttribute = calHeroAllAttribute(user, hero, isForce);
heroAllAttribute.put(HeroAttributeEnum.CurHP.getPropertyId(), heroAllAttribute.get(GlobalsDef.HP_TYPE));
// 主角六道神脉(要先计算并返回对灵兽,神兵,变身卡的属性加成,用于他们的系统计算)
Map<Integer,Integer> systemPropAdd = applyPlayerMeridiansAttribute(heroAllAttribute,user);
// 主角属性加成
applyPlayerAndSkill(heroAllAttribute, user);
applyPlayerAndSkill(heroAllAttribute, user,systemPropAdd);
// 灵兽和神兵
applyPokemonAndMagicSoldierAttribute(heroAllAttribute, teamId, user);
applyPokemonAndMagicSoldierAttribute(heroAllAttribute, teamId, user,systemPropAdd);
// 图鉴,皮肤,称号,坐骑等。。。
applyBonusesAttribute(heroAllAttribute, hero.getSkin(), user);
// 四象心法增加总属性
@ -2847,7 +2850,7 @@ public class HeroLogic {
return heroAllAttribute;
}
private void applyPokemonAndMagicSoldierAttribute(Map<Integer, Long> heroAllAttribute, int teamId, User user) {
private void applyPokemonAndMagicSoldierAttribute(Map<Integer, Long> heroAllAttribute, int teamId, User user,Map<Integer,Integer> add) {
// ... 灵兽和神兵属性加成逻辑 ...
int num = Optional.ofNullable(user.getTeamPosManager().getTeamPosForHero().get(teamId)).map(List::size).orElse(0);
if (num == 0) {
@ -2855,14 +2858,28 @@ public class HeroLogic {
}
//森罗环境固定为5
int heroNum = teamId == TeamEnum.TRIAL_TEAM.getTeamId() ? 5 : num;
// 灵兽战力
// 灵兽属性
int[][] pokemonAttr = calPokemonAttribute(user.getPokemonManager());
for (int i = 0; i < pokemonAttr.length; i++) {
pokemonAttr[i][1] = pokemonAttr[i][1] / heroNum;
}
combinedAttribute(pokemonAttr, heroAllAttribute);
// 神兵战力
// 神兵属性
int[][] magicSoldierAttribute = calMagicSoldierAttribute(user.getMagicSoldierManager());
if(add != null && add.size() > 0){
if(add.containsKey(PlayerGodAddSystemType.LING_SHOU)){
int value = add.get(PlayerGodAddSystemType.LING_SHOU);
for (int i = 0; i < pokemonAttr.length; i++) {
pokemonAttr[i][1] = (int)(pokemonAttr[i][1] * (1 + value / 10000d));
}
}
if(add.containsKey(PlayerGodAddSystemType.SHEN_BING)){
int value = add.get(PlayerGodAddSystemType.SHEN_BING);
for (int i = 0; i < magicSoldierAttribute.length; i++) {
magicSoldierAttribute[i][1] = (int)(magicSoldierAttribute[i][1] * (1 + value / 10000d));
}
}
}
combinedAttribute(pokemonAttr, heroAllAttribute);
combinedAttribute(magicSoldierAttribute, heroAllAttribute);
}
@ -3036,7 +3053,7 @@ public class HeroLogic {
}
}
private void applyPlayerAndSkill(Map<Integer, Long> heroAllAttribute, User user) {
private void applyPlayerAndSkill(Map<Integer, Long> heroAllAttribute, User user,Map<Integer,Integer> add) {
// ... 主角属性和主角技能 ...
SPlayerLevelConfig playerLevelConfig = SPlayerLevelConfig.sPlayerLevelConfigMap.get(user.getPlayerInfoManager().getLevel());
if (playerLevelConfig != null) {
@ -3045,8 +3062,8 @@ public class HeroLogic {
// 主角技能
for (TransformationInfo info : user.getHeroManager().getTransformationList().values()) {
// 英雄属性
calPlayerCardToHeroAttribute(heroAllAttribute, info.getCardId(), info.getStar(), info.getLevel());
// 变身卡英雄属性
calPlayerCardToHeroAttribute(heroAllAttribute, info.getCardId(), info.getStar(), info.getLevel(),add);
}
// 主角属性加成
@ -3518,6 +3535,62 @@ public class HeroLogic {
return totalAdd;
}
/**
*
* @param heroAllAttribute
* @param user
*/
private Map<Integer,Integer> applyPlayerMeridiansAttribute(Map<Integer, Long> heroAllAttribute, User user) {
Map<Integer,Integer> prop = new HashMap<>();
Map<Integer,Integer> map = user.getPlayerInfoManager().getPlayerGodMeridiansLevels();
if(map == null || map.size() <=0){
return prop;
}
//获取用户神觉塔层数
int towerNum = user.getPlayerInfoManager().getPlayerGodTowerNum();
HashMap<Integer, Long> attrMap = new HashMap<>();
for(int type:map.keySet()){
if(!map.containsKey(type)){
continue;
}
SBecomeAGodSetting config = SBecomeAGodSetting.getConfigBytype(type);
if(config == null){
continue;
}
//根据层数获取解锁的属性库
int[] floor = config.getFloor();
int[] propertyGit = config.getPropertyGit();
int num = 0;
int level = map.get(type);
for(int i = 0;i<floor.length;i++){
if(floor[i] <= towerNum){
//有解锁的属性库,但是要判断索引是否越界
if(i<propertyGit.length){
int propertyId = propertyGit[i];
SBecomeAGodPropertyGit propConfig = SBecomeAGodPropertyGit.getSBecomeAGodPropertyGitByTypeAndLevel(propertyId,level);
if(propConfig == null){
continue;
}
if (propConfig.getProperty() != null) {
for (int[] ints : propConfig.getProperty()) {
attrMap.put(ints[0], attrMap.getOrDefault(ints[0], 0L) + ints[1]);
}
}
if (propConfig.getSystemProperty() != null && propConfig.getSystemProperty().length >= 1) {
for (int[] ints : propConfig.getProperty()) {
prop.put(ints[0], prop.getOrDefault(ints[0], 0) + ints[1]);
}
}
}
}else{
break;
}
}
}
combinedAttribute(attrMap, heroAllAttribute);
return prop;
}
/**
* ... ...
*
@ -3842,6 +3915,9 @@ public class HeroLogic {
public void combinedAttribute(int[][] otherAttriMap, Map<Integer, Long> heroAttributeMap) {
for (int[] item : otherAttriMap) {
if(item == null || item.length < 1){
continue;
}
int propertyId = item[0];
int propertyValue = item[1];
heroAttributeMap.put(propertyId, heroAttributeMap.getOrDefault(propertyId, 0L) + propertyValue);
@ -4277,7 +4353,7 @@ public class HeroLogic {
}
/**
*
*
*
* @param pokemonManager
* @return
@ -4310,7 +4386,7 @@ public class HeroLogic {
// 主角变身卡属性
for (TransformationInfo info : heroManager.getTransformationList().values()) {
calPlayerAttribute(attrMap, info.getCardId(), info.getStar(), info.getLevel());
calPlayerCardAttribute(attrMap, info.getCardId(), info.getStar(), info.getLevel());
}
// 主角礼物属性
@ -4332,12 +4408,25 @@ public class HeroLogic {
combinedAttribute(playerProperty, attrMap);
}
}
//主角神觉(成神)的主角技增伤加成
int playerGodLevel = playerInfoManager.getPlayerGodLevel();
if(playerGodLevel <=0){
return;
}
SBecomeAGodLevel godLevelConfig = SBecomeAGodLevel.map.get(playerGodLevel);
if(godLevelConfig != null){
int [][] godProp = godLevelConfig.getProperty();
if(godProp != null && godProp.length > 0){
combinedAttribute(godProp, attrMap);
}
}
}
/**
*
*/
public void calPlayerAttribute(Map<Integer, Long> attrMap, int tmpId, int star, int level) {
public void calPlayerCardAttribute(Map<Integer, Long> attrMap, int tmpId, int star, int level) {
try {
SChangingCard card = SChangingCard.map.get(tmpId);
// 基础属性
@ -4346,11 +4435,13 @@ public class HeroLogic {
Map<Integer, SChangingCardLevel> cardLevelMap = SChangingCardLevel.getConfigByPoolId(card.getLevelUpPool());
if (cardLevelMap != null) {
SChangingCardLevel cardLevel = cardLevelMap.get(level);
combinedAttribute(cardLevel.getPlayerPropList(), attrMap);
int[][] cardLevelProp = cardLevel.getPlayerPropList();
combinedAttribute(cardLevelProp, attrMap);
}
//星级
SChangingCardStar cardStar = SChangingCardStar.getPoolMap().get(card.getStar()).get(star);
combinedAttribute(cardStar.getPlayerPropList(), attrMap);
int[][] starProp = cardStar.getPlayerPropList();
combinedAttribute(starProp, attrMap);
} catch (Exception e) {
LOGGER.error("计算主角属性报错error{}", e.getMessage(), e);
}
@ -4364,7 +4455,7 @@ public class HeroLogic {
* @param star
* @param level
*/
public void calPlayerCardToHeroAttribute(Map<Integer, Long> attrMap, int tmpId, int star, int level) {
public void calPlayerCardToHeroAttribute(Map<Integer, Long> attrMap, int tmpId, int star, int level,Map<Integer,Integer> add) {
try {
// 身外化身加成
Map<Integer, SChangingCard> changingCardMap = STableManager.getConfig(SChangingCard.class);
@ -4372,19 +4463,43 @@ public class HeroLogic {
if (card == null) {
return;
}
int value = 0;
if(add!= null && add.size() > 0){
if(add.containsKey(PlayerGodAddSystemType.BIAN_SHEN)){
value = add.get(PlayerGodAddSystemType.BIAN_SHEN);
}
}
// 变身卡单独提供得属性
combinedAttribute(card.getPropList(), attrMap);
int[][] cardProp = card.getPropList();
if(value > 0){
for (int i = 0; i < cardProp.length; i++) {
cardProp[i][1] = (int)(cardProp[i][1] * (1 + value / 10000d));
}
}
combinedAttribute(cardProp, attrMap);
//变身卡升星属性
SChangingCardStar cardStar = SChangingCardStar.getPoolMap().get(card.getStar()).get(star);
if (cardStar != null) {
combinedAttribute(cardStar.getExp(), attrMap);
int[][] starProp = cardStar.getExp();
if(value > 0){
for (int i = 0; i < starProp.length; i++) {
starProp[i][1] = (int)(starProp[i][1] * (1 + value / 10000d));
}
}
combinedAttribute(starProp, attrMap);
}
//变身卡升级属性
Map<Integer, SChangingCardLevel> poolConfig = SChangingCardLevel.getConfigByPoolId(card.getLevelUpPool());
if (poolConfig != null) {
List<SChangingCardLevel> levelList = poolConfig.values().stream().filter(n -> n.getLevel() == level).collect(Collectors.toList());
if (!levelList.isEmpty()) {
combinedAttribute(levelList.get(0).getPropList(), attrMap);
int[][] levelProp = levelList.get(0).getPropList();
if(value > 0){
for (int i = 0; i < levelProp.length; i++) {
levelProp[i][1] = (int)(levelProp[i][1] * (1 + value / 10000d));
}
}
combinedAttribute(levelProp, attrMap);
}
}
} catch (Exception e) {
@ -7265,12 +7380,12 @@ public class HeroLogic {
}
HeroInfoProto.PotentialUpLvResponse.Builder builder = HeroInfoProto.PotentialUpLvResponse.newBuilder();
builder.setUpLv(hero.getPotentialLv(type));
builder.setGiftLv(getGiftPotentialLv(user, hero) + getBookPotentialLv(user));
builder.setGiftLv(getGiftPotentialLv(user, hero) + getBookPotentialLv(user) + getPlayerGodPotentialLv(user));
MessageUtil.sendMessage(iSession, 1, MessageTypeProto.MessageType.PotentialUpLvResponse_VALUE, builder.build(), true);
}
/**
*
*
*/
public int getGiftPotentialLv(User user, Hero hero) {
Map<Integer, SEquipConfig> configMap = SEquipConfig.equipConfigMap;
@ -7293,7 +7408,7 @@ public class HeroLogic {
}
/**
*
*
*/
public int getBookPotentialLv(User user) {
int result = 0;
@ -7312,6 +7427,19 @@ public class HeroLogic {
return result;
}
/**
*
*/
public int getPlayerGodPotentialLv(User user) {
int result = 0;
int playerGodLevel = user.getPlayerInfoManager().getPlayerGodLevel();
SBecomeAGodLevel config = SBecomeAGodLevel.map.get(playerGodLevel);
if(config != null){
result += config.getPotentialNew();
}
return result;
}
/**
* 退
*/
@ -7368,7 +7496,8 @@ public class HeroLogic {
int giftPotentialLv = getGiftPotentialLv(user, hero);
int bookPotentialLv = getBookPotentialLv(user);
int potentialLv = hero.getPotentialLv(type);
int totalPotenialLv = potentialLv + giftPotentialLv + bookPotentialLv;
int playerGodPotentialLv = getPlayerGodPotentialLv(user);
int totalPotenialLv = potentialLv + giftPotentialLv + bookPotentialLv + playerGodPotentialLv;
SPotentialNew potentialNew = SPotentialNew.typeMap.get(type).get(totalPotenialLv);
if (potentialNew == null) {
return 0;

View File

@ -69,4 +69,6 @@ public enum GameEvent {
EVERY_DAY_TASK_REFRESH,//每日任务初始化
EVERY_DAY_UPDATE,//每日任务更新
PLAYER_GOD_MERIDIANS_LEVEL,//主角成神神脉升级
}

View File

@ -188,6 +188,7 @@ public enum MissionType {
SOLDIER_LAYER(166),//小兵层数
RECHARGE_ACCUMULATIVE_NUM(167),//累计充值金额
FABAO_JULING_NUM(168),//法宝聚灵召唤次数
PLAYER_GOD_MERIDIANS_LEVEL(169),//主角成神神脉总等级
;
private int missionType;

View File

@ -214,6 +214,8 @@ public class DataManagerDistributor {
judges.put(MissionType.RECHARGE_ACCUMULATIVE_NUM,new RechargeAccumulativeNumManager());//每日累充
//法宝聚灵召唤
judges.put(MissionType.FABAO_JULING_NUM,new FabaoJulingTaskManager());
//主角成神神脉任务
judges.put(MissionType.PLAYER_GOD_MERIDIANS_LEVEL,new PlayerGodMeridiansLevelTaskManager());
}
public static CumulationData.Result updateData(CumulationData data, MissionType missionType, Object...parm) throws Exception {

View File

@ -0,0 +1,28 @@
package com.ljsd.jieling.logic.mission.data;
import com.ljsd.jieling.logic.dao.CumulationData;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.mission.MissionType;
/**
*
*/
public class PlayerGodMeridiansLevelTaskManager extends AbstractDataManager{
@Override
public CumulationData.Result updateData(CumulationData data, MissionType missionType, Object... parm) {
data.setMissionIntData(MissionType.PLAYER_GOD_MERIDIANS_LEVEL.getMissionTypeValue(),(int)parm[0]);
return new CumulationData.Result(missionType);
}
@Override
public int getProcess(User user, CumulationData data, int[] missionSubType) {
int value = data.getMissionIntData(MissionType.PLAYER_GOD_MERIDIANS_LEVEL.getMissionTypeValue());
return value ;
}
@Override
public boolean isFinish(User user, CumulationData data, int[][] cfgValue, Object... parm) {
int value = data.getMissionIntData(MissionType.PLAYER_GOD_MERIDIANS_LEVEL.getMissionTypeValue());
return value >= cfgValue[1][0];
}
}

View File

@ -239,6 +239,10 @@ public class MissionEventDistributor {
// 单一任务类型任务处理
eventProcessor.put(GameEvent.ONE_MISSION_TYPE_CONSUME, new OneMissionTypeUpdateProcessor());
typeList = new ArrayList<>();
typeList.add(MissionType.PLAYER_GOD_MERIDIANS_LEVEL);
eventEnumListMap.put(GameEvent.PLAYER_GOD_MERIDIANS_LEVEL,typeList);
eventProcessor.put(GameEvent.PLAYER_GOD_MERIDIANS_LEVEL,new CumulationDataEventProcessor());
}
public static final ThreadLocal<Map<GameMisionType, List<MissionStateChangeInfo>>> threadMissionChangeList = new ThreadLocal<>();

View File

@ -1052,8 +1052,8 @@ public class PlayerLogic {
builder.setForce(HeroLogic.getInstance().calForce(heroNotBufferAttribute));
// 英雄
builder.setHero(CBean2Proto.getHongmengHero(userInMem, hero));
// 礼物等级
builder.setPlayerGiftLv(HeroLogic.getInstance().getGiftPotentialLv(userInMem, hero) + HeroLogic.getInstance().getBookPotentialLv(userInMem));
// 所有的潜能等级
builder.setPlayerGiftLv(HeroLogic.getInstance().getGiftPotentialLv(userInMem, hero) + HeroLogic.getInstance().getBookPotentialLv(userInMem) + HeroLogic.getInstance().getPlayerGodPotentialLv(userInMem));
// 公会技能
Map<Integer, Integer> guildSkill = userInMem.getGuildMyInfo().getGuildSkill();
int profession = SCHero.getsCHero().get(hero.getTemplateId()).getProfession();

View File

@ -0,0 +1,8 @@
package com.ljsd.jieling.logic.playerGod;
public interface PlayerGodAddSystemType {
public int LING_SHOU = 1;//灵兽
public int BIAN_SHEN = 2;//变身卡
public int SHEN_BING = 3;//神兵
}

View File

@ -0,0 +1,134 @@
package com.ljsd.jieling.logic.playerGod;
import com.ljsd.jieling.exception.ErrorCode;
import com.ljsd.jieling.exception.ErrorCodeException;
import com.ljsd.jieling.globals.BIReason;
import com.ljsd.jieling.logic.dao.Hero;
import com.ljsd.jieling.logic.dao.PlayerManager;
import com.ljsd.jieling.logic.dao.UserManager;
import com.ljsd.jieling.logic.dao.root.User;
import com.ljsd.jieling.logic.mission.GameEvent;
import com.ljsd.jieling.network.session.ISession;
import com.ljsd.jieling.util.ItemUtil;
import com.ljsd.jieling.util.MessageUtil;
import config.SBecomeAGodLevel;
import config.SBecomeAGodMaterialGit;
import config.SBecomeAGodPropertyGit;
import config.SBecomeAGodSetting;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import rpc.protocols.MessageTypeProto;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
*/
public class PlayerGodLogic {
private static final Logger LOGGER = LoggerFactory.getLogger(PlayerGodLogic.class);
private PlayerGodLogic(){
}
static class InnerClass{
public final static PlayerGodLogic instance = new PlayerGodLogic();
}
public static PlayerGodLogic getInstance(){
return InnerClass.instance;
}
/**
*
* @param session
* @param type
*/
public void levelUpPlayerMeridiansLevel(ISession session,int type) throws Exception {
User user = UserManager.getUser(session.getUid());
//不是合法的类型
if(!PlayerMeridiansType.isExistType(type)){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE, "type error");
}
PlayerManager playerManager = user.getPlayerInfoManager();
int playerMeridiansLevel = playerManager.getPlayerGodMeridiansLevel(type);
//寻找对应的材料库
SBecomeAGodSetting config = SBecomeAGodSetting.getConfigBytype(type);
if(config == null){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE, "SBecomeAGodSetting error");
}
SBecomeAGodMaterialGit materialConfig = SBecomeAGodMaterialGit.getSBecomeAGodMaterialGitByTypeAndLevel(config.getMaterialGit(),playerMeridiansLevel);
if(materialConfig == null){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE, "SBecomeAGodMaterialGit error");
}
int[][] cost = materialConfig.getlvupCost();
//已达最大等级
if(cost == null || cost.length <=0){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE, "PlayerMeridiansLevel max");
}
//
boolean itemCost = ItemUtil.itemCost(user, cost, BIReason.PLAYER_GOD_MERIDIANS_LEVEL, 0);
if (!itemCost){
throw new ErrorCodeException(ErrorCode.ITEM_NOT_ENOUGH);
}
playerManager.setPlayerGodMeridiansLevel(type,playerMeridiansLevel + 1);
//获取总等级,触发任务计次
List<Integer> list = playerManager.getAllPlayerGodMeridiansLevels();
int totalLevel = 0;
for(int level:list){
totalLevel +=level;
}
user.getUserMissionManager().onGameEvent(user, GameEvent.PLAYER_GOD_MERIDIANS_LEVEL,totalLevel);
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.PlayerMeridiansLevelUpResponse_VALUE, null, true);
}
/**
*
* @param session
*/
public void levelUpPlayerGodLevel(ISession session) throws Exception {
User user = UserManager.getUser(session.getUid());
PlayerManager playerManager = user.getPlayerInfoManager();
int playerGodLevel = playerManager.getPlayerGodLevel();
//已达最大阶等级,不能进阶
if(playerGodLevel >= PlayerGodType.PLAYER_GOD_KING){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE, "playerGodLevel max");
}
int nextLevel = playerGodLevel + 1;
SBecomeAGodLevel config = SBecomeAGodLevel.map.get(nextLevel);
if(config == null){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE, "playerGodLevel config null");
}
//获取主角的所有神脉等级,只要有一个不符合就不能进阶
int needLevel = config.getLevelConfine();
Map<Integer,Integer> map = playerManager.getPlayerGodMeridiansLevels();
for(int i=1;i<=6;i++){
if(!map.containsKey(i)){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE, "playerMeridiansLevel not enough");
}
int playerMeridiansLevel = map.get(i);
if(playerMeridiansLevel < needLevel){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE, "playerMeridiansLevel not enough");
}
}
int[] herosNeed = config.getHeroConfine();
if(herosNeed == null || herosNeed.length <=0){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE, "playerMeridiansLevel herosNeed null");
}
//获取指定星数英雄数量,不满足不能进阶
int num = 0;
int needNum = herosNeed[0];
int star = herosNeed[1];
for(Hero hero : user.getHeroManager().getHeroMap().values()){
if(hero.getStar() >= star){
num++;
}
}
if(num < needNum){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE, "playerMeridiansLevel herosNeed num notEnough");
}
//进阶等级
playerManager.setPlayerGodLevel(nextLevel);
MessageUtil.sendMessage(session, 1, MessageTypeProto.MessageType.PlayerGodLevelUpResponse_VALUE, null, true);
}
}

View File

@ -0,0 +1,10 @@
package com.ljsd.jieling.logic.playerGod;
/**
*
*/
public interface PlayerGodType {
public int PLAYER_HALF_GOD = 1;//半神
public int PLAYER_GOD = 2;//神
public int PLAYER_GOD_KING = 3;//神王
}

View File

@ -0,0 +1,22 @@
package com.ljsd.jieling.logic.playerGod;
/**
*
*/
public class PlayerMeridiansType {
public static int TIAN_DAO = 1;//天道
public static int DI_DAO = 2;//人道
public static int AXIULUO_DAO = 3;//阿修罗道
public static int DIYU_DAO = 4;//地狱道
public static int EGUI_DAO = 5;//恶鬼道
public static int CHUSHENG_DAO = 6;//畜生道
public static boolean isExistType(int type){
if(type <1 || type > 6){
return false;
}
return true;
}
}

View File

@ -0,0 +1,58 @@
package config;
import manager.STableManager;
import manager.Table;
import java.util.HashMap;
import java.util.Map;
@Table(name ="BecomeAGodLevel")
public class SBecomeAGodLevel implements BaseConfig {
private int id;
private int levelConfine;
private int[] heroConfine;
private int[][] property;
private int potentialNew;
private int duplicate;
private int magicNumber;
public static Map<Integer, SBecomeAGodLevel> map = new HashMap<>();
@Override
public void init() throws Exception {
map = STableManager.getConfig(SBecomeAGodLevel.class);
}
public int getId() {
return id;
}
public int getLevelConfine() {
return levelConfine;
}
public int[] getHeroConfine() {
return heroConfine;
}
public int[][] getProperty() {
return property;
}
public int getPotentialNew() {
return potentialNew;
}
public int getDuplicate() {
return duplicate;
}
public int getMagicNumber() {
return magicNumber;
}
}

View File

@ -0,0 +1,70 @@
package config;
import manager.STableManager;
import manager.Table;
import java.util.HashMap;
import java.util.Map;
@Table(name ="BecomeAGodMaterialGit")
public class SBecomeAGodMaterialGit implements BaseConfig {
private int id;
private int type;
private int level;
private int[][] lvupCost;
public static Map<Integer, SBecomeAGodMaterialGit> map = new HashMap<>();
//按库类型和等级存储的主角神脉升级消耗表
public static Map<Integer, Map<Integer,SBecomeAGodMaterialGit>> levelMaps = new HashMap<>();
@Override
public void init() throws Exception {
map = STableManager.getConfig(SBecomeAGodMaterialGit.class);
Map<Integer, Map<Integer,SBecomeAGodMaterialGit>> _levelMaps = new HashMap<>();
for(SBecomeAGodMaterialGit config : map.values()){
if(!_levelMaps.containsKey(config.getType())){
Map<Integer,SBecomeAGodMaterialGit> subMaps = new HashMap<>();
subMaps.put(config.getLevel(),config);
_levelMaps.put(config.getType(),subMaps);
}else{
Map<Integer,SBecomeAGodMaterialGit> subMaps = _levelMaps.get(config.getType());
subMaps.put(config.getLevel(),config);
}
}
levelMaps = _levelMaps;
}
public int getId() {
return id;
}
public int getType() {
return type;
}
public int getLevel() {
return level;
}
public int[][] getlvupCost() {
return lvupCost;
}
public static SBecomeAGodMaterialGit getSBecomeAGodMaterialGitByTypeAndLevel(int type,int level){
if(!levelMaps.containsKey(type)){
return null;
}
Map<Integer,SBecomeAGodMaterialGit> map = levelMaps.get(type);
if(map == null){
return null;
}
if(!map.containsKey(level)){
return null;
}
return map.get(level);
}
}

View File

@ -0,0 +1,76 @@
package config;
import manager.STableManager;
import manager.Table;
import java.util.HashMap;
import java.util.Map;
@Table(name ="BecomeAGodPropertyGit")
public class SBecomeAGodPropertyGit implements BaseConfig {
private int id;
private int type;
private int level;
private int[][] property;
private int[][] systemProperty;
public static Map<Integer, SBecomeAGodPropertyGit> map = new HashMap<>();
//按库类型和等级存储的主角神脉属性表
public static Map<Integer, Map<Integer,SBecomeAGodPropertyGit>> levelMaps = new HashMap<>();
@Override
public void init() throws Exception {
map = STableManager.getConfig(SBecomeAGodPropertyGit.class);
Map<Integer, Map<Integer,SBecomeAGodPropertyGit>> _levelMaps = new HashMap<>();
for(SBecomeAGodPropertyGit config : map.values()){
if(!_levelMaps.containsKey(config.getType())){
Map<Integer,SBecomeAGodPropertyGit> subMaps = new HashMap<>();
subMaps.put(config.getLevel(),config);
_levelMaps.put(config.getType(),subMaps);
}else{
Map<Integer,SBecomeAGodPropertyGit> subMaps = _levelMaps.get(config.getType());
subMaps.put(config.getLevel(),config);
}
}
levelMaps = _levelMaps;
}
public int getId() {
return id;
}
public int getType() {
return type;
}
public int getLevel() {
return level;
}
public int[][] getProperty() {
return property;
}
public int[][] getSystemProperty() {
return systemProperty;
}
public static SBecomeAGodPropertyGit getSBecomeAGodPropertyGitByTypeAndLevel(int type,int level){
if(!levelMaps.containsKey(type)){
return null;
}
Map<Integer,SBecomeAGodPropertyGit> map = levelMaps.get(type);
if(map == null){
return null;
}
if(!map.containsKey(level)){
return null;
}
return map.get(level);
}
}

View File

@ -0,0 +1,62 @@
package config;
import manager.STableManager;
import manager.Table;
import java.util.HashMap;
import java.util.Map;
@Table(name ="BecomeAGodSetting")
public class SBecomeAGodSetting implements BaseConfig {
private int id;
private int type;
private int materialGit;
private int[] floor;
private int[] propertyGit;
public static Map<Integer, SBecomeAGodSetting> map = new HashMap<>();
public static Map<Integer, SBecomeAGodSetting> typeMap = new HashMap<>();
@Override
public void init() throws Exception {
map = STableManager.getConfig(SBecomeAGodSetting.class);
for(SBecomeAGodSetting config : map.values()){
typeMap.put(config.getType(),config);
}
}
public int getId() {
return id;
}
public int getType() {
return type;
}
public int getMaterialGit() {
return materialGit;
}
public int[] getFloor() {
return floor;
}
public int[] getPropertyGit() {
return propertyGit;
}
public static SBecomeAGodSetting getConfigBytype(int type){
if(typeMap != null && typeMap.containsKey(type)){
return typeMap.get(type);
}
return null;
}
}