Пример #1
0
 private void rndSpawn(int npcId, int count) {
   for (int i = 0; i < count; i++) {
     SpawnTemplate template = rndSpawnInRange(npcId);
     VisibleObjectSpawner.spawnEnemyServant(
         template, getOwner().getInstanceId(), getOwner(), (byte) getOwner().getLevel());
   }
 }
Пример #2
0
  @Override
  protected void runImpl() {

    final Player player = getConnection().getActivePlayer();
    boolean haveUnreadExpress =
        (player.getMailbox().haveUnreadByType(LetterType.EXPRESS)
            || player.getMailbox().haveUnreadByType(LetterType.BLACKCLOUD));
    switch (this.action) {
      case 0:
        // window is closed
        if (player.getPostman() != null) {
          player.getPostman().getController().onDelete();
          player.setPostman(null);
        }
        break;
      case 1:
        // click on icon
        if (player.getPostman() != null) {
          PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.STR_POSTMAN_ALREADY_SUMMONED);
        } else if (player.isFlying()) {
          PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.STR_POSTMAN_UNABLE_IN_FLIGHT);
        } else if (player.getController().hasTask(TaskId.EXPRESS_MAIL_USE)) {
          PacketSendUtility.sendPacket(player, SM_SYSTEM_MESSAGE.STR_POSTMAN_UNABLE_IN_COOLTIME);
        } else if (haveUnreadExpress) {
          VisibleObjectSpawner.spawnPostman(player);
          Future<?> task =
              ThreadPoolManager.getInstance()
                  .schedule(
                      new Runnable() {
                        @Override
                        public void run() {}
                      },
                      600000); // 10 min
          player.getController().addTask(TaskId.EXPRESS_MAIL_USE, task);
        }
        break;
    }
  }