助战bug修改
parent
79936df349
commit
d1815b4e8c
|
@ -14,6 +14,7 @@ import rpc.protocols.MessageTypeProto;
|
||||||
import rpc.protocols.PlayerInfoProto;
|
import rpc.protocols.PlayerInfoProto;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hj
|
* @author hj
|
||||||
|
@ -38,7 +39,7 @@ public class GetHelpHeroListHandler extends BaseHandler<PlayerInfoProto.GetHelpH
|
||||||
// 根据类型获取枚举对象
|
// 根据类型获取枚举对象
|
||||||
HelpTypeEnum type = HelpTypeEnum.getType(proto.getType());
|
HelpTypeEnum type = HelpTypeEnum.getType(proto.getType());
|
||||||
|
|
||||||
List<CommonProto.HelpFightList> helpFightList = HelpHeroLogic.getInstance().getHelpFightList(user, type);
|
Set<CommonProto.HelpFightList> helpFightList = HelpHeroLogic.getInstance().getHelpFightList(user, type);
|
||||||
|
|
||||||
return PlayerInfoProto.GetHelpHeroListResponse.newBuilder().addAllHelpHeros(helpFightList).build();
|
return PlayerInfoProto.GetHelpHeroListResponse.newBuilder().addAllHelpHeros(helpFightList).build();
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,9 +67,9 @@ public class HelpHeroLogic {
|
||||||
* @param typeEnum
|
* @param typeEnum
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<CommonProto.HelpFightList> getHelpFightList(User user,HelpTypeEnum typeEnum) throws Exception{
|
public Set<CommonProto.HelpFightList> getHelpFightList(User user,HelpTypeEnum typeEnum) throws Exception{
|
||||||
|
|
||||||
List<CommonProto.HelpFightList> result = new ArrayList<>();
|
HashSet<CommonProto.HelpFightList> result = new HashSet<>();
|
||||||
|
|
||||||
// 如果类型是自己,则使用uid
|
// 如果类型是自己,则使用uid
|
||||||
String subKey = typeEnum==Me?getSubKey(user.getId(),MY):String.valueOf(typeEnum.getPropertyId());
|
String subKey = typeEnum==Me?getSubKey(user.getId(),MY):String.valueOf(typeEnum.getPropertyId());
|
||||||
|
@ -130,6 +130,11 @@ public class HelpHeroLogic {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 已选中的助战
|
||||||
|
HelpHero helpHero = getHelpHeroByType(user.getId(), typeEnum.getPropertyId());
|
||||||
|
if (helpHero != null){
|
||||||
|
result.add(CBean2Proto.helpHeroProto(helpHero));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -225,21 +225,16 @@ public class CBean2Proto {
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static List<CommonProto.HelpFightList> getHelpFightList(User user){
|
public static List<CommonProto.HelpFightList> getHelpFightList(User user) throws Exception {
|
||||||
List<CommonProto.HelpFightList> lists = new ArrayList<>();
|
List<CommonProto.HelpFightList> lists = new ArrayList<>();
|
||||||
// 助战英雄列表
|
// 助战英雄列表
|
||||||
Map<String, HelpHero> helpHeros = HelpHeroLogic.getHelpHeroMap(user.getId());
|
Map<String, HelpHero> helpHeroMap = HelpHeroLogic.getHelpHeroMap(user.getId());
|
||||||
if (helpHeros == null || helpHeros.isEmpty()){
|
if (helpHeroMap == null || helpHeroMap.isEmpty()){
|
||||||
return lists;
|
return lists;
|
||||||
}
|
}
|
||||||
|
for (HelpHero hero : helpHeroMap.values()) {
|
||||||
helpHeros.values().forEach(v-> {
|
lists.add(helpHeroProto(hero));
|
||||||
try {
|
}
|
||||||
lists.add(helpHeroProto(v));
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOGGER.error("助战英雄转换类型时报错:{}",e.getMessage());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return lists;
|
return lists;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue