示例#1
0
  @Override
  public boolean useVoicedCommand(String command, Player activeChar, String target) {
    if (!Config.ALLOW_VOICED_COMMANDS) return false;

    if (command.equals("rev") || command.equals("ver")) {
      activeChar.sendMessage("Project Revision: " + GameServer.PROJECT_REVISION);
      activeChar.sendMessage("Build Revision: beta.0.1");
      activeChar.sendMessage("Update: " + GameServer.UPDATE_NAME);
      activeChar.sendMessage("Build date: " + GameServer.getInstance().getVersion().getBuildDate());
    } else if (command.equals("date") || command.equals("time")) {
      activeChar.sendMessage(DATE_FORMAT.format(new Date(System.currentTimeMillis())));
      return true;
    }

    return false;
  }
  @Override
  public String onEvent(String event, QuestState st, NpcInstance npc) {
    Player player = st.getPlayer();
    if (player == null) return null;

    String htmltext = event;

    System.out.println("quest event " + event.toString());

    int classId = player.getClassId().getId();
    if (event.startsWith("UC")) {
      if (checkStartCondition(player)) {
        Quest q = QuestManager.getQuest(10779);
        player.processQuestEvent(q.getName(), "start_quest", null);
      }

      htmltext = "";
    }

    if (event.equalsIgnoreCase("start_quest") || event.equalsIgnoreCase("start_quest_7s")) {
      st.setCond(1);
      st.setState(STARTED);
      alertLetterReceived(st);
      st.showQuestHTML(st.getQuest(), "queen_letter.htm");

      htmltext = "";
    }

    if (event.equalsIgnoreCase("start_quest_delay")) {
      st.startQuestTimer("start_quest_7s", 7000);
      // only start quest after 7s to avoid crash on enterworld
      htmltext = "";
    }

    if (event.equalsIgnoreCase("Quest _10779_LetterFromTheQueen_SeaOfSpores to_oren")) {
      // System.out.println("in Quest _10779_LetterFromTheQueen_SeaOfSpores to_dion");
      if (st.getCond() == 1) {
        if (getItemCountById(player, SOE_OREN) > 0) {
          st.takeItems(SOE_OREN, 1);
          player.teleToLocation(83633, 53064, -1456);
          player.sendPacket(TutorialCloseHtmlPacket.STATIC);
        } else {
          player.sendMessage("Không tìm thấy Scroll of Escape: Town of Oren");
        }
      }
      htmltext = "";
    }
    // System.out.println("out " + event);
    if (event.equalsIgnoreCase("Quest _10779_LetterFromTheQueen_SeaOfSpores close_window")) {
      // System.out.println("in Quest _10779_LetterFromTheQueen_SeaOfSpores close_window");
      player.sendPacket(TutorialCloseHtmlPacket.STATIC);
      htmltext = "";
    }

    // Question mark clicked
    if (event.startsWith("QM")) {
      int MarkId = Integer.valueOf(event.substring(2));
      // System.out.println("Mark id " + MarkId);
      if (MarkId == 10779) {
        if (player.getRace() == Race.ERTHEIA) st.showQuestHTML(st.getQuest(), "queen_letter.htm");
        htmltext = "";
      }
    }

    if (event.equalsIgnoreCase("30191-3.htm")) {
      st.giveItems(SOE_SEA_OF_SPORES, 1);
      st.setCond(2);

      htmltext = "30191-3.htm";
    }

    if (event.equalsIgnoreCase("33845-2.htm")) {
      st.giveItems(STEEL_DOOR_COIN, 37, true);
      st.giveItems(SCROLL_EWB, 3, true);
      st.addExpAndSp(635250, 152);
      st.setState(COMPLETED);
      st.exitCurrentQuest(false);
      st.playSound(SOUND_FINISH);
      st.getPlayer()
          .sendPacket(
              new ExShowScreenMessage(
                  NEXT_LETTER_STRING,
                  7000,
                  ExShowScreenMessage.ScreenMessageAlign.TOP_CENTER,
                  true));

      htmltext = "33845-2.htm";
    }

    if (htmltext.isEmpty()) return null;
    else return htmltext;
  }
示例#3
0
  @Override
  protected void runImpl() {
    Player activeChar = getClient().getActiveChar();
    if (activeChar == null) return;

    if (activeChar.isOutOfControl()) {
      activeChar.sendActionFailed();
      return;
    }

    if (activeChar.isProcessingRequest()) {
      activeChar.sendPacket(SystemMsg.WAITING_FOR_ANOTHER_REPLY);
      return;
    }

    if (activeChar.isChaosFestivalParticipant()) {
      activeChar.sendPacket(
          SystemMsg
              .YOU_CANNOT_INVITE_A_FRIEND_OR_PARTY_WHILE_PARTICIPATING_IN_THE_CEREMONY_OF_CHAOS);
      return;
    }

    Player target = World.getPlayer(_name);
    if (target == null) {
      FakePlayerInstance fakePlayer = GameObjectsStorage.getFakePlayerByName(_name);
      if (fakePlayer != null) {
        new Request(L2RequestType.PARTY, activeChar, null)
            .setTimeout(10000L)
            .set("itemDistribution", _itemDistribution);
        activeChar.sendPacket(
            new SystemMessage2(SystemMsg.C1_HAS_BEEN_INVITED_TO_THE_PARTY).addName(fakePlayer));
        return;
      }
      activeChar.sendPacket(SystemMsg.THAT_PLAYER_IS_NOT_ONLINE);
      return;
    }

    if (target == activeChar) {
      activeChar.sendPacket(SystemMsg.THAT_IS_AN_INCORRECT_TARGET);
      activeChar.sendActionFailed();
      return;
    }

    if (Config.DISABLE_PARTY_ON_EVENT && target.isInPvPEvent()) {
      activeChar.sendPacket(new SystemMessage2(SystemMsg.C1_IS_ON_ANOTHER_TASK).addName(target));
      return;
    }

    if (Config.DISABLE_PARTY_ON_EVENT && activeChar.isInPvPEvent()) {
      activeChar.sendPacket(new SystemMessage2(SystemMsg.C1_IS_ON_ANOTHER_TASK).addName(target));
      return;
    }

    if (target.isChaosFestivalParticipant()) {
      activeChar.sendActionFailed();
      return;
    }

    if (target.isBusy()) {
      activeChar.sendPacket(new SystemMessage2(SystemMsg.C1_IS_ON_ANOTHER_TASK).addName(target));
      return;
    }

    IStaticPacket problem = target.canJoinParty(activeChar);
    if (problem != null) {
      activeChar.sendPacket(problem);
      return;
    }

    if (activeChar.isInParty()) {
      if (activeChar.getParty().getMemberCount() >= Party.MAX_SIZE) {
        activeChar.sendPacket(SystemMsg.THE_PARTY_IS_FULL);
        return;
      }

      // Только Party Leader может приглашать новых членов
      if (Config.PARTY_LEADER_ONLY_CAN_INVITE && !activeChar.getParty().isLeader(activeChar)) {
        activeChar.sendPacket(SystemMsg.ONLY_THE_LEADER_CAN_GIVE_OUT_INVITATIONS);
        return;
      }

      if (activeChar.getParty().isInDimensionalRift()) {
        activeChar.sendMessage(
            new CustomMessage(
                "l2s.gameserver.clientpackets.RequestJoinParty.InDimensionalRift", activeChar));
        activeChar.sendActionFailed();
        return;
      }
    }

    if (target.isFakePlayer() && activeChar.isGM()) {
      Party party = activeChar.getParty();

      if (party == null) {
        activeChar.setParty(party = new Party(activeChar, Party.ITEM_ORDER_SPOIL));
      }

      party.addPartyMember(target);
      return;
    }

    new Request(L2RequestType.PARTY, activeChar, target)
        .setTimeout(10000L)
        .set("itemDistribution", _itemDistribution);

    target.sendPacket(new AskJoinParty(activeChar.getName(), _itemDistribution));
    activeChar.sendPacket(
        new SystemMessage2(SystemMsg.C1_HAS_BEEN_INVITED_TO_THE_PARTY).addName(target));
  }