@Override
  public boolean useBypass(String command, L2PcInstance player, L2Character bypassOrigin) {
    final QuestState qs = getQuestState(player, false);
    if ((qs != null)
        || (player.getLevel() < MIN_LEVEL)
        || (player.getLevel() > MAX_LEVEL)
        || (player.getRace() == Race.ERTHEIA)) {
      return false;
    }

    if (player.isInParty()) {
      player.sendPacket(
          new ExShowScreenMessage("You cannot teleport when you are in party.", 5000));
    } else if (player.isInCombat()) {
      player.sendPacket(
          new ExShowScreenMessage("You cannot teleport when you are in combat.", 5000));
    } else if (player.isInDuel()) {
      player.sendPacket(
          new ExShowScreenMessage("You cannot teleport when you are in a duel.", 5000));
    } else if (player.isInOlympiadMode()) {
      player.sendPacket(
          new ExShowScreenMessage("You cannot teleport when you are in Olympiad.", 5000));
    } else if (player.isInVehicle()) {
      player.sendPacket(
          new ExShowScreenMessage(
              "You cannot teleport when you are in any vehicle or mount.", 5000));
    } else {
      player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
      player.teleToLocation(TELE_LOCATION);
    }
    return true;
  }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    final QuestState qs = getQuestState(player, true);
    String htmltext = getNoQuestMsg(player);
    if (qs.isCompleted()) {
      return getAlreadyCompletedMsg(player);
    }
    if (player.getRace() == Race.ERTHEIA) {
      return "33864-noErtheia.html";
    }

    switch (npc.getId()) {
      case PATERSON:
        {
          if (qs.isCreated()) {
            htmltext = "33864-01.htm";
          } else if (qs.isStarted()) {
            htmltext = "33864-03.html";
          }
          break;
        }
      case SHUVANN:
        {
          if (qs.isCond(1)) {
            htmltext = "33867-01.html";
          }
          break;
        }
    }
    return htmltext;
  }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    final QuestState qs = getQuestState(player, true);
    String htmltext = getNoQuestMsg(player);
    if (qs.isCompleted()) {
      return getAlreadyCompletedMsg(player);
    }
    if (player.getRace() == Race.ERTHEIA) {
      return "31292-noErtheia.html";
    }
    if (player.isMageClass()) {
      return "31292-noMage.html";
    }

    switch (npc.getId()) {
      case ANDREI:
        {
          if (qs.isCreated()) {
            htmltext = "31292-01.htm";
          } else if (qs.isStarted()) {
            htmltext = "31292-03.html";
          }
          break;
        }
      case JANITT:
        {
          if (qs.isCond(1)) {
            htmltext = "33851-01.html";
          }
          break;
        }
    }
    return htmltext;
  }
Example #4
0
 private static final String checkConditions(L2Npc npc, L2PcInstance player) {
   final L2Party party = player.getParty();
   // player must be in party
   if (party == null) {
     player.sendPacket(SystemMessageId.YOU_ARE_NOT_CURRENTLY_IN_A_PARTY_SO_YOU_CANNOT_ENTER);
     return "32330-05.html";
   }
   // ...and be party leader
   if (party.getLeader() != player) {
     player.sendPacket(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER);
     return "32330-08.html";
   }
   boolean _kamael = false;
   // for each party member
   for (L2PcInstance partyMember : party.getMembers()) {
     // player level must be in range
     if (partyMember.getLevel() > INSTANCE_LVL_MAX) {
       final SystemMessage sm =
           SystemMessage.getSystemMessage(
               SystemMessageId.C1_S_LEVEL_DOES_NOT_CORRESPOND_TO_THE_REQUIREMENTS_FOR_ENTRY);
       sm.addPcName(partyMember);
       player.sendPacket(sm);
       return "32330-06.html";
     }
     if (partyMember.getLevel() < INSTANCE_LVL_MIN) {
       final SystemMessage sm =
           SystemMessage.getSystemMessage(
               SystemMessageId.C1_S_LEVEL_DOES_NOT_CORRESPOND_TO_THE_REQUIREMENTS_FOR_ENTRY);
       sm.addPcName(partyMember);
       player.sendPacket(sm);
       return "32330-07.html";
     }
     if (partyMember.getClassId().level() != 0) {
       final SystemMessage sm =
           SystemMessage.getSystemMessage(
               SystemMessageId.C1_S_LEVEL_DOES_NOT_CORRESPOND_TO_THE_REQUIREMENTS_FOR_ENTRY);
       sm.addPcName(partyMember);
       player.sendPacket(sm);
       return "32330-06.html";
     }
     // player must be near party leader
     if (!partyMember.isInsideRadius(player, 500, true, true)) {
       final SystemMessage sm =
           SystemMessage.getSystemMessage(
               SystemMessageId
                   .C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED);
       sm.addPcName(partyMember);
       player.sendPacket(sm);
       return "32330-08.html";
     }
     if (partyMember.getRace().ordinal() == 5) {
       _kamael = true;
     }
   }
   if (!_kamael) {
     return "32330-08.html";
   }
   return "ok";
 }
 @RegisterEvent(EventType.ON_PLAYER_LEVEL_CHANGED)
 @RegisterType(ListenerRegisterType.GLOBAL)
 public void OnPlayerLevelChanged(OnPlayerLevelChanged event) {
   final L2PcInstance player = event.getActiveChar();
   if ((player.getLevel() >= MIN_LEVEL)
       && (player.getLevel() <= MAX_LEVEL)
       && (player.getRace() != Race.ERTHEIA)) {
     final QuestState qs = getQuestState(player, false);
     if (qs == null) {
       final NpcHtmlMessage html = new NpcHtmlMessage(0, 0);
       html.setHtml(
           HtmCache.getInstance()
               .getHtm(
                   player.getHtmlPrefix(),
                   "scripts/quests/Q10404_KekropusLetter_AHiddenMeaning/Announce.html"));
       player.sendPacket(html);
     }
   }
 }