公会战、公会功能修改
parent
ca28591b48
commit
2d33fbb7f9
|
@ -18,6 +18,8 @@ public class SEndlessMapConfig implements BaseConfig {
|
|||
|
||||
private int deathCost;
|
||||
|
||||
private int[] mapItem;
|
||||
|
||||
public static Map<Integer,SEndlessMapConfig> sEndlessMapConfigMap;
|
||||
|
||||
@Override
|
||||
|
|
|
@ -59,6 +59,8 @@ public class SGuildSetting implements BaseConfig {
|
|||
|
||||
private float expansionScore;
|
||||
|
||||
private int[] nameSize;
|
||||
|
||||
public static SGuildSetting sGuildSetting;
|
||||
|
||||
|
||||
|
@ -169,4 +171,8 @@ public class SGuildSetting implements BaseConfig {
|
|||
public int[][] getSettleTime() {
|
||||
return settleTime;
|
||||
}
|
||||
|
||||
public int[] getNameSize() {
|
||||
return nameSize;
|
||||
}
|
||||
}
|
|
@ -203,38 +203,29 @@ public class MapLogic {
|
|||
|
||||
|
||||
if(type ==4){
|
||||
mapEnterResponse.setCurXY(mapManager.getCurXY());
|
||||
List<TeamPosHeroInfo> teamPosForHero = user.getTeamPosManager().getTeamPosForHero().get(teamId);
|
||||
for (int i = 0; i <teamPosForHero.size() ; i++) {
|
||||
String endlessHeroId = teamPosForHero.get(i).getHeroId();
|
||||
int maxHp = HeroLogic.getInstance().calHeroNotBufferAttribute(user,user.getHeroManager().getHero(endlessHeroId),true,teamId).get(1);
|
||||
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();
|
||||
if(endlessMapInfo.getSeason()!=endlessSeason){
|
||||
mapManager.updateEndlessSeason(endlessSeason);
|
||||
mapManager.updateEndlessMapId(0);
|
||||
mapManager.endlessWalkCellSave(new HashSet<>());
|
||||
mapManager.endlessMapInfoSave(new HashMap<>());
|
||||
}else{
|
||||
Map<Integer, Cell> endlessMapCellInfo = mapManager.getEndlessMapInfo().getMapInfo();
|
||||
if(endlessMapCellInfo !=null&&endlessMapCellInfo.size()>0){
|
||||
mapManager.setMapInfo(endlessMapCellInfo);
|
||||
}
|
||||
Set<Integer> walkCell = mapManager.getEndlessMapInfo().getWalkCell();
|
||||
if(walkCell!=null&&walkCell.size()>0){
|
||||
mapManager.setWalkCells(walkCell);
|
||||
}
|
||||
}
|
||||
// if(endlessMapInfo.getSeason()!=endlessSeason){
|
||||
// mapManager.updateEndlessSeason(endlessSeason);
|
||||
// mapManager.updateEndlessMapId(0);
|
||||
// mapManager.endlessWalkCellSave(new HashSet<>());
|
||||
// mapManager.endlessMapInfoSave(new HashMap<>());
|
||||
// }else{
|
||||
// Map<Integer, Cell> endlessMapCellInfo = mapManager.getEndlessMapInfo().getMapInfo();
|
||||
// if(endlessMapCellInfo !=null&&endlessMapCellInfo.size()>0){
|
||||
// mapManager.setMapInfo(endlessMapCellInfo);
|
||||
// }
|
||||
// Set<Integer> walkCell = mapManager.getEndlessMapInfo().getWalkCell();
|
||||
// if(walkCell!=null&&walkCell.size()>0){
|
||||
// mapManager.setWalkCells(walkCell);
|
||||
// }
|
||||
// }
|
||||
mapManager.updateEndlessMapId(mapId);
|
||||
for(Map.Entry<Integer,Map<Integer,String>> entry :endlessMapInfo.getMapSign().entrySet()){
|
||||
int curMapId = entry.getKey();
|
||||
|
@ -442,11 +433,19 @@ public class MapLogic {
|
|||
mapManager.setCurXY(xy);
|
||||
}
|
||||
SChallengeMapConfig challengeMapConfig = SChallengeMapConfig.integerSChallengeMapConfigMap.get(mapManager.getCurMapId());
|
||||
|
||||
Mission mission = new Mission();
|
||||
mission.setMissionId(challengeMapConfig.getMissionId());
|
||||
mission.setMissionStep(0);
|
||||
mission.setTime(0);
|
||||
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.setMission(mission);
|
||||
mapManager.setMapInfo(newMap);
|
||||
|
@ -3056,7 +3055,7 @@ public class MapLogic {
|
|||
if(heroEntry.getValue().getLevel()<20){
|
||||
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())){
|
||||
mapManager.addEndlessHero(heroEntry.getKey(),calHp);
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ public class MapManager extends MongoBase {
|
|||
|
||||
private Map<Integer, Map<Integer,Integer>> monsterTempSkill = new HashMap<>();
|
||||
//无尽副本信息
|
||||
private EndlessMapInfo endlessMapInfo;
|
||||
private EndlessMapInfo endlessMapInfo =new EndlessMapInfo();
|
||||
|
||||
private int lastXY; // 上一步坐标点
|
||||
|
||||
|
@ -150,6 +150,10 @@ public class MapManager extends MongoBase {
|
|||
updateString("mapInfo." + 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 {
|
||||
updateString( "mapInfo", mapInfo);
|
||||
|
|
|
@ -31,6 +31,8 @@ import org.springframework.data.redis.core.ZSetOperations;
|
|||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.ljsd.jieling.config.SGuildSetting.sGuildSetting;
|
||||
|
||||
public class GuildFightLogic {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(GuildFightLogic.class);
|
||||
/**
|
||||
|
@ -62,7 +64,7 @@ public class GuildFightLogic {
|
|||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(gid);
|
||||
Map<Integer, Integer> defendInfo = guildInfo.getDefendInfo();
|
||||
Family.FamilyDefendViewResponse.Builder response = Family.FamilyDefendViewResponse.newBuilder();
|
||||
SGuildSetting guildSetting = SGuildSetting.sGuildSetting;
|
||||
SGuildSetting guildSetting = sGuildSetting;
|
||||
for (Map.Entry<Integer, Integer> entry : defendInfo.entrySet()) {
|
||||
int memberType = GuildLogic.getMemberType(entry.getKey(), guildInfo.getMembers());
|
||||
Family.FamilyDefendInfo.Builder defend = Family.FamilyDefendInfo.newBuilder();
|
||||
|
@ -137,7 +139,7 @@ public class GuildFightLogic {
|
|||
buildId = 1;
|
||||
}
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(user.getPlayerInfoManager().getGuildId());
|
||||
SGuildSetting guildSetting = SGuildSetting.sGuildSetting;
|
||||
SGuildSetting guildSetting = sGuildSetting;
|
||||
int memberType = GuildLogic.getMemberType(uid, guildInfo.getMembers());
|
||||
guildInfo.updateDefendInfo(uid, buildId);
|
||||
Family.FamilyDefendInfo.Builder defend = Family.FamilyDefendInfo.newBuilder();
|
||||
|
@ -217,7 +219,7 @@ public class GuildFightLogic {
|
|||
}
|
||||
RedisUtil redisUtil = RedisUtil.getInstence();
|
||||
String key = RedisKey.getKey(RedisKey.FAMILY_FIGHT_RANK, "", false);
|
||||
SGuildSetting guildSetting = SGuildSetting.sGuildSetting;
|
||||
SGuildSetting guildSetting = sGuildSetting;
|
||||
for (Integer gid : guildIds) {
|
||||
Map<Integer, SGuildLevelConfig> configMap = SGuildLevelConfig.sGuildLevelConfigMap;
|
||||
//匹配处理
|
||||
|
@ -424,7 +426,7 @@ public class GuildFightLogic {
|
|||
}
|
||||
}else{
|
||||
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;
|
||||
//倍数k(maxStar/5)
|
||||
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();
|
||||
response.setEnemy(familyInfo);
|
||||
}else{
|
||||
if(!startMatching){
|
||||
response.setType(-1);
|
||||
response.setRoundEndTime((int) (TimeUtils.getAppointTime(SGuildSetting.sGuildSetting.getSettleTime()[1][0],SGuildSetting.sGuildSetting.getSettleTime()[1][1]) / 1000));
|
||||
if(status!=0&&status!=1){
|
||||
if(!startMatching){
|
||||
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);
|
||||
|
@ -500,71 +504,41 @@ public class GuildFightLogic {
|
|||
startMatching = false;
|
||||
}
|
||||
SGuildSetting sGuildSetting = SGuildSetting.sGuildSetting;
|
||||
int[] guildWarOpenTime = sGuildSetting.getGuildWarOpenTime();
|
||||
|
||||
int hour = TimeUtils.getHourOfDay();
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
int minute = calendar.get(Calendar.MINUTE);
|
||||
//活动开启时间判断
|
||||
int startAllTime;
|
||||
if (hour < sGuildSetting.getPrepareTime()[0][0]) {
|
||||
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);
|
||||
if(guildWarOpenTime[0]==1){
|
||||
if (hour < sGuildSetting.getPrepareTime()[0][0]) {
|
||||
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{
|
||||
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){
|
||||
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();
|
||||
String key = RedisKey.getKey(RedisKey.FAMILY_FIGHT_MATCHING_RANK,"",false);
|
||||
Set<String> matchingRank = redisUtil.getZset(key, 0, redisUtil.getZsetSize(key));
|
||||
int[] buildingStar = SGuildSetting.sGuildSetting.getBuildingStar();
|
||||
int[] buildingStar = sGuildSetting.getBuildingStar();
|
||||
for(String str:matchingRank){
|
||||
int[] buildStar = new int[3];
|
||||
int enemyFamily = getEnemyFamily(Integer.parseInt(str));
|
||||
|
@ -849,4 +823,59 @@ public class GuildFightLogic {
|
|||
}
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,6 +114,15 @@ public class GuildLogic {
|
|||
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);
|
||||
if(!enough){
|
||||
return "道具不足";
|
||||
|
@ -338,12 +347,15 @@ public class GuildLogic {
|
|||
int uid = session.getUid();
|
||||
User user = UserManager.getUser(uid);
|
||||
int guildId = user.getPlayerInfoManager().getGuildId();
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(guildId);
|
||||
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){
|
||||
MessageUtil.sendErrorResponse(session,0,msgId,"未加入公会");
|
||||
return;
|
||||
}
|
||||
GuildInfo guildInfo = GuilidManager.guildInfoMap.get(guildId);
|
||||
boolean isSuccess = RedisUtil.getInstence().tryGetDistributedLock(RedisKey.OPERATE_FAMILY_APPLY, Integer.toString(guildId), Integer.toString(uid), 500);
|
||||
if(!isSuccess){
|
||||
MessageUtil.sendErrorResponse(session,0, msgId,"请稍后重试");
|
||||
|
@ -393,6 +405,9 @@ public class GuildLogic {
|
|||
}
|
||||
User targetUser = UserManager.getUser(applyId);
|
||||
try {
|
||||
if(targetUser.getPlayerInfoManager().getGuildId()!=0){
|
||||
return;
|
||||
}
|
||||
guildInfo.addMembers(GlobalsDef.MEMBER,applyId);
|
||||
targetUser.getPlayerInfoManager().setGuildId(guildInfo.getId());
|
||||
GuilidManager.removeMineApplyGuildInfos(guildInfo.getId(),applyId);
|
||||
|
@ -565,10 +580,14 @@ public class GuildLogic {
|
|||
err="包含铭感字";
|
||||
resultCode = 0;
|
||||
}
|
||||
guildInfo.setAnnounce(content);
|
||||
sendFamilyBaseUpdateIndication(guildInfo);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -105,6 +105,9 @@ public class FriendLogic {
|
|||
continue;
|
||||
}
|
||||
User recommandIdUser = UserManager.getUserInMem(recommandId);
|
||||
if(recommandFriends== null||recommandIdUser==null){
|
||||
continue;
|
||||
}
|
||||
int minLevel = level - randomLevel;
|
||||
minLevel = minLevel <= 5 ? 5 : minLevel;
|
||||
int maxLevel = level + randomLevel;
|
||||
|
|
|
@ -833,7 +833,7 @@ public class ItemUtil {
|
|||
heroManager.addHero(hero);
|
||||
heroList.add(CBean2Proto.getHero(hero));
|
||||
SCHero scHero = SCHero.getsCHero().get(hero.getTemplateId());
|
||||
if (scHero.getNatural() >= 3) {
|
||||
if (scHero.getNatural() >= 13) {
|
||||
String message = "";
|
||||
// String quality = HeroLogic.getInstance().getQuality(scHero.getNatural());
|
||||
if (reason == BIReason.COMPOS_HERO_REWARD) {
|
||||
|
|
|
@ -15,19 +15,7 @@ public class ShieldedWordUtils {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
boolean result = true;
|
||||
if(validateSpecStr){
|
||||
result = validateUserName(name);
|
||||
if(!result){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
result = isContaintSensitiveWord(name);
|
||||
if(result){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return checkName(user,name,validateSpecStr,chatContentType);
|
||||
|
||||
}
|
||||
public static boolean checkName(User user , String name,boolean validateSpecStr,ChatContentType chatContentType){
|
||||
|
|
|
@ -777,22 +777,40 @@ public class TimeUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* 获得当前时间之前下一个星期几的0点时间
|
||||
* 获得当前周星期几的0点时间
|
||||
* @param now
|
||||
* @param targetWeekday
|
||||
* @return
|
||||
*/
|
||||
public static long getNextWeekdayStartTime(long now, int targetWeekday) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTimeInMillis(now);
|
||||
int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);
|
||||
int daysDiffer = dayOfWeek - targetWeekday;
|
||||
if (daysDiffer < 0) {
|
||||
daysDiffer = daysDiffer + DAYOFWEEK_CARDINALITY;
|
||||
public static long getCurWeekdayStartTime(int targetWeekday,int hour) {
|
||||
if(targetWeekday<1||targetWeekday>7){
|
||||
return -1;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue