parent
b74e3525a7
commit
222c10252b
|
@ -287,7 +287,7 @@ public class EndExpeditionBattleRequest extends BaseHandler<Expedition.EndExpedi
|
|||
throw new ErrorCodeException("试炼节点英雄掉落失败");
|
||||
}
|
||||
Hero hero1 = ExpeditionLogic.createRandomHero(user,hero,heroTid,level,-1,2);
|
||||
drop.addHero(CBean2Proto.getHero(user,hero1));
|
||||
drop.addHero(CBean2Proto.getHero(hero1));
|
||||
for(Integer equipId : hero1.getEquipByPositionMap().values()){
|
||||
drop.addEquipId(CBean2Proto.getEquipProto(equipId));
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ public class GetExpeditionRequestHandler extends BaseHandler<Expedition.GetExped
|
|||
List<CommonProto.Hero> heroList = new ArrayList<>();
|
||||
Map<String, Hero> heroMap = user.getExpeditionManager().getHeroMap();
|
||||
for(Hero hero : heroMap.values()){
|
||||
heroList.add(CBean2Proto.getHero(user,hero));
|
||||
heroList.add(CBean2Proto.getHero(hero));
|
||||
}
|
||||
builder.addAllHeroList(heroList);
|
||||
Map<String, PropertyItem> equipMap = user.getExpeditionManager().getEquipMap();
|
||||
|
|
|
@ -110,7 +110,7 @@ public class HeroNodeGetInfoRequestHandler extends BaseHandler<Expedition.HeroNo
|
|||
// 英雄战力
|
||||
inner.setForce(HeroLogic.getInstance().calForce(heroNotBufferAttribute));
|
||||
// 英雄
|
||||
inner.setHero(CBean2Proto.getHero(user,hero));
|
||||
inner.setHero(CBean2Proto.getHero(hero));
|
||||
builder.addViewHeroInfo(inner);
|
||||
user.getExpeditionManager().getGHeroSet().add(hero.getTemplateId());
|
||||
});
|
||||
|
|
|
@ -100,7 +100,7 @@ public class HeroNodeRequestHandler extends BaseHandler<Expedition.HeroNodeReque
|
|||
}
|
||||
|
||||
|
||||
drop.addHero(CBean2Proto.getHero(user,hero));
|
||||
drop.addHero(CBean2Proto.getHero(hero));
|
||||
|
||||
//clear temp
|
||||
// user.getExpeditionManager().clearEquipToTemp();
|
||||
|
|
|
@ -164,7 +164,7 @@ public class GMRequestHandler extends BaseHandler{
|
|||
}
|
||||
hero.setBreakId(breakId);
|
||||
}
|
||||
CommonProto.Hero finalHeroProto = CBean2Proto.getHero(cUser,hero);
|
||||
CommonProto.Hero finalHeroProto = CBean2Proto.getHero(hero);
|
||||
gmBuilder.setDrop(CommonProto.Drop.newBuilder().addHero(finalHeroProto).build());
|
||||
|
||||
break;
|
||||
|
@ -366,7 +366,7 @@ public class GMRequestHandler extends BaseHandler{
|
|||
heroTmp.setBreakId(scHeroRankUpConfigBreak.getId());
|
||||
}
|
||||
}
|
||||
gmBuilder.setDrop(CommonProto.Drop.newBuilder().addHero(CBean2Proto.getHero(cUser,heroTmp)).build());
|
||||
gmBuilder.setDrop(CommonProto.Drop.newBuilder().addHero(CBean2Proto.getHero(heroTmp)).build());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ public class GetAllHerosHandler extends BaseHandler{
|
|||
}
|
||||
}
|
||||
}
|
||||
heroList.add(CBean2Proto.getHero(user,hero));
|
||||
heroList.add(CBean2Proto.getHero(hero));
|
||||
}
|
||||
boolean isSendFinish = false;
|
||||
int endIndex = startIndex + Global.SEND_CARD_COUNT;
|
||||
|
|
|
@ -70,7 +70,7 @@ public class DoHeroChangeRequestHandler extends BaseHandler<HeroInfoProto.DoHer
|
|||
newHero.setEquipByPositionMap(hero.getEquipByPositionMap());
|
||||
newHero.setJewelInfo(hero.getJewelInfo());
|
||||
user.getHeroManager().addHero(newHero);
|
||||
drop.addHero(CBean2Proto.getHero(user,newHero));
|
||||
drop.addHero(CBean2Proto.getHero(newHero));
|
||||
//新头像
|
||||
SItem sItem = SItem.getsItemMap().get(hero.getChangeId());
|
||||
if(sItem != null){
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.google.protobuf.GeneratedMessage;
|
|||
import com.ljsd.jieling.exception.ErrorCode;
|
||||
import com.ljsd.jieling.exception.ErrorCodeException;
|
||||
import com.ljsd.jieling.handler.BaseHandler;
|
||||
import com.ljsd.jieling.logic.dao.Hero;
|
||||
import com.ljsd.jieling.logic.dao.PurpleMansionSeal;
|
||||
import com.ljsd.jieling.logic.dao.UserManager;
|
||||
import com.ljsd.jieling.logic.dao.root.User;
|
||||
|
@ -17,6 +18,8 @@ import rpc.protocols.MessageTypeProto;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Author hj
|
||||
* @Description 修改神印状态
|
||||
|
@ -45,52 +48,55 @@ public class ReplacePurpleMansionSealHandler extends BaseHandler<HeroInfoProto.R
|
|||
}
|
||||
|
||||
// 获取参数
|
||||
int oldSealId = proto.getOldSealId();
|
||||
int newSealId = proto.getNewSealId();
|
||||
String subId = proto.getSubId();
|
||||
int oneSeal = proto.getOldSealId();
|
||||
// two 必须是存在的值
|
||||
int twoSeal = proto.getNewSealId();
|
||||
|
||||
String heroId = proto.getSubId();
|
||||
// subId 不能为null
|
||||
heroId = heroId == null?"":heroId;
|
||||
|
||||
// 神印列表
|
||||
Map<Integer, PurpleMansionSeal> sealMap = user.getHeroManager().getPurpleMansionSeal();
|
||||
|
||||
// 替换神印
|
||||
if (oldSealId != newSealId){
|
||||
PurpleMansionSeal newSeal = sealMap.get(newSealId);
|
||||
if (newSeal == null){
|
||||
throw new ErrorCodeException("神印不存在!");
|
||||
}
|
||||
if (newSeal.getType() == 1 && (subId == null || "".equals(subId))){
|
||||
throw new ErrorCodeException("英雄id不能为空!");
|
||||
}
|
||||
PurpleMansionSeal seal = sealMap.get(twoSeal);
|
||||
if (seal == null){
|
||||
throw new ErrorCodeException("神印不存在!");
|
||||
}
|
||||
if (seal.getType() == 1 && "".equals(heroId)){
|
||||
throw new ErrorCodeException("英雄id不能为空!");
|
||||
}
|
||||
|
||||
// 使用神印
|
||||
if (oneSeal != twoSeal){
|
||||
// 旧神印状态修改
|
||||
PurpleMansionSeal oldSeal = sealMap.get(oldSealId);
|
||||
PurpleMansionSeal oldSeal = sealMap.get(oneSeal);
|
||||
if (oldSeal != null){
|
||||
oldSeal.setState(0);
|
||||
user.getHeroManager().putPurpleMansionSeal(oldSeal);
|
||||
}
|
||||
|
||||
// 新神印状态修改
|
||||
newSeal.setState(1);
|
||||
// 附属英雄id修改,类型之后需要读表
|
||||
if (!newSeal.getSubId().equals(subId) && newSeal.getType() == 1){
|
||||
newSeal.setSubId(subId);
|
||||
}
|
||||
user.getHeroManager().putPurpleMansionSeal(newSeal);
|
||||
seal.setState(1);
|
||||
}
|
||||
// 相同神印
|
||||
else {
|
||||
PurpleMansionSeal seal = sealMap.get(newSealId);
|
||||
// 卸载神印
|
||||
if (seal.getSubId().equals(subId)){
|
||||
seal.setState(0);
|
||||
|
||||
// 卸载神印
|
||||
if (oneSeal == twoSeal && seal.getSubId().equals(heroId)){
|
||||
seal.setState(0);
|
||||
}
|
||||
|
||||
// 附身神印,替换英雄id
|
||||
if (oneSeal == twoSeal && !seal.getSubId().equals(heroId)){
|
||||
if (seal.getType() != 1){
|
||||
throw new ErrorCodeException("神印类型错误!");
|
||||
}
|
||||
// 替换英雄id
|
||||
else {
|
||||
if (seal.getType() != 1){
|
||||
throw new ErrorCodeException("神印类型错误!");
|
||||
// seal update
|
||||
for (PurpleMansionSeal value : sealMap.values()) {
|
||||
if (value.getSubId().equals(heroId)){
|
||||
value.setSubId("");
|
||||
value.setState(0);
|
||||
break;
|
||||
}
|
||||
seal.setSubId(subId);
|
||||
}
|
||||
user.getHeroManager().putPurpleMansionSeal(seal);
|
||||
seal.setSubId(heroId);
|
||||
}
|
||||
|
||||
// 返回最新神印列表
|
||||
|
|
|
@ -500,12 +500,19 @@ public class PlayerLogic {
|
|||
CommonProto.TeamOneInfo.Builder oneInfo = CBean2Proto.getTeamOneInfo(user);
|
||||
TeamPosManager teamPosManager = user.getTeamPosManager();
|
||||
CommonProto.TeamOneTeamInfo.Builder teamInfo = CommonProto.TeamOneTeamInfo.newBuilder();
|
||||
// 总战力
|
||||
teamInfo.setTotalForce(HeroLogic.getInstance().calTeamTotalForce(user,teamId,false));
|
||||
if(teamPosManager.getTeamPosForHero().containsKey(teamId)){
|
||||
for (TeamPosHeroInfo heroInfo:teamPosManager.getTeamPosForHero().get(teamId)) {
|
||||
// 添加队伍信息
|
||||
List<TeamPosHeroInfo> heroInfos = teamPosManager.getTeamPosForHero().get(teamId);
|
||||
for (TeamPosHeroInfo heroInfo:heroInfos) {
|
||||
Hero hero = user.getHeroManager().getHero(heroInfo.getHeroId());
|
||||
teamInfo.addTeam(CBean2Proto.getSimpleTeamInfoByHero(user, hero,heroInfo.getPosition()));
|
||||
}
|
||||
|
||||
// 紫府神印
|
||||
List<String> collect = heroInfos.stream().map(TeamPosHeroInfo::getHeroId).collect(Collectors.toList());
|
||||
teamInfo.addAllSealShow(CBean2Proto.getPurpleSealShow(user,collect));
|
||||
}
|
||||
//加入灵兽信息
|
||||
PokemonManager pokemonManager = user.getPokemonManager();
|
||||
|
@ -619,7 +626,7 @@ public class PlayerLogic {
|
|||
builder.addEquip(CBean2Proto.getEquipProto(equipId));
|
||||
}
|
||||
builder.setForce(HeroLogic.getInstance().calForce(heroNotBufferAttribute));
|
||||
builder.setHero(CBean2Proto.getHero(userInMem,hero));
|
||||
builder.setHero(CBean2Proto.getHero(hero));
|
||||
Map<Integer, Integer> guildSkill = userInMem.getGuildMyInfo().getGuildSkill();
|
||||
int profession = SCHero.getsCHero().get(hero.getTemplateId()).getProfession();
|
||||
Integer skill = guildSkill.getOrDefault(profession, 0);
|
||||
|
|
|
@ -206,7 +206,7 @@ public class CBean2Proto {
|
|||
return userMountLists;
|
||||
}
|
||||
|
||||
public static CommonProto.Hero getHero(User user, Hero hero){
|
||||
public static CommonProto.Hero getHero(Hero hero){
|
||||
List<CommonProto.SoulPos> soulPoss = new ArrayList<>();
|
||||
Map<Integer, Integer> soulEquipMap = hero.getSoulEquipByPositionMap();
|
||||
if(soulEquipMap!=null&&!soulEquipMap.isEmpty()){
|
||||
|
@ -235,7 +235,6 @@ public class CBean2Proto {
|
|||
.setCreatetype(hero.getCreateType())
|
||||
.setChangeId(hero.getChangeId())
|
||||
.setSkinId(hero.getSkin())
|
||||
.addAllSealIdList(getSealIdListByHero(user,hero))
|
||||
.build();
|
||||
}
|
||||
|
||||
|
@ -744,20 +743,40 @@ public class CBean2Proto {
|
|||
/**
|
||||
* 获取英雄身上的神印id列表
|
||||
* @param user
|
||||
* @param hero
|
||||
* @param heroIds
|
||||
* @return
|
||||
*/
|
||||
private static List<Integer> getSealIdListByHero(User user, Hero hero){
|
||||
ArrayList<Integer> list = new ArrayList<>();
|
||||
public static List<CommonProto.PurpleSealShowInfo> getPurpleSealShow(User user, List<String> heroIds){
|
||||
List<CommonProto.PurpleSealShowInfo> list = new ArrayList<>();
|
||||
// 已解锁的神印列表
|
||||
Collection<PurpleMansionSeal> values = user.getHeroManager().getPurpleMansionSeal().values();
|
||||
for (PurpleMansionSeal v : values) {
|
||||
values.forEach(v->{
|
||||
// 使用中的神印
|
||||
if (v.getState() == 1){
|
||||
if (v.getType() == 1 && !v.getSubId().equals(hero.getId())){
|
||||
continue;
|
||||
CommonProto.PurpleSealShowInfo builder;
|
||||
// 通用神印
|
||||
if (v.getType() == 0){
|
||||
builder = CommonProto.PurpleSealShowInfo.newBuilder()
|
||||
.setId(v.getSealId())
|
||||
.setType(v.getType())
|
||||
.setHeroTId(0)
|
||||
.build();
|
||||
list.add(builder);
|
||||
}
|
||||
// 附身神印需要
|
||||
else if (v.getType() == 1) {
|
||||
if (heroIds.contains(v.getSubId()) && !"".equals(v.getSubId()) && v.getSubId() != null){
|
||||
Hero hero = user.getHeroManager().getHero(v.getSubId());
|
||||
builder = CommonProto.PurpleSealShowInfo.newBuilder()
|
||||
.setId(v.getSealId())
|
||||
.setType(v.getType())
|
||||
.setHeroTId(hero.getTemplateId())
|
||||
.build();
|
||||
list.add(builder);
|
||||
}
|
||||
}
|
||||
list.add(v.getSealId());
|
||||
}
|
||||
}
|
||||
});
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1276,7 +1276,7 @@ public class ItemUtil {
|
|||
heroManager.addHero(hero);
|
||||
// 鸿蒙阵推送
|
||||
HeroLogic.getInstance().addOrUpdateHongmeng(OnlineUserManager.getSessionByUid(user.getId()));
|
||||
heroList.add(CBean2Proto.getHero(user,hero));
|
||||
heroList.add(CBean2Proto.getHero(hero));
|
||||
SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId());
|
||||
if (scHero.getStar() >= SSpecialConfig.getIntegerValue(SSpecialConfig.lamp_lottery_content_parm)) { //策划资质改成星级
|
||||
String message = SErrorCodeEerverConfig.getI18NMessageNeedConvert("lamp_lottery_content", new Object[]{playerInfoManager.getNickName(), scHero.getStar(), scHero.getReadingName()},new int[]{0,0,1});
|
||||
|
|
Loading…
Reference in New Issue