查看英雄信息修改

back_recharge
lvxinran 2021-06-30 17:20:55 +08:00
parent 2fe4049b55
commit dcad481e53
2 changed files with 62 additions and 24 deletions

View File

@ -1,7 +1,13 @@
package com.ljsd.jieling.handler.player;
import com.ljsd.jieling.db.mongo.AreaManager;
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.handler.BaseHandler;
import com.ljsd.jieling.logic.GlobleSystemLogic;
import com.ljsd.jieling.logic.dao.CrossArenaEnemy;
import com.ljsd.jieling.logic.dao.EquipManager;
import com.ljsd.jieling.logic.dao.PropertyItem;
import com.ljsd.jieling.logic.hero.HeroLogic;
@ -29,34 +35,35 @@ public class ViewHeroInfoHandler extends BaseHandler<PlayerInfoProto.ViewHeroInf
public void processWithProto(ISession iSession, PlayerInfoProto.ViewHeroInfoRequest proto) throws Exception {
if(proto.getServerId()==0){
}
SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(proto.getTargetUid());
if(sArenaRobotConfig!=null){
PlayerLogic.getInstance().viewRobotHeroInfo(iSession,sArenaRobotConfig,proto.getHeroId());
return;
}
if(proto.getServerId()!=0&&proto.getServerId()!= AreaManager.areaId){
WorldProto.ViewHeroInfoRequest build = WorldProto.ViewHeroInfoRequest.newBuilder().setTargetUid(proto.getTargetUid()).setHeroId(proto.getHeroId()).build();
PlayerInfoProto.ViewHeroInfoResponse rewardResponse = WorldHelper.sendMessageToWorldWithResult(0, build,PlayerInfoProto.ViewHeroInfoResponse.class);
if(rewardResponse==null){
rewardResponse = PlayerInfoProto.ViewHeroInfoResponse.newBuilder().build();
//非跨服功能的查看
SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(proto.getTargetUid());
if(sArenaRobotConfig!=null){
PlayerLogic.getInstance().viewRobotHeroInfo(iSession,sArenaRobotConfig,proto.getHeroId());
return;
}
// PlayerInfoProto.ViewHeroInfoResponse viewHeroInfoResponse = PlayerInfoProto.ViewHeroInfoResponse.newBuilder().addAllEquip(rewardResponse.getEquipList())
// .setHero(rewardResponse.getHero()).setForce(rewardResponse.getForce())
// .setGuildSkill(rewardResponse.getGuildSkill()).addAllSpecialEffects(rewardResponse.getSpecialEffectsList()).build();
int resMsgId = MessageTypeProto.MessageType.VIEW_HERO_INFO_RESPONSE_VALUE;
MessageUtil.sendMessage(iSession,1,resMsgId,rewardResponse,true);
}else {
PlayerInfoProto.ViewHeroInfoResponse viewHeroInfoResponse = PlayerLogic.getInstance().viewHeroInfo(proto.getTargetUid(), proto.getHeroId());
int resMsgId = MessageTypeProto.MessageType.VIEW_HERO_INFO_RESPONSE_VALUE;
MessageUtil.sendMessage(iSession,1,resMsgId,viewHeroInfoResponse,true);
}
}else{
if(proto.getServerId()!=1){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
//1 跨服功能的查看
if(proto.getTargetUid()<1000){
//机器人
CrossArenaEnemy info = RedisUtil.getInstence().getMapEntry(RedisKey.CROSS_ARENA_ROBOT_INFO, String.valueOf(GlobleSystemLogic.getInstence().getCrossGroup()), String.valueOf(proto.getTargetUid()), CrossArenaEnemy.class);
if(info==null){
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE);
}
SArenaRobotConfig sArenaRobotConfig = SArenaRobotConfig.getsArenaRobotConfigById(info.getEnemyId());
PlayerLogic.getInstance().viewRobotHeroInfo(iSession,sArenaRobotConfig,proto.getHeroId());
}else{
//真人
}
}
}
}

View File

@ -718,6 +718,37 @@ public class PlayerLogic {
}
//查看跨服英雄信息
public PlayerInfoProto.ViewHeroInfoResponse viewCrossHeroInfo(int uid,String heroId) throws Exception {
ArenaOfUser query = CrossServiceLogic.getInstance().query(uid);
Map<String, ArenaOfHero> heros = query.getHeroManager().getHeros();
ArenaOfHero hero = heros.get(heroId);
if(hero == null){
throw new ErrorCodeException(ErrorCode.newDefineCode("hero no"));
}
PlayerInfoProto.ViewHeroInfoResponse.Builder builder = PlayerInfoProto.ViewHeroInfoResponse.newBuilder();
Map<Integer, Long> heroNotBufferAttribute = hero.getAttributeMap();
for(Map.Entry<Integer,Long> item : heroNotBufferAttribute.entrySet()){
builder.addSpecialEffects(CommonProto.SpecialEffects.newBuilder().setPropertyId(item.getKey()).setPropertyValue(item.getValue().intValue()).build());
}
Map<String, PropertyItem> jewels = query.getHeroManager().getJewels();
for(String equipId : hero.getJewelInfo()){
builder.addEquip(CBean2Proto.getEquipProto(jewels.get(equipId)));
}
for(int equipId : hero.getEquipByPositionMap().values()){
builder.addEquip(CBean2Proto.getEquipProto(equipId));
}
builder.setForce(HeroLogic.getInstance().calForce(heroNotBufferAttribute));
CommonProto.Hero.Builder heroBuilder = CommonProto.Hero.newBuilder().setLevel(hero.getLevel()).setEspecialEquipLevel(hero.getEspecialEquipLevel()).setStar(hero.getStar()).setId(hero.getId()).setHeroId(hero.getTemplateId()).setBreakId(hero.getBreakId()).setStarBreakId(hero.getStarBreakId());
builder.setHero(heroBuilder);
return builder.build();
}
public void takeSevenScoreReward(ISession iSession) throws Exception {
User user = UserManager.getUser(iSession.getUid());
int msgId = MessageTypeProto.MessageType.TAKE_SEVEN_HAPPY_REWARD_RESPONSE_VALUE;