/** 지정된 위치에 돌을 둔다. */
 private void putElementalStone(L1Location loc) {
   L1GroundInventory gInventory = L1World.getInstance().getInventory(loc);
   L1ItemInstance item = ItemTable.getInstance().createItem(L1ItemId.ELEMENTAL_STONE);
   item.setEnchantLevel(0);
   item.setCount(1);
   gInventory.storeItem(item);
   _itemList.add(gInventory);
 }
 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]);
     }
   }
 }
Beispiel #3
0
 @Override
 public void clickItem(L1Character cha, ClientBasePacket packet) {
   if (cha instanceof L1PcInstance) {
     L1PcInstance pc = (L1PcInstance) cha;
     L1ItemInstance useItem = pc.getInventory().getItem(this.getId());
     int itemId = this.getItemId();
     L1ItemInstance l1iteminstance1 = pc.getInventory().getItem(packet.readD());
     if (itemId == 50020) { // 봉인줌서
       if (l1iteminstance1.getBless() >= 0 && l1iteminstance1.getBless() <= 3) {
         int Bless = 0;
         switch (l1iteminstance1.getBless()) {
           case 0:
             Bless = 128;
             break; // 축
           case 1:
             Bless = 129;
             break; // 보통
           case 2:
             Bless = 130;
             break; // 저주
           case 3:
             Bless = 131;
             break; // 미확인
         }
         l1iteminstance1.setBless(Bless);
         pc.getInventory().updateItem(l1iteminstance1, L1PcInventory.COL_BLESS);
         pc.getInventory().saveItem(l1iteminstance1, L1PcInventory.COL_BLESS);
         pc.getInventory().removeItem(useItem, 1);
       } else pc.sendPackets(new S_ServerMessage(79)); // \f1 아무것도 일어나지 않았습니다.
     } else if (itemId == 50021) { // 봉인해제줌서
       if (l1iteminstance1.getBless() >= 128 && l1iteminstance1.getBless() <= 131) {
         int Bless = 0;
         switch (l1iteminstance1.getBless()) {
           case 128:
             Bless = 0;
             break;
           case 129:
             Bless = 1;
             break;
           case 130:
             Bless = 2;
             break;
           case 131:
             Bless = 3;
             break;
         }
         l1iteminstance1.setBless(Bless);
         pc.getInventory().updateItem(l1iteminstance1, L1PcInventory.COL_BLESS);
         pc.getInventory().saveItem(l1iteminstance1, L1PcInventory.COL_BLESS);
         pc.getInventory().removeItem(useItem, 1);
       } else pc.sendPackets(new S_ServerMessage(79)); // \f1 아무것도 일어나지 않았습니다.	
     }
   }
 }
Beispiel #4
0
 @Override
 public void execute(L1PcInstance pc, String cmdName, String arg) {
   try {
     StringTokenizer st = new StringTokenizer(arg);
     int gfxid = Integer.parseInt(st.nextToken(), 10);
     int count = Integer.parseInt(st.nextToken(), 10);
     L1ItemInstance item = null;
     for (int i = 0; i < count; i++) {
       item = ItemTable.getInstance().createItem(40005);
       item.getItem().setGfxId(gfxid + i);
       item.getItem().setName(String.valueOf(gfxid + i));
       item.getItem().setNameId(String.valueOf(gfxid + i));
       pc.getInventory().storeItem(item);
     }
   } catch (Exception exception) {
     pc.sendPackets(new S_SystemMessage(cmdName + " [id] [출현시키는 수]로 입력해 주세요. "));
   }
 }
Beispiel #5
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);
        }
      }
    }
  }