Example #1
0
  /** 목록에 아이템을 복수개 정리해 추가한다. */
  public S_InvList(L1PcInstance pc) {
    List<L1ItemInstance> items = pc.getInventory().getItems();

    for (L1ItemInstance item : items) {
      if (item.getItemId() == L1ItemId.DRAGON_KEY) {
        if (System.currentTimeMillis() > item.getEndTime().getTime()) {
          pc.getInventory().deleteItem(item);
        }
      }
    }
    writeC(Opcodes.S_OPCODE_INVLIST);
    writeC(items.size());
    byte[] status = null;
    for (L1ItemInstance item : items) {
      writeD(item.getId());
      writeC(item.getItem().getUseType());
      writeC(0);
      writeH(item.get_gfxid());
      writeC(item.getBless());
      writeD(item.getCount());
      writeC((item.isIdentified()) ? 1 : 0);
      writeS(item.getViewName());
      if (!item.isIdentified()) {
        // 미감정의 경우 스테이터스를 보낼 필요는 없다
        writeC(0);
      } else {
        status = item.getStatusBytes();
        writeC(status.length);
        for (byte b : status) {
          writeC(b);
        }
      }
    }
  }
 private void DragonkeyTimeCheck(L1PcInstance pc, int count) {
   long nowtime = System.currentTimeMillis();
   if (count == 1) {
     L1ItemInstance item = pc.getInventory().findItemId(L1ItemId.DRAGON_KEY);
     if (nowtime > item.getEndTime().getTime()) pc.getInventory().removeItem(item);
   } else {
     L1ItemInstance[] itemList = pc.getInventory().findItemsId(L1ItemId.DRAGON_KEY);
     for (int i = 0; i < itemList.length; i++) {
       if (nowtime > itemList[i].getEndTime().getTime()) pc.getInventory().removeItem(itemList[i]);
     }
   }
 }