助战修改
parent
c3c9d51e7f
commit
cda5c9121b
|
|
@ -62,12 +62,13 @@ public class FourChallengeLogic {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 四灵试炼编队初始化
|
// 四灵试炼编队初始化
|
||||||
public static Set<Integer> fourTeamList = new HashSet<>(4);
|
public static Set<Integer> getFourTeamList(){
|
||||||
static {
|
Set<Integer> fourTeamList = new HashSet<>(4);
|
||||||
fourTeamList.add(TeamEnum.FOURCHALLENGE_PEOPLE_TEAM.getTeamId());
|
fourTeamList.add(TeamEnum.FOURCHALLENGE_PEOPLE_TEAM.getTeamId());
|
||||||
fourTeamList.add(TeamEnum.FOURCHALLENGE_BUDDHA_TEAM.getTeamId());
|
fourTeamList.add(TeamEnum.FOURCHALLENGE_BUDDHA_TEAM.getTeamId());
|
||||||
fourTeamList.add(TeamEnum.FOURCHALLENGE_MONSTER_TEAM.getTeamId());
|
fourTeamList.add(TeamEnum.FOURCHALLENGE_MONSTER_TEAM.getTeamId());
|
||||||
fourTeamList.add(TeamEnum.FOURCHALLENGE_MORALITY_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);
|
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,"挑战编队为空");
|
throw new ErrorCodeException(ErrorCode.SERVER_SELF_DEFINE,"挑战编队为空");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -338,7 +339,7 @@ public class FourChallengeLogic {
|
||||||
* 是否时四灵试炼编队
|
* 是否时四灵试炼编队
|
||||||
*/
|
*/
|
||||||
public static boolean isFourChallengeTeam(int teamId){
|
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(四灵试炼标识)_类型(首通/最低)_阵营(人佛妖道)_层数
|
* fc(四灵试炼标识)_类型(首通/最低)_阵营(人佛妖道)_层数
|
||||||
*/
|
*/
|
||||||
public static String getKey(int type, int camp, int tier){
|
public static String getKey(int type, int camp, int tier){
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ public class TeamPosManager extends MongoBase {
|
||||||
public void removeTeamPosByHeroId(int teamId,String heroId){
|
public void removeTeamPosByHeroId(int teamId,String heroId){
|
||||||
// 根据队伍id获取列表
|
// 根据队伍id获取列表
|
||||||
List<TeamPosHeroInfo> teamPosHeroInfos = teamPosForHero.get(teamId);
|
List<TeamPosHeroInfo> teamPosHeroInfos = teamPosForHero.get(teamId);
|
||||||
if (teamPosHeroInfos == null || teamPosHeroInfos.size() == 0){
|
if (teamPosHeroInfos == null || teamPosHeroInfos.isEmpty()){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 只能用iterator循环删除,其他的循环回报错
|
// 只能用iterator循环删除,其他的循环回报错
|
||||||
|
|
@ -141,9 +141,9 @@ public class TeamPosManager extends MongoBase {
|
||||||
*/
|
*/
|
||||||
public void clearTeamPosByFourChallenge(User user){
|
public void clearTeamPosByFourChallenge(User user){
|
||||||
Map<String, Hero> heroMap = user.getHeroManager().getHeroMap();
|
Map<String, Hero> heroMap = user.getHeroManager().getHeroMap();
|
||||||
for (Integer teamId : FourChallengeLogic.fourTeamList) {
|
for (Integer teamId : FourChallengeLogic.getFourTeamList()) {
|
||||||
List<TeamPosHeroInfo> teamPosHeroInfos = teamPosForHero.get(teamId);
|
List<TeamPosHeroInfo> teamPosHeroInfos = teamPosForHero.get(teamId);
|
||||||
if (teamPosHeroInfos == null || teamPosHeroInfos.size() == 0){
|
if (teamPosHeroInfos == null || teamPosHeroInfos.isEmpty()){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 只能用iterator循环删除,其他的循环回报错
|
// 只能用iterator循环删除,其他的循环回报错
|
||||||
|
|
|
||||||
|
|
@ -61,9 +61,6 @@ public class HelpHeroLogic {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据类型获取助战列表
|
* 根据类型获取助战列表
|
||||||
* @param user
|
|
||||||
* @param typeEnum
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public Set<CommonProto.HelpFightList> getHelpFightList(User user,HelpTypeEnum typeEnum) throws Exception{
|
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());
|
List<String> strings = result.stream().map(v -> v.getHero().getId()).collect(Collectors.toList());
|
||||||
// 获取subkey,拿到英雄数据
|
// 获取subkey,拿到英雄数据
|
||||||
String subKey1 = HelpHeroLogic.subKey(user.getId(),HelpHeroLogic.CHOOSE);
|
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())){
|
if (helpHero != null && !strings.contains(helpHero.getHero().getId())){
|
||||||
result.add(CBean2Proto.helpHeroProto(helpHero));
|
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{
|
public CommonProto.Drop addHelpFightList(User user,String heroId) throws Exception{
|
||||||
Hero hero = user.getHeroManager().getHero(heroId);
|
Hero hero = user.getHeroManager().getHero(heroId);
|
||||||
|
|
@ -159,7 +153,7 @@ public class HelpHeroLogic {
|
||||||
int propertyName = hero.getPropertyId();
|
int propertyName = hero.getPropertyId();
|
||||||
// 自己的助战列表
|
// 自己的助战列表
|
||||||
String subKey = subKey(user.getId(), MY);
|
String subKey = subKey(user.getId(), MY);
|
||||||
HelpHero helpHero = getHelpHeroMap(subKey).get(String.valueOf(propertyName));
|
HelpHero helpHero = getHelpHero(subKey, propertyName);
|
||||||
if (helpHero != null){
|
if (helpHero != null){
|
||||||
throw new ErrorCodeException(ErrorCode.SYS_ERROR_CODE,"已选择其他神将!");
|
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{
|
public void useHelpHero(User user,String heroId,int type,int status) throws Exception{
|
||||||
// 该类型的助战使用状态
|
// 该类型的助战使用状态
|
||||||
String subKey = subKey(user.getId(), CHOOSE);
|
String subKey = subKey(user.getId(), CHOOSE);
|
||||||
HelpHero helpHero = getHelpHeroMap(subKey).get(String.valueOf(type));
|
HelpHero helpHero = getHelpHero(subKey,type);
|
||||||
// 选择助战
|
// 选择助战
|
||||||
if (status == 1) {
|
if (status == 1) {
|
||||||
if (helpHero != null){
|
if (helpHero != null){
|
||||||
|
|
@ -226,8 +217,6 @@ public class HelpHeroLogic {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 使用助战发送奖励
|
* 使用助战发送奖励
|
||||||
* @param helpHero
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
*/
|
||||||
public void useHelpSendReward(HelpHero helpHero) throws Exception {
|
public void useHelpSendReward(HelpHero helpHero) throws Exception {
|
||||||
// 获取全部助战列表
|
// 获取全部助战列表
|
||||||
|
|
@ -258,7 +247,6 @@ public class HelpHeroLogic {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 每天零点清理助战信息
|
* 每天零点清理助战信息
|
||||||
* @param user
|
|
||||||
*/
|
*/
|
||||||
public void clearHelpInfo(User 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){
|
public static void removeHelpHero(String subKey, int type){
|
||||||
RedisUtil.getInstence().removeMapEntrys(RedisKey.HELP_FIGHT, subKey, String.valueOf(type));
|
RedisUtil.getInstence().removeMapEntrys(RedisKey.HELP_FIGHT, subKey, String.valueOf(type));
|
||||||
|
|
@ -278,9 +264,6 @@ public class HelpHeroLogic {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据英雄id获取助战英雄
|
* 根据英雄id获取助战英雄
|
||||||
* @param uid
|
|
||||||
* @param heroId
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
public static HelpHero getHelpHeroByHeroId(int uid,String heroId){
|
public static HelpHero getHelpHeroByHeroId(int uid,String heroId){
|
||||||
String subKey = HelpHeroLogic.subKey(uid,HelpHeroLogic.CHOOSE);
|
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){
|
public static Map<String,HelpHero> getHelpHeroMap(String subKey){
|
||||||
return RedisUtil.getInstence().getMapValues(RedisKey.HELP_FIGHT, subKey, String.class, HelpHero.class);
|
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){
|
public static void addHelpHero(String subKey, int type, HelpHero helpHero){
|
||||||
String key = RedisUtil.getInstence().getKey(RedisKey.HELP_FIGHT, subKey);
|
String key = RedisUtil.getInstence().getKey(RedisKey.HELP_FIGHT, subKey);
|
||||||
|
|
@ -317,19 +302,6 @@ public class HelpHeroLogic {
|
||||||
RedisUtil.getInstence().expireMills(key, time);
|
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
|
* @param me
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,6 @@ public class MinuteTask extends Thread {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//每分钟异步上报在线人数
|
//每分钟异步上报在线人数
|
||||||
private void reportUserOnline() {
|
private void reportUserOnline() {
|
||||||
new OnlineUserReportTask().start();
|
new OnlineUserReportTask().start();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue