/** 添加合成的时间 */ public static void addComposeTime(RoleGoods roleGoods, int minute, boolean endGoodsIsActivate) { if (isExpired(roleGoods)) { roleGoods.setExpiredTime(DateUtil.add(new Date(), Calendar.MINUTE, minute)); return; } if (isActivate(roleGoods)) { roleGoods.setExpiredTime(DateUtil.add(roleGoods.getExpiredTime(), Calendar.MINUTE, minute)); return; } if (endGoodsIsActivate) { roleGoods.setExpiredTime( DateUtil.add(new Date(), Calendar.MINUTE, roleGoods.getDeadline() + minute)); return; } roleGoods.setDeadline(roleGoods.getDeadline() + minute); }
// 容错过期时间(单写一方法在此调用) public static void checkGoodsExpiredTime(RoleGoods roleGoods) { try { GoodsBase goodsBase = GameContext.getGoodsApp().getGoodsBase(roleGoods.getGoodsId()); if (null == goodsBase) { return; } if (goodsBase.isForever()) { return; } int bagType = roleGoods.getStorageType(); boolean on = bagType == StorageType.hero.getType(); boolean mustActive = (goodsBase.getActivateType() == 1) || (goodsBase.getActivateType() == 0 && on); if (mustActive) { if (!Util.isEmpty(roleGoods.getExpiredTime())) { return; } Date endDate = DateUtil.add(new Date(), Calendar.MINUTE, goodsBase.getDeadline()); roleGoods.setExpiredTime(endDate); return; } if (roleGoods.getDeadline() > 0) { return; } roleGoods.setDeadline(goodsBase.getDeadline()); } catch (Exception e) { e.printStackTrace(); } }
@Override public C3863_Arena3V3DetailRespMessage getArena3V3DetailRespMessage(RoleInstance role) { C3863_Arena3V3DetailRespMessage resp = new C3863_Arena3V3DetailRespMessage(); ArenaType arenaType = ArenaType._3V3; if (this.isOpenDarkDoor) { arenaType = ArenaType._3V3_DARK_DOOR; } ArenaConfig config = GameContext.getArenaApp().getArenaConfig(arenaType); if (null == config) { return null; } Reward3V3Config lastReward = this.getReward3V3Config(role.getRoleArena().getLastArenaLevel3v3()); if (null == lastReward) { return null; } RoleArena roleArena = role.getRoleArena(); if (null == roleArena) { return null; } float currentArenaLevel3v3 = roleArena.getArenaLevel3v3(); Reward3V3Config currentReward = this.getReward3V3Config(currentArenaLevel3v3); if (null == currentReward) { return null; } resp.setActiveId(config.getActiveId()); resp.setCurrentArenaLevel3v3((int) currentArenaLevel3v3); resp.setCurrentArenaLevel3v3Name(currentReward.getName()); Reward3V3Config nextReward = this.getNextReward3V3Config(currentArenaLevel3v3); resp.setNextArenaLevel3v3(nextReward.getArenaMinLevel()); resp.setNextArenaLevel3v3Name(nextReward.getName()); resp.setCycle3v3Score(roleArena.getCycle3v3Score()); resp.setMaxCycle3v3Score(lastReward.getMaxCycleScore()); resp.setWin(roleArena.getCycleWin3v3()); resp.setFail(roleArena.getCycleFail3v3()); resp.setArenaScore(role.getArena3v3Score()); resp.setMaxArenaScore(lastReward.getMaxRoleScore()); resp.setDesc(config.getDesc()); // 兑换参数 resp.setExchangeParam(config.getExchangeMenuId()); ApplyInfo info = GameContext.getArenaApp().getApplyInfo(role.getRoleId()); if (null == info) { return resp; } Team team = role.getTeam(); if (team == null || team.isLeader(role)) { resp.setArenaType(ApplyState.had_apply.getType()); } else { resp.setArenaType((byte) 2); } Date applyDate = new Date(info.getCreateDate()); resp.setTime(DateUtil.dateDiffSecond(applyDate, new Date())); return resp; }
/** 当前地图倒计时是否结束 */ private boolean isTimeOver() { // 地图倒计时时间(单位:秒) int limitTime = this.copyLineConfig.getTimeLimit(); // 限时时间<=0表示不需要倒计时 if (limitTime <= 0 || null == this.startTime) { return false; } int mapTime = DateUtil.getSecondMargin(this.startTime); return mapTime > limitTime; }
public GoodsBaseItem getGoodsBaseInfo(RoleGoods roleGoods) { GoodsBaseEquItem item = new GoodsBaseEquItem(); this.setGoodsBaseItem(roleGoods, item); item.setStar(this.star); item.setSecondType(this.secondType); item.setStrengthenLevel((byte) 0); item.setMaxStrengthenLevel((byte) this.maxStrengthenLevel); item.setQualityType(this.getQualityType()); item.setLvLimit((byte) this.getLvLimit()); item.setDesc(this.getDesc()); item.setActivateType(this.getActivateType()); item.setResId((short) this.getResId()); item.setDeadline(this.getDeadline()); item.setSex((byte) this.getSex()); item.setExpireType(this.getExpireType()); item.setMaxAttriNum((byte) this.attriNum); // 装备评分 item.setGs(this.calculateScore(roleGoods)); // 基本属性+强化属性 item.setBaseAttriItem(GameContext.getEquipApp().getBaseAttriItem(roleGoods, this)); if (null == roleGoods) { // 装备模板信息 return item; } item.setQualityType(roleGoods.getQuality()); item.setStar(roleGoods.getStar()); // 实例存在 if (!Util.isEmpty(roleGoods.getExpiredTime())) { item.setExpiredTime(DateUtil.getMinFormat(roleGoods.getExpiredTime())); } if (roleGoods.getDeadline() > 0) { item.setDeadline(roleGoods.getDeadline()); } item.setExpired((byte) (RoleGoodsHelper.isExpired(roleGoods) ? 1 : 0)); item.setStrengthenLevel((byte) roleGoods.getStrengthenLevel()); // 获得衍生属性 item.setDerivativeItems(this.getRecatingAttriList(roleGoods)); // 镶嵌 相关 // 装备开启孔位 item.setMaxHole(GameContext.getEquipApp().getEquipMaxHole(roleGoods)); // 装备镶嵌的符文 List<GoodsEquRuneItem> runeItems = this.getMosaicItem(roleGoods); if (!Util.isEmpty(runeItems)) { item.setRuneItems(runeItems); } // 设置英雄id if (StorageType.hero.getType() == roleGoods.getStorageType()) { item.setHeroId(Integer.parseInt(roleGoods.getOtherParm())); } return item; }
/** 倒计时结束逻辑 */ private void do_mapState_timeOver() { // 已经通关,不需要将角色传出副本 if (this.passed) { // 容错 if (null == this.timeOverDate) { this.timeOverDate = new Date(); } // 判断超时结束的时间,超过了可停留时间,将地图内所有人传出 long time = DateUtil.getMillisecondGap(this.timeOverDate); if (time > this.timeOverKickTime) { this.kickAllRole(); } return; } this.kickAllRole(); }
@Override public short getBuffId(int arenaType) { List<ArenaBuffConfig> list = this.buffConfigMap.get(arenaType); if (Util.isEmpty(list)) { return 0; } int dateDiff = DateUtil.dateDiffDay(GameContext.gameStartDate, new Date()); for (ArenaBuffConfig config : list) { if (null == config) { continue; } if (config.isSuitDay(dateDiff)) { return config.getBuffId(); } } return 0; }
/** 得到需要合成的时间 */ public static int getComposeTime(RoleGoods roleGoods) { if (isActivate(roleGoods)) { return (int) DateUtil.dateDiffMinute(roleGoods.getExpiredTime(), new Date()); } return roleGoods.getDeadline(); }
/** * 获取积分日志的时间 * * @return */ public String getIntegralLogTime() { return DateUtil.date2FormatDate(this.operateTime, FormatConstant.IntegralLogFormat); }