助战异常,宝物报null,已处理
parent
73e8edece0
commit
ce5a23492e
|
@ -232,23 +232,33 @@ public class CBean2Proto {
|
||||||
return lists;
|
return lists;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编译助战状态
|
||||||
|
* @param propertyItems 装备列表
|
||||||
|
* @return proto对象
|
||||||
|
*/
|
||||||
|
private static List<CommonProto.Equip> buildHelpFightEquip(List<PropertyItem> propertyItems){
|
||||||
|
List<CommonProto.Equip> resultEquip = new ArrayList<>();
|
||||||
|
if (propertyItems != null && !propertyItems.isEmpty()){
|
||||||
|
for (PropertyItem item : propertyItems) {
|
||||||
|
if (item == null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
resultEquip.add(getPropertyEquipProto(item));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return resultEquip;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 助战,redis类型转proto
|
* 助战,redis类型转proto
|
||||||
*/
|
*/
|
||||||
public static CommonProto.HelpFightList helpHeroProto(HelpHero helpHero) throws Exception {
|
public static CommonProto.HelpFightList helpHeroProto(HelpHero helpHero) throws Exception {
|
||||||
User otherUser = UserManager.getUser(helpHero.getUid());
|
User otherUser = UserManager.getUser(helpHero.getUid());
|
||||||
// 魂宝灵宝
|
// 魂宝灵宝
|
||||||
List<CommonProto.Equip> jewels = new ArrayList<>();
|
List<CommonProto.Equip> jewels = buildHelpFightEquip(helpHero.getJewels());
|
||||||
List<PropertyItem> jewel = helpHero.getJewels();
|
|
||||||
if (jewel != null && !jewel.isEmpty()){
|
|
||||||
jewel.forEach(item->jewels.add(getPropertyEquipProto(item)));
|
|
||||||
}
|
|
||||||
// 法相
|
// 法相
|
||||||
List<CommonProto.Equip> faxiang = new ArrayList<>();
|
List<CommonProto.Equip> faxiang = buildHelpFightEquip(helpHero.getFaxiangs());
|
||||||
List<PropertyItem> faxiangs = helpHero.getFaxiangs();
|
|
||||||
if (faxiangs != null && !faxiangs.isEmpty()){
|
|
||||||
faxiangs.forEach(item->faxiang.add(getPropertyEquipProto(item)));
|
|
||||||
}
|
|
||||||
// 装备详细信息
|
// 装备详细信息
|
||||||
List<CommonProto.Equip> equips = new ArrayList<>();
|
List<CommonProto.Equip> equips = new ArrayList<>();
|
||||||
Map<Integer, Integer> equip = helpHero.getHero().getEquipByPositionMap();
|
Map<Integer, Integer> equip = helpHero.getHero().getEquipByPositionMap();
|
||||||
|
@ -286,7 +296,7 @@ public class CBean2Proto {
|
||||||
* 助战,hero对象转redis类型
|
* 助战,hero对象转redis类型
|
||||||
* 存入redis时调用
|
* 存入redis时调用
|
||||||
*/
|
*/
|
||||||
public static HelpHero heroToHelpHero(User user,Hero hero) throws Exception {
|
public static HelpHero heroToHelpHero(User user,Hero hero) {
|
||||||
// 获取神将类型
|
// 获取神将类型
|
||||||
HelpTypeEnum type = HelpTypeEnum.getType(hero.getPropertyId());
|
HelpTypeEnum type = HelpTypeEnum.getType(hero.getPropertyId());
|
||||||
// 英雄镜像
|
// 英雄镜像
|
||||||
|
@ -296,7 +306,6 @@ public class CBean2Proto {
|
||||||
List<PropertyItem> jewels = clonePropertyItemList(equipManager, heroVo.getJewelInfo());
|
List<PropertyItem> jewels = clonePropertyItemList(equipManager, heroVo.getJewelInfo());
|
||||||
// 法相
|
// 法相
|
||||||
List<PropertyItem> faxiangs = clonePropertyItemList(equipManager, heroVo.getFaxiangList());
|
List<PropertyItem> faxiangs = clonePropertyItemList(equipManager, heroVo.getFaxiangList());
|
||||||
|
|
||||||
// 结果返回,援助类型不在这里写
|
// 结果返回,援助类型不在这里写
|
||||||
HelpHero helpHero = new HelpHero();
|
HelpHero helpHero = new HelpHero();
|
||||||
helpHero.setUid(user.getId());
|
helpHero.setUid(user.getId());
|
||||||
|
|
Loading…
Reference in New Issue