예제 #1
0
 /**
  * 装備でフィルタ
  *
  * @param ship
  * @param filter
  */
 private static boolean itemFilter(ShipDto ship, ShipFilterDto filter) {
   List<ItemDto> item = ship.getItem();
   boolean hit = false;
   for (ItemDto itemDto : item) {
     if (itemDto != null) {
       if (filter.itemname.equals(itemDto.getName())) {
         hit = true;
         break;
       }
     }
   }
   if (!hit) {
     return false;
   }
   return true;
 }
예제 #2
0
 public void updateContents(ShipFilterDto filter, boolean panelVisible, boolean etcVisible) {
   this.changeEnabled = false;
   Set<String> items = new TreeSet<String>();
   for (ItemDto entry : GlobalContext.getItemMap().values()) {
     items.add(entry.getName());
   }
   this.nametext.remove(0, this.nametext.getItemCount() - 1);
   for (String name : items) {
     this.nametext.add(name);
   }
   this.recreateGroupButtons();
   this.recreateShipTypeButtonos();
   this.applyFilter(filter);
   this.setPanelVisible(panelVisible, etcVisible);
   this.changeEnabled = true;
 }
  /**
   * 所有艦娘一覧の内容
   *
   * @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);
  }
  /**
   * 所有装備一覧の内容
   *
   * @return 内容
   */
  public static List<String[]> getItemListBody() {
    Set<Entry<Long, ItemDto>> items = ItemContext.get().entrySet();
    Map<ItemDto, Integer> itemCountMap = new HashMap<ItemDto, Integer>();

    for (Entry<Long, ItemDto> entry : items) {
      ItemDto item = entry.getValue();
      Integer count = itemCountMap.get(item);
      if (count == null) {
        count = 1;
      } else {
        count = count + 1;
      }
      itemCountMap.put(item, count);
    }

    List<Entry<ItemDto, Integer>> countitems =
        new ArrayList<Entry<ItemDto, Integer>>(itemCountMap.entrySet());
    Collections.sort(
        countitems,
        new Comparator<Entry<ItemDto, Integer>>() {
          @Override
          public int compare(Entry<ItemDto, Integer> o1, Entry<ItemDto, Integer> o2) {
            return o1.getValue().compareTo(o2.getValue());
          }
        });

    List<Object[]> body = new ArrayList<Object[]>();

    int count = 0;
    for (Entry<ItemDto, Integer> entry : countitems) {
      ItemDto item = entry.getKey();
      count++;
      body.add(
          new Object[] {
            count,
            item.getName(),
            item.getType(),
            entry.getValue(),
            item.getHoug(),
            item.getHoum(),
            item.getLeng(),
            item.getLuck(),
            item.getHouk(),
            item.getBaku(),
            item.getRaig(),
            item.getSaku(),
            item.getTais(),
            item.getTyku(),
            item.getSouk()
          });
    }
    return toListStringArray(body);
  }