公会战、公会功能修改

back_recharge
lvxinran 2019-08-31 20:32:37 +08:00
parent ca28591b48
commit 2d33fbb7f9
10 changed files with 185 additions and 117 deletions

View File

@ -18,6 +18,8 @@ public class SEndlessMapConfig implements BaseConfig {
private int deathCost; private int deathCost;
private int[] mapItem;
public static Map<Integer,SEndlessMapConfig> sEndlessMapConfigMap; public static Map<Integer,SEndlessMapConfig> sEndlessMapConfigMap;
@Override @Override

View File

@ -59,6 +59,8 @@ public class SGuildSetting implements BaseConfig {
private float expansionScore; private float expansionScore;
private int[] nameSize;
public static SGuildSetting sGuildSetting; public static SGuildSetting sGuildSetting;
@ -169,4 +171,8 @@ public class SGuildSetting implements BaseConfig {
public int[][] getSettleTime() { public int[][] getSettleTime() {
return settleTime; return settleTime;
} }
public int[] getNameSize() {
return nameSize;
}
} }

View File

@ -203,38 +203,29 @@ public class MapLogic {
if(type ==4){ if(type ==4){
mapEnterResponse.setCurXY(mapManager.getCurXY());
List<TeamPosHeroInfo> teamPosForHero = user.getTeamPosManager().getTeamPosForHero().get(teamId); List<TeamPosHeroInfo> teamPosForHero = user.getTeamPosManager().getTeamPosForHero().get(teamId);
for (int i = 0; i <teamPosForHero.size() ; i++) { for (int i = 0; i <teamPosForHero.size() ; i++) {
String endlessHeroId = teamPosForHero.get(i).getHeroId(); String endlessHeroId = teamPosForHero.get(i).getHeroId();
int maxHp = HeroLogic.getInstance().calHeroNotBufferAttribute(user,user.getHeroManager().getHero(endlessHeroId),true,teamId).get(1); int maxHp = HeroLogic.getInstance().calHeroNotBufferAttribute(user,user.getHeroManager().getHero(endlessHeroId),true,teamId).get(1);
mapManager.addEndlessHero(teamPosForHero.get(i).getHeroId(),maxHp); mapManager.addEndlessHero(teamPosForHero.get(i).getHeroId(),maxHp);
} }
if(mapManager.getEndlessMapInfo().getCurCell()!=0){
if(mapManager.getEndlessMapInfo().getCurMapId()==mapId) {
if(mapManager.getCurXY()!=0){
mapEnterResponse.setCurXY(mapManager.getCurXY());
}else{
mapEnterResponse.setCurXY(mapManager.getEndlessMapInfo().getCurCell());
}
}
}
EndlessMapInfo endlessMapInfo = mapManager.getEndlessMapInfo(); EndlessMapInfo endlessMapInfo = mapManager.getEndlessMapInfo();
if(endlessMapInfo.getSeason()!=endlessSeason){ // if(endlessMapInfo.getSeason()!=endlessSeason){
mapManager.updateEndlessSeason(endlessSeason); // mapManager.updateEndlessSeason(endlessSeason);
mapManager.updateEndlessMapId(0); // mapManager.updateEndlessMapId(0);
mapManager.endlessWalkCellSave(new HashSet<>()); // mapManager.endlessWalkCellSave(new HashSet<>());
mapManager.endlessMapInfoSave(new HashMap<>()); // mapManager.endlessMapInfoSave(new HashMap<>());
}else{ // }else{
Map<Integer, Cell> endlessMapCellInfo = mapManager.getEndlessMapInfo().getMapInfo(); // Map<Integer, Cell> endlessMapCellInfo = mapManager.getEndlessMapInfo().getMapInfo();
if(endlessMapCellInfo !=null&&endlessMapCellInfo.size()>0){ // if(endlessMapCellInfo !=null&&endlessMapCellInfo.size()>0){
mapManager.setMapInfo(endlessMapCellInfo); // mapManager.setMapInfo(endlessMapCellInfo);
} // }
Set<Integer> walkCell = mapManager.getEndlessMapInfo().getWalkCell(); // Set<Integer> walkCell = mapManager.getEndlessMapInfo().getWalkCell();
if(walkCell!=null&&walkCell.size()>0){ // if(walkCell!=null&&walkCell.size()>0){
mapManager.setWalkCells(walkCell); // mapManager.setWalkCells(walkCell);
} // }
} // }
mapManager.updateEndlessMapId(mapId); mapManager.updateEndlessMapId(mapId);
for(Map.Entry<Integer,Map<Integer,String>> entry :endlessMapInfo.getMapSign().entrySet()){ for(Map.Entry<Integer,Map<Integer,String>> entry :endlessMapInfo.getMapSign().entrySet()){
int curMapId = entry.getKey(); int curMapId = entry.getKey();
@ -442,11 +433,19 @@ public class MapLogic {
mapManager.setCurXY(xy); mapManager.setCurXY(xy);
} }
SChallengeMapConfig challengeMapConfig = SChallengeMapConfig.integerSChallengeMapConfigMap.get(mapManager.getCurMapId()); SChallengeMapConfig challengeMapConfig = SChallengeMapConfig.integerSChallengeMapConfigMap.get(mapManager.getCurMapId());
Mission mission = new Mission(); Mission mission = new Mission();
mission.setMissionId(challengeMapConfig.getMissionId()); mission.setMissionId(challengeMapConfig.getMissionId());
mission.setMissionStep(0); mission.setMissionStep(0);
mission.setTime(0); mission.setTime(0);
int xy = CellUtil.xy2Pos(challengeMapConfig.getPosition()[0], challengeMapConfig.getPosition()[1]); int xy = CellUtil.xy2Pos(challengeMapConfig.getPosition()[0], challengeMapConfig.getPosition()[1]);
SChallengeConfig sChallengeConfig = SChallengeConfig.sChallengeConfigs.get(mapManager.getCurMapId());
int type = sChallengeConfig.getType();
if(type==4){
if(mapManager.getEndlessMapInfo().getCurCell()!=0){
xy = mapManager.getEndlessMapInfo().getCurCell();
}
}
mapManager.setCurXY(xy); mapManager.setCurXY(xy);
mapManager.setMission(mission); mapManager.setMission(mission);
mapManager.setMapInfo(newMap); mapManager.setMapInfo(newMap);
@ -3056,7 +3055,7 @@ public class MapLogic {
if(heroEntry.getValue().getLevel()<20){ if(heroEntry.getValue().getLevel()<20){
continue; continue;
} }
int calHp = HeroLogic.getInstance().calHeroFinalAttributeWhenInMap(user, heroEntry.getValue(), true,401).get(1); int calHp = HeroLogic.getInstance().calHeroNotBufferAttribute(user, heroEntry.getValue(), false,401).get(1);
if(!endlessHeroInfo.containsKey(heroEntry.getKey())){ if(!endlessHeroInfo.containsKey(heroEntry.getKey())){
mapManager.addEndlessHero(heroEntry.getKey(),calHp); mapManager.addEndlessHero(heroEntry.getKey(),calHp);
} }

View File

@ -113,7 +113,7 @@ public class MapManager extends MongoBase {
private Map<Integer, Map<Integer,Integer>> monsterTempSkill = new HashMap<>(); private Map<Integer, Map<Integer,Integer>> monsterTempSkill = new HashMap<>();
//无尽副本信息 //无尽副本信息
private EndlessMapInfo endlessMapInfo; private EndlessMapInfo endlessMapInfo =new EndlessMapInfo();
private int lastXY; // 上一步坐标点 private int lastXY; // 上一步坐标点
@ -150,6 +150,10 @@ public class MapManager extends MongoBase {
updateString("mapInfo." + key, cell); updateString("mapInfo." + key, cell);
this.mapInfo.put(key, cell); this.mapInfo.put(key, cell);
} }
public void removeCell(int key){
mapInfo.remove(key);
removeString(getMongoKey()+".mapInfo."+key);
}
public void setMapInfo(Map<Integer, Cell> mapInfo) throws Exception { public void setMapInfo(Map<Integer, Cell> mapInfo) throws Exception {
updateString( "mapInfo", mapInfo); updateString( "mapInfo", mapInfo);

View File

@ -31,6 +31,8 @@ import org.springframework.data.redis.core.ZSetOperations;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.ljsd.jieling.config.SGuildSetting.sGuildSetting;
public class GuildFightLogic { public class GuildFightLogic {
private static final Logger LOGGER = LoggerFactory.getLogger(GuildFightLogic.class); private static final Logger LOGGER = LoggerFactory.getLogger(GuildFightLogic.class);
/** /**
@ -62,7 +64,7 @@ public class GuildFightLogic {
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(gid); GuildInfo guildInfo = GuilidManager.guildInfoMap.get(gid);
Map<Integer, Integer> defendInfo = guildInfo.getDefendInfo(); Map<Integer, Integer> defendInfo = guildInfo.getDefendInfo();
Family.FamilyDefendViewResponse.Builder response = Family.FamilyDefendViewResponse.newBuilder(); Family.FamilyDefendViewResponse.Builder response = Family.FamilyDefendViewResponse.newBuilder();
SGuildSetting guildSetting = SGuildSetting.sGuildSetting; SGuildSetting guildSetting = sGuildSetting;
for (Map.Entry<Integer, Integer> entry : defendInfo.entrySet()) { for (Map.Entry<Integer, Integer> entry : defendInfo.entrySet()) {
int memberType = GuildLogic.getMemberType(entry.getKey(), guildInfo.getMembers()); int memberType = GuildLogic.getMemberType(entry.getKey(), guildInfo.getMembers());
Family.FamilyDefendInfo.Builder defend = Family.FamilyDefendInfo.newBuilder(); Family.FamilyDefendInfo.Builder defend = Family.FamilyDefendInfo.newBuilder();
@ -137,7 +139,7 @@ public class GuildFightLogic {
buildId = 1; buildId = 1;
} }
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(user.getPlayerInfoManager().getGuildId()); GuildInfo guildInfo = GuilidManager.guildInfoMap.get(user.getPlayerInfoManager().getGuildId());
SGuildSetting guildSetting = SGuildSetting.sGuildSetting; SGuildSetting guildSetting = sGuildSetting;
int memberType = GuildLogic.getMemberType(uid, guildInfo.getMembers()); int memberType = GuildLogic.getMemberType(uid, guildInfo.getMembers());
guildInfo.updateDefendInfo(uid, buildId); guildInfo.updateDefendInfo(uid, buildId);
Family.FamilyDefendInfo.Builder defend = Family.FamilyDefendInfo.newBuilder(); Family.FamilyDefendInfo.Builder defend = Family.FamilyDefendInfo.newBuilder();
@ -217,7 +219,7 @@ public class GuildFightLogic {
} }
RedisUtil redisUtil = RedisUtil.getInstence(); RedisUtil redisUtil = RedisUtil.getInstence();
String key = RedisKey.getKey(RedisKey.FAMILY_FIGHT_RANK, "", false); String key = RedisKey.getKey(RedisKey.FAMILY_FIGHT_RANK, "", false);
SGuildSetting guildSetting = SGuildSetting.sGuildSetting; SGuildSetting guildSetting = sGuildSetting;
for (Integer gid : guildIds) { for (Integer gid : guildIds) {
Map<Integer, SGuildLevelConfig> configMap = SGuildLevelConfig.sGuildLevelConfigMap; Map<Integer, SGuildLevelConfig> configMap = SGuildLevelConfig.sGuildLevelConfigMap;
//匹配处理 //匹配处理
@ -424,7 +426,7 @@ public class GuildFightLogic {
} }
}else{ }else{
int memberType = GuildLogic.getMemberType(defendUid, GuilidManager.guildInfoMap.get(defendGuildId).getMembers()); int memberType = GuildLogic.getMemberType(defendUid, GuilidManager.guildInfoMap.get(defendGuildId).getMembers());
int maxStar = SGuildSetting.sGuildSetting.getStarNum()[memberType-1]; int maxStar = sGuildSetting.getStarNum()[memberType-1];
int lessStar = maxStar - dieCount*maxStar/5; int lessStar = maxStar - dieCount*maxStar/5;
//倍数k(maxStar/5) //倍数k(maxStar/5)
getStar = defendInfo.getStarCount()-lessStar; getStar = defendInfo.getStarCount()-lessStar;
@ -481,9 +483,11 @@ public class GuildFightLogic {
Family.EnemyFamily familyInfo = Family.EnemyFamily.newBuilder().setId(guildInfo.getId()).setLevel(guildInfo.getLevel()).setName(guildInfo.getName()).setPictureId(1).build(); Family.EnemyFamily familyInfo = Family.EnemyFamily.newBuilder().setId(guildInfo.getId()).setLevel(guildInfo.getLevel()).setName(guildInfo.getName()).setPictureId(1).build();
response.setEnemy(familyInfo); response.setEnemy(familyInfo);
}else{ }else{
if(!startMatching){ if(status!=0&&status!=1){
response.setType(-1); if(!startMatching){
response.setRoundEndTime((int) (TimeUtils.getAppointTime(SGuildSetting.sGuildSetting.getSettleTime()[1][0],SGuildSetting.sGuildSetting.getSettleTime()[1][1]) / 1000)); response.setType(-1);
response.setRoundEndTime((int) (TimeUtils.getAppointTime(sGuildSetting.getSettleTime()[1][0], sGuildSetting.getSettleTime()[1][1]) / 1000));
}
} }
} }
MessageUtil.sendMessage(session, 1, messageType.getNumber(), response.build(), true); MessageUtil.sendMessage(session, 1, messageType.getNumber(), response.build(), true);
@ -500,71 +504,41 @@ public class GuildFightLogic {
startMatching = false; startMatching = false;
} }
SGuildSetting sGuildSetting = SGuildSetting.sGuildSetting; SGuildSetting sGuildSetting = SGuildSetting.sGuildSetting;
int[] guildWarOpenTime = sGuildSetting.getGuildWarOpenTime();
int hour = TimeUtils.getHourOfDay(); int hour = TimeUtils.getHourOfDay();
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
int minute = calendar.get(Calendar.MINUTE); int minute = calendar.get(Calendar.MINUTE);
//活动开启时间判断 //活动开启时间判断
int startAllTime; int startAllTime;
if (hour < sGuildSetting.getPrepareTime()[0][0]) { if(guildWarOpenTime[0]==1){
startAllTime = (int) (TimeUtils.getAppointTime(sGuildSetting.getPrepareTime()[0][0],sGuildSetting.getPrepareTime()[0][1]) / 1000); if (hour < sGuildSetting.getPrepareTime()[0][0]) {
} else if(hour==sGuildSetting.getPrepareTime()[0][0]&&minute<sGuildSetting.getPrepareTime()[0][1]){ startAllTime = (int) (TimeUtils.getAppointTime(sGuildSetting.getPrepareTime()[0][0],sGuildSetting.getPrepareTime()[0][1]) / 1000);
startAllTime = (int) (TimeUtils.getAppointTime(sGuildSetting.getPrepareTime()[0][0],sGuildSetting.getPrepareTime()[0][1]) / 1000); } else if(hour==sGuildSetting.getPrepareTime()[0][0]&&minute<sGuildSetting.getPrepareTime()[0][1]){
startAllTime = (int) (TimeUtils.getAppointTime(sGuildSetting.getPrepareTime()[0][0],sGuildSetting.getPrepareTime()[0][1]) / 1000);
}else{
startAllTime = (int) ((TimeUtils.getAppointTime(sGuildSetting.getPrepareTime()[0][0],sGuildSetting.getPrepareTime()[0][1])+TimeUtils.DAY) / 1000);
}
roundCompare(hour,minute);
}else{ }else{
startAllTime = (int) ((TimeUtils.getAppointTime(sGuildSetting.getPrepareTime()[0][0],sGuildSetting.getPrepareTime()[0][1]) + TimeUtils.DAY) / 1000); int minTime = (int) ((TimeUtils.getAppointTime(sGuildSetting.getPrepareTime()[0][0],sGuildSetting.getPrepareTime()[0][1]) + TimeUtils.WEEK) /1000);
for(int i = 1;i<guildWarOpenTime.length;i++){
int tempTime = (int)(TimeUtils.getNextWeekendStartTime(guildWarOpenTime[i],sGuildSetting.getPrepareTime()[0][0])/1000);
if(tempTime<minTime){
minTime=tempTime;
}
//如果当前星期几与配置相同
if(TimeUtils.getDayOfWeek()==guildWarOpenTime[i]){
roundCompare(hour,minute);
}
}
startAllTime = minTime;
} }
if(startFightTime!=startAllTime){ if(startFightTime!=startAllTime){
startFightTime=startAllTime; startFightTime=startAllTime;
} }
//阶段判断
int[][] timeRound;
if(flagTimeRound(sGuildSetting.getPrepareTime(),hour,minute)){
timeRound = sGuildSetting.getPrepareTime();
if(status==0){
LOGGER.info("阶段变为布防");
status = 1;
}
}else if(flagTimeRound(sGuildSetting.getMatchTime(),hour,minute)){
timeRound = sGuildSetting.getMatchTime();
if(status==1){
status = 2;
LOGGER.info("阶段变为匹配");
}
// startMatching = true;
}else if(flagTimeRound(sGuildSetting.getBattleTime(),hour,minute)){
timeRound = sGuildSetting.getBattleTime();
if(status == 2){
status = 3;
LOGGER.info("阶段变为进攻");
}
}else if(flagTimeRound(sGuildSetting.getSettleTime(),hour,minute)){
timeRound = sGuildSetting.getSettleTime();
if(status==3){
accountFamilyFightResult();
MongoUtil.getLjsdMongoTemplate().lastUpdate();
status = 4;
LOGGER.info("阶段变为结算");
}
}else{
if(status==4){
status = 0;
LOGGER.info("阶段变为等待");
removeMatchingInfo();
}
startMatching = true;
timeRound =null;
}
int startTime = 0;
int endTime = 0;
if(timeRound!=null){
startTime = (int) (TimeUtils.getAppointTime(timeRound[0][0], timeRound[0][1]) / 1000);
endTime = (int) (TimeUtils.getAppointTime(timeRound[1][0], timeRound[1][1]) / 1000);
}
if(roundStartTime!=startTime){
roundStartTime = startTime;
}
if(roundEndTime!=endTime){
roundEndTime = endTime;
}
} }
/** /**
@ -630,7 +604,7 @@ public class GuildFightLogic {
RedisUtil redisUtil = RedisUtil.getInstence(); RedisUtil redisUtil = RedisUtil.getInstence();
String key = RedisKey.getKey(RedisKey.FAMILY_FIGHT_MATCHING_RANK,"",false); String key = RedisKey.getKey(RedisKey.FAMILY_FIGHT_MATCHING_RANK,"",false);
Set<String> matchingRank = redisUtil.getZset(key, 0, redisUtil.getZsetSize(key)); Set<String> matchingRank = redisUtil.getZset(key, 0, redisUtil.getZsetSize(key));
int[] buildingStar = SGuildSetting.sGuildSetting.getBuildingStar(); int[] buildingStar = sGuildSetting.getBuildingStar();
for(String str:matchingRank){ for(String str:matchingRank){
int[] buildStar = new int[3]; int[] buildStar = new int[3];
int enemyFamily = getEnemyFamily(Integer.parseInt(str)); int enemyFamily = getEnemyFamily(Integer.parseInt(str));
@ -849,4 +823,59 @@ public class GuildFightLogic {
} }
return true; return true;
} }
private static void roundCompare(int hour,int minute) throws Exception{
//阶段判断
int[][] timeRound;
if(flagTimeRound(sGuildSetting.getPrepareTime(),hour,minute)){
timeRound = sGuildSetting.getPrepareTime();
if(status==0){
LOGGER.info("阶段变为布防");
status = 1;
}
}else if(flagTimeRound(sGuildSetting.getMatchTime(),hour,minute)){
timeRound = sGuildSetting.getMatchTime();
if(status==1){
status = 2;
LOGGER.info("阶段变为匹配");
}
startMatching = true;
}else if(flagTimeRound(sGuildSetting.getBattleTime(),hour,minute)){
timeRound = sGuildSetting.getBattleTime();
if(status == 2){
status = 3;
LOGGER.info("阶段变为进攻");
}
}else if(flagTimeRound(sGuildSetting.getSettleTime(),hour,minute)){
timeRound = sGuildSetting.getSettleTime();
if(status==3){
accountFamilyFightResult();
MongoUtil.getLjsdMongoTemplate().lastUpdate();
status = 4;
LOGGER.info("阶段变为结算");
}
}else{
if(status==4){
status = 0;
LOGGER.info("阶段变为等待");
removeMatchingInfo();
}
startMatching = true;
timeRound =null;
}
int startTime = 0;
int endTime = 0;
if(timeRound!=null){
startTime = (int) (TimeUtils.getAppointTime(timeRound[0][0], timeRound[0][1]) / 1000);
endTime = (int) (TimeUtils.getAppointTime(timeRound[1][0], timeRound[1][1]) / 1000);
}
if(roundStartTime!=startTime){
roundStartTime = startTime;
}
if(roundEndTime!=endTime){
roundEndTime = endTime;
}
}
} }

View File

@ -114,6 +114,15 @@ public class GuildLogic {
return "包含敏感字"; return "包含敏感字";
} }
} }
if(familyName.length()<SGuildSetting.sGuildSetting.getNameSize()[0]||familyName.length()>SGuildSetting.sGuildSetting.getNameSize()[1]){
return "公会名长度不符";
}
Map<Integer, GuildInfo> guildInfoMap = GuilidManager.guildInfoMap;
for(Map.Entry<Integer, GuildInfo> entry:guildInfoMap.entrySet()){
if(entry.getValue().getName().equals(familyName)){
return "此名已存在";
}
}
boolean enough= ItemUtil.itemCost(user, SGuildSetting.sGuildSetting.getCreatCost(), BIReason.CREATE_GUILD_CONSUME, 0); boolean enough= ItemUtil.itemCost(user, SGuildSetting.sGuildSetting.getCreatCost(), BIReason.CREATE_GUILD_CONSUME, 0);
if(!enough){ if(!enough){
return "道具不足"; return "道具不足";
@ -338,12 +347,15 @@ public class GuildLogic {
int uid = session.getUid(); int uid = session.getUid();
User user = UserManager.getUser(uid); User user = UserManager.getUser(uid);
int guildId = user.getPlayerInfoManager().getGuildId(); int guildId = user.getPlayerInfoManager().getGuildId();
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(guildId);
int msgId = MessageTypeProto.MessageType.FAMILY_OPERATION_APPLY_LIST_RESPONSE_VALUE; int msgId = MessageTypeProto.MessageType.FAMILY_OPERATION_APPLY_LIST_RESPONSE_VALUE;
if(getMemberType(uid,guildInfo.getMembers())>=GlobalsDef.MEMBER) {
MessageUtil.sendErrorResponse(session,0,msgId,"你无权操作申请");
}
if(guildId == 0){ if(guildId == 0){
MessageUtil.sendErrorResponse(session,0,msgId,"未加入公会"); MessageUtil.sendErrorResponse(session,0,msgId,"未加入公会");
return; return;
} }
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(guildId);
boolean isSuccess = RedisUtil.getInstence().tryGetDistributedLock(RedisKey.OPERATE_FAMILY_APPLY, Integer.toString(guildId), Integer.toString(uid), 500); boolean isSuccess = RedisUtil.getInstence().tryGetDistributedLock(RedisKey.OPERATE_FAMILY_APPLY, Integer.toString(guildId), Integer.toString(uid), 500);
if(!isSuccess){ if(!isSuccess){
MessageUtil.sendErrorResponse(session,0, msgId,"请稍后重试"); MessageUtil.sendErrorResponse(session,0, msgId,"请稍后重试");
@ -393,6 +405,9 @@ public class GuildLogic {
} }
User targetUser = UserManager.getUser(applyId); User targetUser = UserManager.getUser(applyId);
try { try {
if(targetUser.getPlayerInfoManager().getGuildId()!=0){
return;
}
guildInfo.addMembers(GlobalsDef.MEMBER,applyId); guildInfo.addMembers(GlobalsDef.MEMBER,applyId);
targetUser.getPlayerInfoManager().setGuildId(guildInfo.getId()); targetUser.getPlayerInfoManager().setGuildId(guildInfo.getId());
GuilidManager.removeMineApplyGuildInfos(guildInfo.getId(),applyId); GuilidManager.removeMineApplyGuildInfos(guildInfo.getId(),applyId);
@ -565,10 +580,14 @@ public class GuildLogic {
err="包含铭感字"; err="包含铭感字";
resultCode = 0; resultCode = 0;
} }
guildInfo.setAnnounce(content);
sendFamilyBaseUpdateIndication(guildInfo); sendFamilyBaseUpdateIndication(guildInfo);
Family.FamilyChangeResponse response = Family.FamilyChangeResponse.newBuilder().setErr(err).setResult(resultCode).build(); Family.FamilyChangeResponse response = Family.FamilyChangeResponse.newBuilder().setErr(err).setResult(resultCode).build();
MessageUtil.sendMessage(session,1,msgId,response,true); if(resultCode==0){
MessageUtil.sendErrorResponse(session,resultCode,msgId,"包含敏感字");
}else{
guildInfo.setAnnounce(content);
MessageUtil.sendMessage(session,resultCode,msgId,response,true);
}
} }

View File

@ -105,6 +105,9 @@ public class FriendLogic {
continue; continue;
} }
User recommandIdUser = UserManager.getUserInMem(recommandId); User recommandIdUser = UserManager.getUserInMem(recommandId);
if(recommandFriends== null||recommandIdUser==null){
continue;
}
int minLevel = level - randomLevel; int minLevel = level - randomLevel;
minLevel = minLevel <= 5 ? 5 : minLevel; minLevel = minLevel <= 5 ? 5 : minLevel;
int maxLevel = level + randomLevel; int maxLevel = level + randomLevel;

View File

@ -833,7 +833,7 @@ public class ItemUtil {
heroManager.addHero(hero); heroManager.addHero(hero);
heroList.add(CBean2Proto.getHero(hero)); heroList.add(CBean2Proto.getHero(hero));
SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId()); SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId());
if (scHero.getNatural() >= 3) { if (scHero.getNatural() >= 13) {
String message = ""; String message = "";
// String quality = HeroLogic.getInstance().getQuality(scHero.getNatural()); // String quality = HeroLogic.getInstance().getQuality(scHero.getNatural());
if (reason == BIReason.COMPOS_HERO_REWARD) { if (reason == BIReason.COMPOS_HERO_REWARD) {

View File

@ -15,19 +15,7 @@ public class ShieldedWordUtils {
return false; return false;
} }
} }
boolean result = true; return checkName(user,name,validateSpecStr,chatContentType);
if(validateSpecStr){
result = validateUserName(name);
if(!result){
return false;
}
}
result = isContaintSensitiveWord(name);
if(result){
return false;
}
return true;
} }
public static boolean checkName(User user , String name,boolean validateSpecStr,ChatContentType chatContentType){ public static boolean checkName(User user , String name,boolean validateSpecStr,ChatContentType chatContentType){

View File

@ -777,22 +777,40 @@ public class TimeUtils {
} }
/** /**
* 0 * 0
* @param now * @param now
* @param targetWeekday * @param targetWeekday
* @return * @return
*/ */
public static long getNextWeekdayStartTime(long now, int targetWeekday) { public static long getCurWeekdayStartTime(int targetWeekday,int hour) {
Calendar calendar = Calendar.getInstance(); if(targetWeekday<1||targetWeekday>7){
calendar.setTimeInMillis(now); return -1;
int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
int daysDiffer = dayOfWeek - targetWeekday;
if (daysDiffer < 0) {
daysDiffer = daysDiffer + DAYOFWEEK_CARDINALITY;
} }
Calendar c = Calendar.getInstance();
int day_of_week = c.get(Calendar.DAY_OF_WEEK) - 1;
if (day_of_week == 0)
day_of_week = 7;
c.add(Calendar.DATE, -day_of_week + targetWeekday);
c.set(Calendar.HOUR_OF_DAY,hour);
c.set(Calendar.SECOND,0);
c.set(Calendar.MINUTE,0);
return c.getTimeInMillis();
}
long dayBegin = getBeginOfDay(now); /**
return dayBegin + daysDiffer * DAY; *
* @param targetWeekday
* @param hour
* @return
* @throws Exception
*/
public static long getNextWeekendStartTime(int targetWeekday,int hour) {
long cur = getCurWeekdayStartTime(targetWeekday, hour);
if(cur<now()){
return cur + WEEK;
}else{
return cur;
}
} }