private void init() {
   for (Item each : getItems()) {
     _totalChance += each.getChance();
     if (ItemTable.getInstance().getTemplate(each.getItemId()) == null) {
       getItems().remove(each);
       _log.warning("item ID " + each.getItemId() + " is not found。");
     }
   }
   if ((getTotalChance() != 0) && (getTotalChance() != 1000000)) {
     _log.warning("ID " + getBoxId() + " 的總機率不等於100%。");
   }
 }
  /**
   * TreasureBoxを開けるPCにアイテムを入手させる。PCがアイテムを持ちきれなかった場合は アイテムは地面に落ちる。
   *
   * @param pc - TreasureBoxを開けるPC
   * @return 開封した結果何らかのアイテムが出てきた場合はtrueを返す。 持ちきれず地面に落ちた場合もtrueになる。
   */
  public boolean open(PcInstance pc) {
    ItemInstance item = null;

    if (getType().equals(TYPE.SPECIFIC)) {
      // 出るアイテムが決まっているもの
      for (Item each : getItems()) {
        item = ItemTable.getInstance().createItem(each.getItemId());
        item.setEnchantLevel(each.getEnchant()); // Enchant Feature for treasure_box
        if (item != null) {
          item.setCount(each.getCount());
          storeItem(pc, item);
        }
      }

    } else if (getType().equals(TYPE.RANDOM)) {
      // 出るアイテムがランダムに決まるもの
      int chance = 0;

      int r = Random.nextInt(getTotalChance());

      for (Item each : getItems()) {
        chance += each.getChance();

        if (r < chance) {
          item = ItemTable.getInstance().createItem(each.getItemId());
          item.setEnchantLevel(each.getEnchant()); // Enchant Feature for treasure_box
          if (item != null) {
            item.setCount(each.getCount());
            storeItem(pc, item);
          }
          break;
        }
      }
    }

    if (item == null) {
      return false;
    } else {
      int itemId = getBoxId();

      // 魂の結晶の破片、魔族のスクロール、ブラックエントの実
      if ((itemId == 40576)
          || (itemId == 40577)
          || (itemId == 40578)
          || (itemId == 40411)
          || (itemId == 49013)) {
        pc.death(null); // キャラクターを死亡させる
      }

      // 多魯嘉之袋
      if ((itemId == 46000)) {
        ItemInstance box = pc.getInventory().findItemId(itemId);
        box.setChargeCount(box.getChargeCount() - 1);
        pc.getInventory().updateItem(box, LsimulatorPcInventory.COL_CHARGE_COUNT);
        if (box.getChargeCount() < 1) {
          pc.getInventory().removeItem(box, 1);
        }
      }

      return true;
    }
  }