Esempio n. 1
0
 private void loadBuffConfig() {
   // 加载擂台赛配置
   String fileName = XlsSheetNameType.arena_buff_config.getXlsName();
   String sheetName = XlsSheetNameType.arena_buff_config.getSheetName();
   try {
     String sourceFile = GameContext.getPathConfig().getXlsPath() + fileName;
     List<ArenaBuffConfig> list =
         XlsPojoUtil.sheetToList(sourceFile, sheetName, ArenaBuffConfig.class);
     if (Util.isEmpty(list)) {
       return;
     }
     for (ArenaBuffConfig config : list) {
       if (null == config) {
         continue;
       }
       int arenaType = config.getArenaType();
       if (!buffConfigMap.containsKey(arenaType)) {
         buffConfigMap.put(arenaType, new ArrayList<ArenaBuffConfig>());
       }
       buffConfigMap.get(arenaType).add(config);
     }
   } catch (Exception ex) {
     Log4jManager.checkFail();
     Log4jManager.CHECK.error(
         "loadExel error : sourceFile = " + fileName + " sheetName =" + sheetName, ex);
   }
 }
Esempio n. 2
0
  @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;
  }