Esempio n. 1
0
 public String onTalk(L2NpcInstance npc, L2PcInstance player) {
   String htmltext =
       "<html><body>Вы не взяли квест для этого NPC или просто не соответствуете его минимальным требованиям!</body></html>";
   QuestState st = player.getQuestState(qn);
   if (st == null) return htmltext;
   int id = st.getState();
   int cond = st.getInt("cond");
   if (id == State.COMPLETED) {
     return "<html><body>Данный квест уже выполнен.</body></html>";
   } else if (cond == 0) {
     if (player.getRace().ordinal() != 2) {
       htmltext = "30141-00.htm";
       st.exitQuest(true);
     } else if (player.getLevel() >= 16) {
       htmltext = "30141-02.htm";
     } else {
       htmltext = "30141-01.htm";
       st.exitQuest(true);
     }
   } else if (cond == 1) {
     htmltext = "30141-04.htm";
   } else if (cond == 2) {
     htmltext = "30141-06.htm";
     st.takeItems(ONYX_BEAST_EYE, -1);
     st.takeItems(TAINT_STONE, -1);
     st.takeItems(SUCCUBUS_BLOOD, -1);
     st.giveItems(956, 1);
     st.unset("cond");
     st.exitQuest(false);
     st.playSound("ItemSound.quest_finish");
   }
   return htmltext;
 }
Esempio n. 2
0
  /**
   * Verifies if player can join the given party room and either adds the player to the party room
   * or sends a message why the player could not join the room.<br>
   * <I>Parameters may be <CODE>null</CODE>, which guarantees <CODE>false</CODE></I>
   *
   * @param activeChar a player
   * @param room a party room
   * @param checkForParty whether check if the player is in party/[room]
   * @return true if player joined the given room, false otherwise
   */
  public static final boolean tryJoin(
      L2PcInstance activeChar, L2PartyRoom room, boolean checkForParty) {
    if (activeChar == null) return false;

    if (checkForParty) {
      if (activeChar.getPartyRoom() != null || activeChar.getParty() != null) {
        activeChar.sendPacket(SystemMessageId.PARTY_ROOM_FORBIDDEN);
        return false;
      }
    }

    if (room == null) {
      activeChar.sendPacket(SystemMessageId.PARTY_ROOM_FORBIDDEN);
      return false;
    } else if (!room.checkLevel(activeChar.getLevel())) {
      activeChar.sendPacket(SystemMessageId.CANT_ENTER_PARTY_ROOM);
      return false;
    } else if (room.getMemberCount() >= room.getMaxMembers()) {
      activeChar.sendPacket(SystemMessageId.PARTY_ROOM_FULL);
      return false;
    }
    room.addMember(activeChar);
    return true;
  }
Esempio n. 3
0
 /**
  * Verifies is player is eligible to join this party room.<br>
  * Does not specify a reason, does not send a message.
  *
  * @param activeChar a player
  * @return whether the given player can join this room
  * @see #tryJoin(L2PcInstance, L2PartyRoom, boolean)
  */
 public final boolean canJoin(L2PcInstance activeChar) {
   return (activeChar.getPartyRoom() == null
       && activeChar.getParty() == null
       && checkLevel(activeChar.getLevel())
       && getMemberCount() < getMaxMembers());
 }