Exemplo n.º 1
0
  /**
   * 建造ドックの投入資源を取得します
   *
   * @param dock ドック
   * @return 建造ドックの投入資源
   */
  @CheckForNull
  public static ResourceDto load(String dock) {
    try {
      if (mapBean == null) {
        mapBean = BeanUtils.readObject(AppConstants.KDOCK_CONFIG_FILE, KdockMapBean.class);
      }
      if (mapBean != null) {
        KdockBean kdock = mapBean.getKdockMap().get(dock);

        if (kdock == null) {
          return null;
        }

        Map<Long, ShipDto> ships = ShipContext.get();
        if (!ships.isEmpty() && ships.containsKey(kdock.getShipId())) {
          ResourceDto resource =
              new ResourceDto(
                  kdock.getType(),
                  kdock.getFuel(),
                  kdock.getAmmo(),
                  kdock.getMetal(),
                  kdock.getBauxite(),
                  kdock.getResearchMaterials(),
                  ships.get(kdock.getShipId()),
                  kdock.getHqLevel());
          resource.setFreeDock(kdock.getFreeDock());
          return resource;
        }
      }
    } catch (Exception e) {
      LoggerHolder.LOG.warn("建造ドックの投入資源を取得しますに失敗しました", e);
    }
    return null;
  }
  /**
   * 所有艦娘一覧の内容
   *
   * @param specdiff 成長余地
   * @param filter 鍵付きのみ
   * @return 内容
   */
  public static List<String[]> getShipListBody(boolean specdiff, ShipFilterDto filter) {
    Set<Entry<Long, ShipDto>> ships = ShipContext.get().entrySet();
    List<Object[]> body = new ArrayList<Object[]>();
    int count = 0;
    for (Entry<Long, ShipDto> entry : ships) {
      ShipDto ship = entry.getValue();

      if ((filter != null) && !ShipFilterLogic.shipFilter(ship, filter)) {
        continue;
      }

      count++;

      if (!specdiff) {
        // 通常
        body.add(
            new Object[] {
              count,
              ship.getId(),
              ship.getFleetid(),
              ship.getName(),
              ship.getType(),
              ship.getCond(),
              ship.getCondClearDateString(),
              ship.getLv(),
              ship.getNext(),
              ship.getExp(),
              ship.getSallyArea().getName(),
              ship.getSeiku(),
              ship.getSlot().get(0),
              ship.getSlot().get(1),
              ship.getSlot().get(2),
              ship.getSlot().get(3),
              ship.getSlot().get(5),
              ship.getMaxhp(),
              ship.getKaryoku(),
              ship.getRaisou(),
              ship.getTaiku(),
              ship.getSoukou(),
              ship.getKaihi(),
              ship.getTaisen(),
              ship.getSakuteki(),
              ship.getLucky(),
              ship.getAccuracy(),
              ship.getHougekiPower(),
              ship.getRaigekiPower(),
              ship.getTaisenPower(),
              ship.getYasenPower()
            });
      } else {
        // 成長の余地
        // 火力
        long karyoku = ship.getKaryokuMax() - ship.getKaryoku();
        // 雷装
        long raisou = ship.getRaisouMax() - ship.getRaisou();
        // 対空
        long taiku = ship.getTaikuMax() - ship.getTaiku();
        // 装甲
        long soukou = ship.getSoukouMax() - ship.getSoukou();
        // 回避
        long kaihi = ship.getKaihiMax() - ship.getKaihi();
        // 対潜
        long taisen = ship.getTaisenMax() - ship.getTaisen();
        // 索敵
        long sakuteki = ship.getSakutekiMax() - ship.getSakuteki();
        // 運
        long lucky = ship.getLuckyMax() - ship.getLucky();

        for (ItemDto item : ship.getItem()) {
          if (item != null) {
            karyoku += item.getHoug();
            raisou += item.getRaig();
            taiku += item.getTyku();
            soukou += item.getSouk();
            kaihi += item.getHouk();
            taisen += item.getTais();
            sakuteki += item.getSaku();
            lucky += item.getLuck();
          }
        }
        body.add(
            new Object[] {
              count,
              ship.getId(),
              ship.getFleetid(),
              ship.getName(),
              ship.getType(),
              ship.getCond(),
              ship.getCondClearDateString(),
              ship.getLv(),
              ship.getNext(),
              ship.getExp(),
              ship.getSallyArea().getName(),
              ship.getSeiku(),
              ship.getSlot().get(0),
              ship.getSlot().get(1),
              ship.getSlot().get(2),
              ship.getSlot().get(3),
              ship.getSlot().get(5),
              ship.getMaxhp(),
              karyoku,
              raisou,
              taiku,
              soukou,
              kaihi,
              taisen,
              sakuteki,
              lucky,
              ship.getAccuracy(),
              ship.getHougekiPower(),
              ship.getRaigekiPower(),
              ship.getTaisenPower(),
              ship.getYasenPower()
            });
      }
    }
    return toListStringArray(body);
  }