玉虚论道玩法调整为半公平竞技

dengdan 2022-09-12 11:04:11 +08:00
parent 67c4ecd512
commit 8e93d63e25
8 changed files with 540 additions and 6 deletions

View File

@ -375,7 +375,7 @@ public class CrossYuxulundaoChallengeHandler extends BaseHandler<ArenaInfoProto.
}
CommonProto.FightTeamInfo fightTeamInfo = FightUtil.makePersonFightData(myUser, myteamId[i], null, null);
//对手 修行等级 区服名称 战斗类行 积分变化情况
CommonProto.FightTeamInfo defteamInfo = FightUtil.makeCrossPersonData(csPlayer, defTeamId[i], arenaRecord, crossArenaManager);
CommonProto.FightTeamInfo defteamInfo = FightUtil.makeYuxuCrossPersonData(csPlayer, defTeamId[i], arenaRecord, crossArenaManager);
//根据战力判断先后手
int myforce = 0,defforce = 0;

View File

@ -240,6 +240,11 @@ public class BehaviorUtil {
if(teamId==TeamEnum.TRIAL_TEAM.getTeamId()){
return FightUtil.getFightTeamInfo(user,teamId);
}
//玉虚论道队伍有统一的属性修正
if (teamId == TeamEnum.CROSS_YU_XU_LUN_DAO_ONE.getTeamId() || teamId == TeamEnum.CROSS_YU_XU_LUN_DAO_TWO.getTeamId()
|| teamId == TeamEnum.CROSS_YU_XU_LUN_DAO_THREE.getTeamId()) {
return FightUtil.getYuxuTeam(user, teamId, null,null);
}
user.getTeamPosManager().setCurTeamPosId(teamId);
List<CommonProto.FightUnitInfo> heroFightInfos = new ArrayList<>();
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);

View File

@ -34,6 +34,13 @@ public class ViewHeroInfoHandler extends BaseHandler<PlayerInfoProto.ViewHeroInf
PlayerLogic.getInstance().viewRobotHeroInfo(iSession,sArenaRobotConfig,proto.getHeroId(),proto.getTeamId());
return;
}
if(proto.getTeamId()== TeamEnum.CROSS_YU_XU_LUN_DAO_ONE.getTeamId()||
proto.getTeamId()== TeamEnum.CROSS_YU_XU_LUN_DAO_TWO.getTeamId()||
proto.getTeamId()== TeamEnum.CROSS_YU_XU_LUN_DAO_THREE.getTeamId()){
PlayerInfoProto.ViewHeroInfoResponse viewHeroInfoResponse = PlayerLogic.getInstance().viewYuxuHeroInfo(proto.getTargetUid(), proto.getHeroId(), proto.getTeamId());
MessageUtil.sendMessage(iSession,1,MessageTypeProto.MessageType.VIEW_HERO_INFO_RESPONSE_VALUE,viewHeroInfoResponse,true);
return;
}
PlayerInfoProto.ViewHeroInfoResponse viewHeroInfoResponse = PlayerLogic.getInstance().viewHeroInfo(proto.getTargetUid(), proto.getHeroId(), 1);
int resMsgId = MessageTypeProto.MessageType.VIEW_HERO_INFO_RESPONSE_VALUE;
MessageUtil.sendMessage(iSession,1,resMsgId,viewHeroInfoResponse,true);
@ -62,7 +69,7 @@ public class ViewHeroInfoHandler extends BaseHandler<PlayerInfoProto.ViewHeroInf
if(proto.getTeamId()== TeamEnum.CROSS_YU_XU_LUN_DAO_ONE.getTeamId()||
proto.getTeamId()== TeamEnum.CROSS_YU_XU_LUN_DAO_TWO.getTeamId()||
proto.getTeamId()== TeamEnum.CROSS_YU_XU_LUN_DAO_THREE.getTeamId()){
PlayerInfoProto.ViewHeroInfoResponse viewHeroInfoResponse = PlayerLogic.getInstance().viewCrossHeroInfo(proto.getTargetUid(), proto.getHeroId(), proto.getTeamId());
PlayerInfoProto.ViewHeroInfoResponse viewHeroInfoResponse = PlayerLogic.getInstance().viewCrossYuxuHeroInfo(proto.getTargetUid(), proto.getHeroId(), proto.getTeamId());
MessageUtil.sendMessage(iSession,1,MessageTypeProto.MessageType.VIEW_HERO_INFO_RESPONSE_VALUE,viewHeroInfoResponse,true);
}else {
PlayerInfoProto.ViewHeroInfoResponse viewHeroInfoResponse = PlayerLogic.getInstance().viewCrossHeroInfo(proto.getTargetUid(), proto.getHeroId(), proto.getTeamId());

View File

@ -583,4 +583,12 @@ public class Hero extends MongoBase implements Comparable<Hero>,Cloneable {
}
return clone;
}
/**
*
* @return
*/
public int getYuXuLevel(){
return this.level;
}
}

View File

@ -6,6 +6,7 @@ import com.ljsd.fight.ArenaRecord;
import com.ljsd.fight.CheckFight;
import com.ljsd.fight.DefFightSnapData;
import com.ljsd.fight.FightType;
import com.ljsd.jieling.core.GlobalsDef;
import com.ljsd.jieling.db.redis.RedisKey;
import com.ljsd.jieling.db.redis.RedisUtil;
import com.ljsd.jieling.exception.ErrorCode;
@ -359,6 +360,11 @@ public class FightUtil {
if (teamId == TeamEnum.ENDLESS_TEAM.getTeamId()) {
return getEndlessTeam(user, teamId, attackBloodMap);
}
//玉虚论道队伍有统一的属性修正
if (teamId == TeamEnum.CROSS_YU_XU_LUN_DAO_ONE.getTeamId() || teamId == TeamEnum.CROSS_YU_XU_LUN_DAO_TWO.getTeamId()
|| teamId == TeamEnum.CROSS_YU_XU_LUN_DAO_THREE.getTeamId()) {
return getYuxuTeam(user, teamId, attackBloodMap,null);
}
List<CommonProto.FightUnitInfo> heroFightInfos = new ArrayList<>();
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
for (TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfos) {
@ -789,4 +795,159 @@ public class FightUtil {
.build();
}
}
/**
*
* @param user
* @param teamId
* @param attackBloodMap
* @return
*/
public static CommonProto.FightTeamInfo getYuxuTeam(User user, int teamId, Map<String, Integer> attackBloodMap
,ArenaRecord arenaRecord) {
List<CommonProto.FightUnitInfo> heroFightInfos = new ArrayList<>();
if(arenaRecord != null){
int addforce = HeroLogic.getInstance().calTeamTotalForce(user, teamId, false);
arenaRecord.setAttackForce(arenaRecord.getAttackForce() + addforce);
arenaRecord.getYxldDefForce().add(addforce);
}
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
for (TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfos) {
Hero hero = user.getHeroManager().getHero(teamPosHeroInfo.getHeroId());
if (hero == null) {
continue;
}
//玉虚英雄取通用属性
Hero yuxuHero = HeroLogic.getInstance().getYuHero(hero.getTemplateId());
if(yuxuHero == null){
continue;
}
Map<Integer, SEndlessHeroProp> config = STableManager.getConfig(SEndlessHeroProp.class);
SEndlessHeroProp sEndlessHeroProp = config.get(hero.getTemplateId());
Map<Integer, Long> heroAttributeMap = new HashMap<>();
for (int[] prop : sEndlessHeroProp.getProps()) {
heroAttributeMap.put(prop[0], (long) prop[1]);
}
if (attackBloodMap != null && attackBloodMap.containsKey(teamPosHeroInfo.getHeroId())) {
heroAttributeMap.put(HeroAttributeEnum.CurHP.getPropertyId(), heroAttributeMap.get(HeroAttributeEnum.Hp.getPropertyId()) - attackBloodMap.get(teamPosHeroInfo.getHeroId()) * heroAttributeMap.get(HeroAttributeEnum.Hp.getPropertyId()) / 100);
}
heroAttributeMap.put(HeroAttributeEnum.CurHP.getPropertyId(), heroAttributeMap.get(GlobalsDef.HP_TYPE));
StringBuilder skillSb = new StringBuilder();
StringBuilder propertySb = new StringBuilder();
String heroSkill = HeroLogic.getInstance().getYuxuHeroSkills(user, hero, yuxuHero,skillSb).toString();
String property = HeroLogic.getInstance().getHeroPropertyBuilder(propertySb, hero.getPropertyId(), yuxuHero.getLevel(user.getHeroManager()), heroAttributeMap).toString();
CommonProto.FightUnitInfo heroFightInfo = CommonProto.FightUnitInfo
.newBuilder()
.setUnitId(Integer.toString(hero.getTemplateId()))
.setUnitSkillIds(heroSkill.substring(0, heroSkill.length() - 1))
.setProperty(property.substring(0, property.length() - 1))
.setStar(yuxuHero.getStar())
.setPosition(teamPosHeroInfo.getPosition())
.setSkinId(hero.getSkin())
.setGodSoulLv(yuxuHero.getGodSoulLv())
.setPropertyId(hero.getPropertyId())
.build();
heroFightInfos.add(heroFightInfo);
}
//玉虚不继承任何英雄外的技能
return CommonProto.FightTeamInfo.
newBuilder()
.addAllFightUnitList(heroFightInfos)
.addAllPokemonUnitList( new ArrayList<>())
.setTeamPassiveList("")
.setSpecialPassive("")
.setForceScore(HeroLogic.getInstance().calTeamForce(user,teamId))
.build();
}
/**
*
* @param csPlayer
* @param crossArenaManager
* @param teamId
* @param attackBloodMap
* @return
*/
public static CommonProto.FightTeamInfo getCrossYuxuTeam(CSPlayer csPlayer,CrossArenaManager crossArenaManager,
int teamId,Map<String, Integer> attackBloodMap,ArenaRecord arenaRecord) {
List<CommonProto.FightUnitInfo> heroFightInfos = new ArrayList<>();
if(arenaRecord != null){
int addforcerpc = crossArenaManager.getTotalForceByTeam().get(teamId);
arenaRecord.getYxldDefForce().add(addforcerpc);
arenaRecord.setAttackForce(arenaRecord.getAttackForce() + addforcerpc);
}
List<com.ljsd.jieling.thrift.idl.TeamPosHeroInfo> teamPosHeroInfos = crossArenaManager.getTeams().getOrDefault(teamId, new ArrayList<>());
for (com.ljsd.jieling.thrift.idl.TeamPosHeroInfo teamPosHeroInfo : teamPosHeroInfos) {
com.ljsd.jieling.thrift.idl.ArenaOfHero hero = crossArenaManager.getHeros().get(teamPosHeroInfo.getHeroId());
if (hero == null) {
continue;
}
//玉虚英雄取通用属性
Hero yuxuHero = HeroLogic.getInstance().getYuHero(hero.getTemplateId());
if(yuxuHero == null){
continue;
}
Map<Integer, SEndlessHeroProp> config = STableManager.getConfig(SEndlessHeroProp.class);
SEndlessHeroProp sEndlessHeroProp = config.get(hero.getTemplateId());
Map<Integer, Long> heroAttributeMap = new HashMap<>();
for (int[] prop : sEndlessHeroProp.getProps()) {
heroAttributeMap.put(prop[0], (long) prop[1]);
}
if (attackBloodMap != null && attackBloodMap.containsKey(teamPosHeroInfo.getHeroId())) {
heroAttributeMap.put(HeroAttributeEnum.CurHP.getPropertyId(), heroAttributeMap.get(HeroAttributeEnum.Hp.getPropertyId()) - attackBloodMap.get(teamPosHeroInfo.getHeroId()) * heroAttributeMap.get(HeroAttributeEnum.Hp.getPropertyId()) / 100);
}
heroAttributeMap.put(HeroAttributeEnum.CurHP.getPropertyId(), heroAttributeMap.get(GlobalsDef.HP_TYPE));
StringBuilder skillSb = new StringBuilder();
StringBuilder propertySb = new StringBuilder();
String heroSkill = HeroLogic.getInstance().getCrossYuxuHeroSkills(crossArenaManager,hero,yuxuHero).toString();
String property = HeroLogic.getInstance().getHeroPropertyBuilder(propertySb, hero.getPropertyId(), yuxuHero.getYuXuLevel(), heroAttributeMap).toString();
CommonProto.FightUnitInfo heroFightInfo = CommonProto.FightUnitInfo
.newBuilder()
.setUnitId(Integer.toString(hero.getTemplateId()))
.setUnitSkillIds(heroSkill.substring(0, heroSkill.length() - 1))
.setProperty(property.substring(0, property.length() - 1))
.setStar(yuxuHero.getStar())
.setPosition(teamPosHeroInfo.getPosition())
.setSkinId(hero.getSkin())
.setGodSoulLv(yuxuHero.getGodSoulLv())
.setPropertyId(hero.getPropertyId())
.build();
heroFightInfos.add(heroFightInfo);
}
return CommonProto.FightTeamInfo.
newBuilder()
.addAllFightUnitList(heroFightInfos)
.addAllPokemonUnitList(HeroLogic.getInstance().getCrossPokemon(crossArenaManager,csPlayer))
.setTeamPassiveList("")
.setForceScore(crossArenaManager.getMaxHistoryForce())
.build();
}
/**
*
* @param csPlayer
* @param teamId
* @param arenaRecord
* @param crossArenaManager
* @return
* @throws Exception
*/
public static CommonProto.FightTeamInfo makeYuxuCrossPersonData(CSPlayer csPlayer, int teamId, ArenaRecord arenaRecord, CrossArenaManager crossArenaManager) throws Exception {
//CSPlayer csPlayer = CrossServiceLogic.getPlayerByRedis(uid);
if (csPlayer == null) {
return null;//throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
List<CommonProto.FightUnitInfo> heroFightInfos = new ArrayList<>();
if (GameApplication.serverId == csPlayer.getServerId()) {
//本服玩家
User user = UserManager.getUser(csPlayer.getUserId());
return getYuxuTeam(user, teamId, null,arenaRecord);
}
//其他服玩家
if (crossArenaManager == null) {
LOGGER.error("Exception::=>{}", "rpc data is empty");
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
return getCrossYuxuTeam(csPlayer,crossArenaManager,teamId,null,arenaRecord);
}
}

View File

@ -67,10 +67,13 @@ import java.util.stream.Collectors;
public class HeroLogic {
private static final Logger LOGGER = LoggerFactory.getLogger(HeroLogic.class);
Map<Integer,Hero> yuxuHeros = new HashMap<>();
public HeroLogic() {
//英雄事件监听
Poster.getPoster().listenEvent(new HeroFiveStarGetEventHandler(), HeroFiveStarGetEvent.class);
Poster.getPoster().listenEvent(new PokemonFiveStarGetEventHandler(), PokemonFiveStarGetEvent.class);
this.initYuxuHero();
}
public static List<Integer> transTemplate = new ArrayList<>();
@ -1205,6 +1208,20 @@ public class HeroLogic {
}
}
heroIds.forEach(heroId -> set.add(heroManager.getEndlessHeroInfo().get(heroId.getHeroId()).getTemplateId()));
} else if (teamId == TeamEnum.CROSS_YU_XU_LUN_DAO_ONE.getTeamId()
|| teamId == TeamEnum.CROSS_YU_XU_LUN_DAO_TWO.getTeamId()
|| teamId == TeamEnum.CROSS_YU_XU_LUN_DAO_THREE.getTeamId()){
for (CommonProto.TeamHeroInfo teamHeroInfo : heroIds) {
Hero trueHero = heroManager.getHero(teamHeroInfo.getHeroId());
if(trueHero == null){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
Hero hero = this.getYuHero(trueHero.getTemplateId());
if (hero == null) {
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
}
heroIds.forEach(heroId -> set.add(heroManager.getHero(heroId.getHeroId()).getTemplateId()));
} else if (FourChallengeLogic.isFourChallengeTeam(teamId)) {
heroIds.forEach(heroId -> {
if (heroManager.getHeroMap().containsKey(heroId.getHeroId())) {
@ -6457,4 +6474,200 @@ public class HeroLogic {
return result;
}
/**
*
*/
private void initYuxuHero(){
for(Map.Entry<Integer,SEndlessHeroProp> entry:STableManager.getConfig(SEndlessHeroProp.class).entrySet()){
Hero hero = new Hero(entry.getKey(), -1);
yuxuHeros.put(hero.getTemplateId(),hero);
}
}
/**
* id
* @param heroTemplateId
* @return
*/
public Hero getYuHero(int heroTemplateId){
if(this.yuxuHeros.containsKey(heroTemplateId)){
return yuxuHeros.get(heroTemplateId);
}
return null;
}
/**
* , ,
* @param user
* @param hero
* @param yuxuHero
* @param sb
* @return
*/
public StringBuilder getYuxuHeroSkills(User user, Hero hero, Hero yuxuHero,StringBuilder sb) {
List<Integer> heroSkillList = getYuxuHeroSkillList(user, hero,yuxuHero);
coverSkill(heroSkillList);
for (int i = 0; i < heroSkillList.size(); i++) {
Integer skill = heroSkillList.get(i);
if (i < 2) {
sb.append(skill).append(DIVISION);
continue;
}
SPassiveSkillLogicConfig config = SPassiveSkillLogicConfig.getConfig(skill);
if (config != null && config.getEffectiveRange() == 1) {
sb.append(skill).append(DIVISION);
}
}
return sb;
}
/**
* , ,
* @param user
* @param hero
* @param yuxuHero
* @return
*/
public List<Integer> getYuxuHeroSkillList(User user, Hero hero,Hero yuxuHero) {
List<Integer> skillList = new ArrayList<>();
SCHero tempHero = SCHero.getsCHero().get(hero.getTemplateId());
//英雄技能取统一的玉虚配置英雄
List<Integer> skillListByStar = tempHero.getSkillListByStar(yuxuHero.getStar());
if (skillListByStar != null) {
skillList.addAll(skillListByStar);
}
// 大于10星觉醒技
if (yuxuHero.getStar() > HERO_MAX_STAR) {
skillList.addAll(tempHero.getAwakSkills(1, yuxuHero.getBreakIdByHongMeng(user.getHeroManager())));
skillList.addAll(tempHero.getAwakSkills(2, yuxuHero.getStarBreakId()));
} else {
skillList.addAll(tempHero.getPassiveSkills(1, yuxuHero.getBreakIdByHongMeng(user.getHeroManager())));
skillList.addAll(tempHero.getPassiveSkills(2, yuxuHero.getStarBreakId()));
}
// 角色初始被动
int[] skillLogicConfig = tempHero.getInitialPassiveSkillLogicConfig();
if (skillLogicConfig != null && skillLogicConfig.length > 0){
for (int skill : skillLogicConfig) {
skillList.add(skill);
}
}
Map<Integer, SEquipConfig> config = STableManager.getConfig(SEquipConfig.class);
//魂印取统一配置
Map<Integer, Integer> soulEquipByPositionMap = yuxuHero.getSoulEquipByPositionMap();
soulEquipByPositionMap.values().forEach(e -> {
Arrays.stream(config.get(e).getPassiveSkill()).forEach(skillList::add);
});
//神印取统一配置
Map<Integer, Integer> godSealByPositionMap = yuxuHero.getGodSealByPositionMap();
godSealByPositionMap.values().forEach(e -> {
Arrays.stream(config.get(e).getPassiveSkill()).forEach(skillList::add);
});
//法宝技能继承真实技能
int[] equipTalismana = tempHero.getEquipTalismana();
if (equipTalismana.length >= 2 && hero.getStar() >= equipTalismana[0]) {
int especialEquipLevel = hero.getEspecialEquipLevelByHongmeng(user.getHeroManager(), hero.getId());
int especialEquipId = equipTalismana[1];
Map<Integer, SEquipTalismana> sEquipTalismana = SEquipTalismana.equipTalismanaStarMap.get(especialEquipId);
sEquipTalismana.forEach((k, v) -> {
if (k <= especialEquipLevel && v.getOpenSkillRules() != null) {
Arrays.stream(v.getOpenSkillRules()).forEach(skillList::add);
}
});
}
return skillList;
}
/**
* , ,
* @param crossArenaManager
* @param hero
* @param yuxuHero
* @return
*/
public List<Integer> getCrossYuxuHeroSkillList(CrossArenaManager crossArenaManager,
com.ljsd.jieling.thrift.idl.ArenaOfHero hero,Hero yuxuHero) {
List<Integer> skillList = new ArrayList<>();
SCHero tempHero = SCHero.getsCHero().get(hero.getTemplateId());
//英雄技能取统一的玉虚配置英雄
List<Integer> skillListByStar = tempHero.getSkillListByStar(yuxuHero.getStar());
if (skillListByStar != null) {
skillList.addAll(skillListByStar);
}
// 大于10星觉醒技
if (yuxuHero.getStar() > HERO_MAX_STAR) {
skillList.addAll(tempHero.getAwakSkills(1, hero.getBreakId()));
skillList.addAll(tempHero.getAwakSkills(2, yuxuHero.getStarBreakId()));
} else {
skillList.addAll(tempHero.getPassiveSkills(1, hero.getBreakId()));
skillList.addAll(tempHero.getPassiveSkills(2, yuxuHero.getStarBreakId()));
}
// 角色初始被动
int[] skillLogicConfig = tempHero.getInitialPassiveSkillLogicConfig();
if (skillLogicConfig != null && skillLogicConfig.length > 0){
for (int skill : skillLogicConfig) {
skillList.add(skill);
}
}
Map<Integer, SEquipConfig> config = STableManager.getConfig(SEquipConfig.class);
//魂印取统一配置
Map<Integer, Integer> soulEquipByPositionMap = yuxuHero.getSoulEquipByPositionMap();
soulEquipByPositionMap.values().forEach(e -> {
Arrays.stream(config.get(e).getPassiveSkill()).forEach(skillList::add);
});
//神印取统一配置
Map<Integer, Integer> godSealByPositionMap = yuxuHero.getGodSealByPositionMap();
godSealByPositionMap.values().forEach(e -> {
Arrays.stream(config.get(e).getPassiveSkill()).forEach(skillList::add);
});
//法宝技能继承真实技能
int[] equipTalismana = tempHero.getEquipTalismana();
if (equipTalismana.length >= 2 && hero.getStar() >= equipTalismana[0]) {
int especialEquipLevel = hero.getEspecialEquipLevel();
int especialEquipId = equipTalismana[1];
Map<Integer, SEquipTalismana> sEquipTalismana = SEquipTalismana.equipTalismanaStarMap.get(especialEquipId);
sEquipTalismana.forEach((k, v) -> {
if (k <= especialEquipLevel && v.getOpenSkillRules() != null) {
Arrays.stream(v.getOpenSkillRules()).forEach(skillList::add);
}
});
}
return skillList;
}
/**
* , ,
* @param crossArenaManager
* @param hero
* @param yuxuHero
* @return
*/
public StringBuilder getCrossYuxuHeroSkills(CrossArenaManager crossArenaManager,
com.ljsd.jieling.thrift.idl.ArenaOfHero hero,Hero yuxuHero) {
List<Integer> heroSkillList = this.getCrossYuxuHeroSkillList(crossArenaManager,hero,yuxuHero);
coverSkill(heroSkillList);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < heroSkillList.size(); i++) {
Integer skill = heroSkillList.get(i);
if (i < 2) {
sb.append(skill).append(DIVISION);
continue;
}
SPassiveSkillLogicConfig config = SPassiveSkillLogicConfig.getConfig(skill);
if (config != null && config.getEffectiveRange() == 1) {
sb.append(skill).append(DIVISION);
}
}
return sb;
}
}

View File

@ -817,15 +817,20 @@ public class PlayerLogic {
if(hero == null){
continue;
}
//玉虚取通用属性
Hero yuxuHero = HeroLogic.getInstance().getYuHero(hero.getTemplateId());
if(yuxuHero == null){
continue;
}
teamOneTeamInfo.addTeam(CommonProto.TeamSimpleInfo.newBuilder()
.setHeroid(hero.getId())
.setHeroTid(hero.getTemplateId())
.setLevel(hero.getLevel(user.getHeroManager()))
.setStar(hero.getStar())
.setLevel(yuxuHero.getLevel(user.getHeroManager()))
.setStar(yuxuHero.getStar())
.setPosition(heroInfo.getPosition())
.setSkinId(hero.getSkin())
.setGodSoulLv(hero.getGodSoulLv())
.setPropertyId(hero.getPropertyId())
.setGodSoulLv(yuxuHero.getGodSoulLv())
.setPropertyId(yuxuHero.getPropertyId())
.build());
}
}
@ -1906,4 +1911,120 @@ public class PlayerLogic {
LOGGER.info("掉落4->{}->{}",pokemonInfo.getTempId(),1);
}
}
/**
*
* @param uid
* @param heroId
* @param teamId
* @return
* @throws Exception
*/
public PlayerInfoProto.ViewHeroInfoResponse viewYuxuHeroInfo(int uid,String heroId,int teamId) throws Exception {
User userInMem = UserManager.getUserInMem(uid);
if(userInMem == null){
throw new ErrorCodeException(ErrorCode.FRIENDS_USER_NULL);
}
Hero hero = userInMem.getHeroManager().getHeroMap().get(heroId);
if(hero == null){
throw new ErrorCodeException(ErrorCode.newDefineCode("hero no"));
}
Hero yuxuHero = HeroLogic.getInstance().getYuHero(hero.getTemplateId());
if(yuxuHero == null){
throw new ErrorCodeException(ErrorCode.newDefineCode("hero no"));
}
Map<Integer, SEndlessHeroProp> config = STableManager.getConfig(SEndlessHeroProp.class);
SEndlessHeroProp sEndlessHeroProp = config.get(hero.getTemplateId());
Map<Integer, Long> heroAttributeMap = new HashMap<>();
for (int[] prop : sEndlessHeroProp.getProps()) {
heroAttributeMap.put(prop[0], (long) prop[1]);
}
PlayerInfoProto.ViewHeroInfoResponse.Builder builder = PlayerInfoProto.ViewHeroInfoResponse.newBuilder();
for(Map.Entry<Integer,Long> item : heroAttributeMap.entrySet()){
builder.addSpecialEffects(CommonProto.SpecialEffects.newBuilder().setPropertyId(item.getKey()).setPropertyValue(item.getValue().intValue()).build());
}
builder.setForce(HeroLogic.getInstance().calForce(heroAttributeMap));
builder.setHero(CBean2Proto.getYuxuHero(yuxuHero,hero,userInMem.getHeroManager()));
// Map<Integer, Integer> guildSkill = userInMem.getGuildMyInfo().getGuildSkill();
//// int profession = SCHero.getsCHero().get(hero.getTemplateId()).getProfession();
//// Integer skill = guildSkill.getOrDefault(profession, 0);
//公会等级统一为0
builder.setGuildSkill(0);
return builder.build();
}
/**
*
* @param uid
* @param heroId
* @return
* @throws Exception
*/
public PlayerInfoProto.ViewHeroInfoResponse viewCrossYuxuHeroInfo(int uid,String heroId,int teamId) throws Exception {
CSPlayer csPlayer = CrossServiceLogic.getPlayerByRedis(uid);
if (csPlayer == null){
throw new ErrorCodeException(ErrorCode.newDefineCode("该玩家没有跨服数据"));
}
if(GameApplication.serverId == csPlayer.getServerId()){
return viewYuxuHeroInfo(uid,heroId,teamId);
}
//其他服玩家rpc 数据调用
CrossArenaManager crossArenaManager = PlayerLogic.getInstance().getCrossArenaManagerData(csPlayer);
Map<String, com.ljsd.jieling.thrift.idl.ArenaOfHero> rpcHeroes =crossArenaManager.getHeros();
com.ljsd.jieling.thrift.idl.ArenaOfHero rpcHero = rpcHeroes.get(heroId);
if(rpcHero == null){
throw new ErrorCodeException(ErrorCode.newDefineCode("hero no"));
}
//获取玉虚英雄通用配置
Hero yuxuHero = HeroLogic.getInstance().getYuHero(rpcHero.getTemplateId());
if(yuxuHero == null){
throw new ErrorCodeException(ErrorCode.newDefineCode("hero no"));
}
CommonProto.Hero.Builder heroBuilder = CommonProto.Hero.newBuilder().
setLevel(rpcHero.getLevel()).
setEspecialEquipLevel(rpcHero.getEspecialEquipLevel()).
setStar(yuxuHero.getStar()).
setId(rpcHero.getId()).
setHeroId(rpcHero.getTemplateId()).
setGodSoulLv(yuxuHero.getGodSoulLv()).
setBreakId(rpcHero.getBreakId()).setStarBreakId(rpcHero.getStarBreakId());
PlayerInfoProto.ViewHeroInfoResponse.Builder builder = PlayerInfoProto.ViewHeroInfoResponse.newBuilder();
Map<Integer, SEndlessHeroProp> config = STableManager.getConfig(SEndlessHeroProp.class);
SEndlessHeroProp sEndlessHeroProp = config.get(rpcHero.getTemplateId());
Map<Integer, Long> heroAttributeMap = new HashMap<>();
for (int[] prop : sEndlessHeroProp.getProps()) {
heroAttributeMap.put(prop[0], (long) prop[1]);
}
for(Map.Entry<Integer,Long> item : heroAttributeMap.entrySet()){
int id = item.getKey();
int values = item.getValue().intValue();
builder.addSpecialEffects(CommonProto.SpecialEffects.newBuilder().setPropertyId(id).setPropertyValue(values).build());
}
// 无装备
// for(int equipId : yuxuHero.getEquipByPositionMap().values()){
// heroBuilder.addEquipIdList(equipId);
// }
// 魂印
Map<Integer, Integer> soulEquipByPositionMap = yuxuHero.getSoulEquipByPositionMap();
for(Map.Entry<Integer,Integer> entry: soulEquipByPositionMap.entrySet()){
heroBuilder.addSoulPos(CommonProto.SoulPos.newBuilder().setEquipId(entry.getValue()).setPosition(entry.getKey()));
}
// 神印
Map<Integer, Integer> godSealByPositionMap = yuxuHero.getGodSealByPositionMap();
for(Map.Entry<Integer,Integer> entry: godSealByPositionMap.entrySet()){
heroBuilder.addGodSeals(CommonProto.SoulPos.newBuilder().setEquipId(entry.getValue()).setPosition(entry.getKey()));
}
// 皮肤
heroBuilder.setSkinId(rpcHero.getSkin());
// 公会技能统一为0
// int profession = SCHero.getsCHero().get(rpcHero.getTemplateId()).getProfession();
int skill = 0;
builder.setGuildSkill(skill);
// 战力
builder.setForce(HeroLogic.getInstance().calForce(heroAttributeMap));
builder.setHero(heroBuilder);
return builder.build();
}
}

View File

@ -1364,4 +1364,23 @@ public class CBean2Proto {
});
return list;
}
/***
*
* @param hero
* @param heroManager
* @return
*/
public static CommonProto.Hero getYuxuHero(Hero yuxuHero,Hero hero,HeroManager heroManager){
// 无装备
Collection<Integer> equipList =new ArrayList<>();
CommonProto.Hero hero1 = getHero(yuxuHero);
CommonProto.Hero.Builder builder = hero1.toBuilder();
builder.addAllEquipIdList(equipList);
builder.setLevel(yuxuHero.getLevel(heroManager));
builder.setBreakId(hero.getBreakIdByHongMeng(heroManager));
//显示真实的法宝等级
builder.setEspecialEquipLevel(hero.getEspecialEquipLevel());
return builder.build();
}
}