助战修改

master_otnew
PC-202302260912\Administrator 2023-10-19 18:23:44 +08:00
parent c3c9d51e7f
commit cda5c9121b
4 changed files with 19 additions and 47 deletions

View File

@ -62,12 +62,13 @@ public class FourChallengeLogic {
}
// 四灵试炼编队初始化
public static Set<Integer> fourTeamList = new HashSet<>(4);
static {
public static Set<Integer> getFourTeamList(){
Set<Integer> fourTeamList = new HashSet<>(4);
fourTeamList.add(TeamEnum.FOURCHALLENGE_PEOPLE_TEAM.getTeamId());
fourTeamList.add(TeamEnum.FOURCHALLENGE_BUDDHA_TEAM.getTeamId());
fourTeamList.add(TeamEnum.FOURCHALLENGE_MONSTER_TEAM.getTeamId());
fourTeamList.add(TeamEnum.FOURCHALLENGE_MORALITY_TEAM.getTeamId());
return fourTeamList;
}
/**
@ -182,7 +183,7 @@ public class FourChallengeLogic {
//编队检测
List<TeamPosHeroInfo> teamPosHeroInfos = user.getTeamPosManager().getTeamPosForHero().get(teamId);
if (teamPosHeroInfos == null || teamPosHeroInfos.size() == 0) {
if (teamPosHeroInfos == null || teamPosHeroInfos.isEmpty()) {
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"挑战编队为空");
}
@ -338,7 +339,7 @@ public class FourChallengeLogic {
*
*/
public static boolean isFourChallengeTeam(int teamId){
return fourTeamList.contains(teamId);
return getFourTeamList().contains(teamId);
}
/**
@ -435,7 +436,7 @@ public class FourChallengeLogic {
}
/**
* keyid
* key id
* fc()_(/)__
*/
public static String getKey(int type, int camp, int tier){

View File

@ -122,7 +122,7 @@ public class TeamPosManager extends MongoBase {
public void removeTeamPosByHeroId(int teamId,String heroId){
// 根据队伍id获取列表
List<TeamPosHeroInfo> teamPosHeroInfos = teamPosForHero.get(teamId);
if (teamPosHeroInfos == null || teamPosHeroInfos.size() == 0){
if (teamPosHeroInfos == null || teamPosHeroInfos.isEmpty()){
return;
}
// 只能用iterator循环删除其他的循环回报错
@ -141,9 +141,9 @@ public class TeamPosManager extends MongoBase {
*/
public void clearTeamPosByFourChallenge(User user){
Map<String, Hero> heroMap = user.getHeroManager().getHeroMap();
for (Integer teamId : FourChallengeLogic.fourTeamList) {
for (Integer teamId : FourChallengeLogic.getFourTeamList()) {
List<TeamPosHeroInfo> teamPosHeroInfos = teamPosForHero.get(teamId);
if (teamPosHeroInfos == null || teamPosHeroInfos.size() == 0){
if (teamPosHeroInfos == null || teamPosHeroInfos.isEmpty()){
continue;
}
// 只能用iterator循环删除其他的循环回报错

View File

@ -61,9 +61,6 @@ public class HelpHeroLogic {
/**
*
* @param user
* @param typeEnum
* @return
*/
public Set<CommonProto.HelpFightList> getHelpFightList(User user,HelpTypeEnum typeEnum) throws Exception{
@ -134,7 +131,7 @@ public class HelpHeroLogic {
List<String> strings = result.stream().map(v -> v.getHero().getId()).collect(Collectors.toList());
// 获取subkey拿到英雄数据
String subKey1 = HelpHeroLogic.subKey(user.getId(),HelpHeroLogic.CHOOSE);
HelpHero helpHero = getHelpHeroMap(subKey1).get(String.valueOf(typeEnum.getPropertyId()));
HelpHero helpHero = getHelpHero(subKey1, typeEnum.getPropertyId());
// 英雄不存在添加
if (helpHero != null && !strings.contains(helpHero.getHero().getId())){
result.add(CBean2Proto.helpHeroProto(helpHero));
@ -145,9 +142,6 @@ public class HelpHeroLogic {
/**
*
* @param user
* @param heroId
* @throws Exception
*/
public CommonProto.Drop addHelpFightList(User user,String heroId) throws Exception{
Hero hero = user.getHeroManager().getHero(heroId);
@ -159,7 +153,7 @@ public class HelpHeroLogic {
int propertyName = hero.getPropertyId();
// 自己的助战列表
String subKey = subKey(user.getId(), MY);
HelpHero helpHero = getHelpHeroMap(subKey).get(String.valueOf(propertyName));
HelpHero helpHero = getHelpHero(subKey, propertyName);
if (helpHero != null){
throw new ErrorCodeException(ErrorCode.SYS_ERROR_CODE,"已选择其他神将!");
}
@ -181,14 +175,11 @@ public class HelpHeroLogic {
/**
* 使
* @param user
* @param heroId
* @throws Exception
*/
public void useHelpHero(User user,String heroId,int type,int status) throws Exception{
// 该类型的助战使用状态
String subKey = subKey(user.getId(), CHOOSE);
HelpHero helpHero = getHelpHeroMap(subKey).get(String.valueOf(type));
HelpHero helpHero = getHelpHero(subKey,type);
// 选择助战
if (status == 1) {
if (helpHero != null){
@ -226,8 +217,6 @@ public class HelpHeroLogic {
/**
* 使
* @param helpHero
* @throws Exception
*/
public void useHelpSendReward(HelpHero helpHero) throws Exception {
// 获取全部助战列表
@ -258,7 +247,6 @@ public class HelpHeroLogic {
/**
*
* @param user
*/
public void clearHelpInfo(User user){
// 领取奖励次数
@ -269,8 +257,6 @@ public class HelpHeroLogic {
/**
*
* @param subKey
* @param type
*/
public static void removeHelpHero(String subKey, int type){
RedisUtil.getInstence().removeMapEntrys(RedisKey.HELP_FIGHT, subKey, String.valueOf(type));
@ -278,9 +264,6 @@ public class HelpHeroLogic {
/**
* id
* @param uid
* @param heroId
* @return
*/
public static HelpHero getHelpHeroByHeroId(int uid,String heroId){
String subKey = HelpHeroLogic.subKey(uid,HelpHeroLogic.CHOOSE);
@ -295,18 +278,20 @@ public class HelpHeroLogic {
/**
*
* @param subKey
* @return
*/
public static Map<String,HelpHero> getHelpHeroMap(String subKey){
return RedisUtil.getInstence().getMapValues(RedisKey.HELP_FIGHT, subKey, String.class, HelpHero.class);
}
/**
*
*/
public static HelpHero getHelpHero(String subKey, int type){
return getHelpHeroMap(subKey).get(String.valueOf(type));
}
/**
*
* @param subKey
* @param type
* @param helpHero
*/
public static void addHelpHero(String subKey, int type, HelpHero helpHero){
String key = RedisUtil.getInstence().getKey(RedisKey.HELP_FIGHT, subKey);
@ -317,19 +302,6 @@ public class HelpHeroLogic {
RedisUtil.getInstence().expireMills(key, time);
}
/**
* redis
*/
// public void zeroClearRedisHelp(){
// try {
// String pattern = GameApplication.serverId +":" + RedisKey.HELP_FIGHT + ".*";
// RedisUtil.getInstence().delVague(RedisKey.HELP_FIGHT_DELETE,pattern);
// }catch (Exception e){
// LOGGER.error("零点清理助战信息报错,{}",e.getMessage());
// e.printStackTrace();
// }
// }
/**
*
* @param me

View File

@ -203,7 +203,6 @@ public class MinuteTask extends Thread {
}
}
//每分钟异步上报在线人数
private void reportUserOnline() {
new OnlineUserReportTask().start();