Esempio n. 1
0
  @Override
  protected void runImpl() {
    final L2PcInstance activeChar = getClient().getActiveChar();
    if (activeChar == null) return;

    // You cannot do anything while fishing
    if (activeChar.isFishing()) {
      activeChar.sendPacket(SystemMessageId.CANNOT_DO_WHILE_FISHING_3);
      return;
    }

    // check if the actionId is allowed
    if (_actionId < 2 || _actionId > 13) {
      Util.handleIllegalPlayerAction(
          activeChar,
          activeChar.getName()
              + " of account "
              + activeChar.getAccountName()
              + " requested an internal Social Action.",
          Config.DEFAULT_PUNISH);
      return;
    }

    if (!activeChar.isInStoreMode()
        && activeChar.getActiveRequester() == null
        && !activeChar.isAlikeDead()
        && (!activeChar.isAllSkillsDisabled() || activeChar.isInDuel())
        && activeChar.getAI().getIntention() == CtrlIntention.IDLE) {
      if (Config.DEBUG) _log.fine("Social Action: " + _actionId);

      activeChar.broadcastPacket(new SocialAction(activeChar, _actionId));
    }
  }
Esempio n. 2
0
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = getNoQuestMsg();
    QuestState st = player.getQuestState(qn);
    if (st == null) return htmltext;

    switch (st.getState()) {
      case STATE_CREATED:
        final int classId = player.getClassId().getId();
        if (classId != 0x01 && classId != 0x2f && classId != 0x13 && classId != 0x20)
          htmltext = "30623-02.htm";
        else if (player.getLevel() < 39) htmltext = "30623-01.htm";
        else htmltext = "30623-03.htm";
        break;

      case STATE_STARTED:
        int cond = st.getInt("cond");
        if (cond == 2) htmltext = "30623-07a.htm";
        else if (cond == 3) htmltext = "30623-13.htm";
        else if (cond == 4) htmltext = "30623-17.htm";
        else if (cond == 5) {
          htmltext = "30623-18.htm";
          st.takeItems(FINAL_ORDER, 1);
          st.takeItems(EXCURO_SKIN, -1);
          st.takeItems(KRATOR_SHARD, -1);
          st.takeItems(GRANDIS_SKIN, -1);
          st.takeItems(TIMAK_ORC_BELT, -1);
          st.takeItems(LAKIN_MACE, -1);
          st.giveItems(MARK_OF_DUELIST, 1);
          st.rewardExpAndSp(47015, 20000);
          player.broadcastPacket(new SocialAction(player, 3));
          st.playSound(QuestState.SOUND_FINISH);
          st.exitQuest(false);
        }
        break;

      case STATE_COMPLETED:
        htmltext = getAlreadyCompletedMsg();
        break;
    }

    return htmltext;
  }
  private void adminModifyCharacter(L2PcInstance activeChar, String modifications) {
    L2Object target = activeChar.getTarget();

    if (!(target instanceof L2PcInstance)) return;

    L2PcInstance player = (L2PcInstance) target;
    StringTokenizer st = new StringTokenizer(modifications);

    if (st.countTokens() != 6) {
      editCharacter(player);
      return;
    }

    String hp = st.nextToken();
    String mp = st.nextToken();
    String cp = st.nextToken();
    String pvpflag = st.nextToken();
    String pvpkills = st.nextToken();
    String pkkills = st.nextToken();

    int hpval = Integer.parseInt(hp);
    int mpval = Integer.parseInt(mp);
    int cpval = Integer.parseInt(cp);
    int pvpflagval = Integer.parseInt(pvpflag);
    int pvpkillsval = Integer.parseInt(pvpkills);
    int pkkillsval = Integer.parseInt(pkkills);

    // Common character information
    L2CoreMessage cm = new L2CoreMessage(MessageTable.Messages[30]);
    cm.addNumber(hpval);
    cm.addNumber(mpval);
    cm.addNumber(cpval);
    cm.addNumber(pvpflagval);
    cm.addNumber(pvpkillsval);
    cm.addNumber(pkkillsval);
    cm.sendMessage(player);
    player.setCurrentHp(hpval);
    player.setCurrentMp(mpval);
    player.setCurrentCp(cpval);
    player.setPvpFlag(pvpflagval);
    player.setPvpKills(pvpkillsval);
    player.setPkKills(pkkillsval);

    // Save the changed parameters to the database.
    player.store();

    StatusUpdate su = new StatusUpdate(player.getObjectId());
    su.addAttribute(StatusUpdate.CUR_HP, hpval);
    su.addAttribute(StatusUpdate.MAX_HP, player.getMaxHp());
    su.addAttribute(StatusUpdate.CUR_MP, mpval);
    su.addAttribute(StatusUpdate.MAX_MP, player.getMaxMp());
    su.addAttribute(StatusUpdate.CUR_CP, cpval);
    su.addAttribute(StatusUpdate.MAX_CP, player.getMaxCp());
    player.sendPacket(su);

    // Admin information
    cm = new L2CoreMessage(MessageTable.Messages[70]);
    cm.addString(player.getName());
    cm.addNumber(hpval);
    cm.addNumber(mpval);
    cm.addNumber(cpval);
    cm.addNumber(pvpflagval);
    cm.addNumber(pvpkillsval);
    cm.addNumber(pkkillsval);
    cm.sendMessage(activeChar);

    if (Config.DEBUG)
      _log.fine(
          "[GM]"
              + activeChar.getName()
              + " changed stats of "
              + player.getName()
              + ". "
              + " HP: "
              + hpval
              + " MP: "
              + mpval
              + " CP: "
              + cpval
              + " PvP: "
              + pvpflagval
              + " / "
              + pvpkillsval);

    showCharacterInfo(activeChar, null); // Back to start

    player.broadcastPacket(new CharInfo(player));
    player.sendPacket(new UserInfo(player));
    player.broadcastPacket(new ExBrExtraUserInfo(player));
    player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
    player.decayMe();
    player.spawnMe(activeChar.getX(), activeChar.getY(), activeChar.getZ());
  }
Esempio n. 4
0
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    QuestState st = player.getQuestState(qn);
    String htmltext = getNoQuestMsg();
    if (st == null) return htmltext;

    switch (st.getState()) {
      case STATE_CREATED:
        if (player.getClassId() != ClassId.wizard
            && player.getClassId() != ClassId.elvenWizard
            && player.getClassId() != ClassId.darkWizard) htmltext = "30461-01.htm";
        else if (player.getLevel() < 35) htmltext = "30461-02.htm";
        else htmltext = "30461-03.htm";
        break;

      case STATE_STARTED:
        int cond = st.getInt("cond");
        switch (npc.getNpcId()) {
          case MIRIEN:
            if (cond < 14) htmltext = "30461-05.htm";
            else if (cond == 14) {
              htmltext = "30461-06.htm";
              st.set("cond", "15");
              st.playSound(QuestState.SOUND_MIDDLE);
              st.takeItems(MIRIEN_SIGIL_1, 1);
              st.takeItems(SYMBOL_OF_SYLVAIN, 1);
              st.giveItems(MIRIEN_SIGIL_2, 1);
            } else if (cond > 14 && cond < 18) htmltext = "30461-07.htm";
            else if (cond == 18) {
              if (!st.hasQuestItems(MIRIEN_INSTRUCTION)) htmltext = "30461-08.htm";
              else {
                if (player.getLevel() < 36) htmltext = "30461-11.htm";
                else {
                  htmltext = "30461-12.htm";
                  st.set("cond", "19");
                  st.playSound(QuestState.SOUND_MIDDLE);
                  st.takeItems(MIRIEN_INSTRUCTION, 1);
                  st.takeItems(MIRIEN_SIGIL_2, 1);
                  st.takeItems(SYMBOL_OF_JUREK, 1);
                  st.giveItems(MIRIEN_SIGIL_3, 1);
                }
              }
            } else if (cond > 18 && cond < 31) htmltext = "30461-13.htm";
            else if (cond == 31) {
              htmltext = "30461-14.htm";
              st.takeItems(MIRIEN_SIGIL_3, 1);
              st.takeItems(SYMBOL_OF_CRONOS, 1);
              st.giveItems(MARK_OF_SCHOLAR, 1);
              st.rewardExpAndSp(80265, 30000);
              player.broadcastPacket(new SocialAction(player, 3));
              st.playSound(QuestState.SOUND_FINISH);
              st.exitQuest(false);
            }
            break;

          case SYLVAIN:
            if (cond == 1) htmltext = "30070-01.htm";
            else if (cond < 13) htmltext = "30070-03.htm";
            else if (cond == 13) {
              htmltext = "30070-04.htm";
              st.set("cond", "14");
              st.playSound(QuestState.SOUND_MIDDLE);
              st.takeItems(CRYSTAL_OF_PURITY_1, 1);
              st.takeItems(HIGH_PRIEST_SIGIL, 1);
              st.giveItems(SYMBOL_OF_SYLVAIN, 1);
            } else if (cond == 14) htmltext = "30070-05.htm";
            else if (cond > 14) htmltext = "30070-06.htm";
            break;

          case MARIA:
            if (cond == 2) htmltext = "30608-01.htm";
            else if (cond == 3) htmltext = "30608-03.htm";
            else if (cond == 4) {
              htmltext = "30608-04.htm";
              st.set("cond", "5");
              st.playSound(QuestState.SOUND_MIDDLE);
              st.takeItems(LUCAS_LETTER, 1);
              st.giveItems(MARIA_LETTER_2, 1);
            } else if (cond == 5) htmltext = "30608-05.htm";
            else if (cond == 6) htmltext = "30608-06.htm";
            else if (cond == 7) htmltext = "30608-09.htm";
            else if (cond == 8) {
              htmltext = "30608-10.htm";
              st.set("cond", "9");
              st.playSound(QuestState.SOUND_MIDDLE);
              st.takeItems(CRETA_PAINTING_1, 1);
              st.giveItems(CRETA_PAINTING_2, 1);
            } else if (cond == 9) htmltext = "30608-11.htm";
            else if (cond == 10) {
              htmltext = "30608-12.htm";
              st.set("cond", "11");
              st.playSound(QuestState.SOUND_MIDDLE);
            } else if (cond == 11) htmltext = "30608-12.htm";
            else if (cond == 12) htmltext = "30608-13.htm";
            else if (cond == 13) htmltext = "30608-15.htm";
            else if (st.hasAtLeastOneQuestItem(SYMBOL_OF_SYLVAIN, MIRIEN_SIGIL_2))
              htmltext = "30608-16.htm";
            else if (cond > 18) {
              if (!st.hasQuestItems(VALKON_REQUEST)) htmltext = "30608-17.htm";
              else {
                htmltext = "30608-18.htm";
                st.takeItems(VALKON_REQUEST, 1);
                st.giveItems(CRYSTAL_OF_PURITY_2, 1);
              }
            }
            break;

          case JUREK:
            if (cond == 15) htmltext = "30115-01.htm";
            else if (cond == 16) htmltext = "30115-04.htm";
            else if (cond == 17) {
              htmltext = "30115-05.htm";
              st.set("cond", "18");
              st.playSound(QuestState.SOUND_MIDDLE);
              st.takeItems(GRAND_MAGISTER_SIGIL, 1);
              st.takeItems(JUREK_LIST, 1);
              st.takeItems(MONSTER_EYE_DESTROYER_SKIN, -1);
              st.takeItems(SHACKLE_SCALP, -1);
              st.takeItems(SHAMAN_NECKLACE, -1);
              st.giveItems(SYMBOL_OF_JUREK, 1);
            } else if (cond == 18) htmltext = "30115-06.htm";
            else if (cond > 18) htmltext = "30115-07.htm";
            break;

          case LUCAS:
            if (cond == 3) {
              htmltext = "30071-01.htm";
              st.set("cond", "4");
              st.playSound(QuestState.SOUND_MIDDLE);
              st.takeItems(MARIA_LETTER_1, 1);
              st.giveItems(LUCAS_LETTER, 1);
            } else if (cond > 3 && cond < 9) htmltext = "30071-02.htm";
            else if (cond == 9) htmltext = "30071-03.htm";
            else if (cond == 10 || cond == 11) htmltext = "30071-05.htm";
            else if (cond == 12) htmltext = "30071-06.htm";
            else if (cond > 12) htmltext = "30071-07.htm";
            break;

          case CRETA:
            if (cond == 5) htmltext = "30609-01.htm";
            else if (cond == 6) htmltext = "30609-06.htm";
            else if (cond == 7) htmltext = "30609-07.htm";
            else if (cond > 7 && cond < 13) htmltext = "30609-10.htm";
            else if (cond >= 13 && cond < 19) htmltext = "30609-11.htm";
            else if (cond == 21) htmltext = "30609-12.htm";
            else if (cond > 21) htmltext = "30609-15.htm";
            break;

          case CRONOS:
            if (cond == 19) htmltext = "30610-01.htm";
            else if (cond > 19 && cond < 30) htmltext = "30610-11.htm";
            else if (cond == 30) htmltext = "30610-12.htm";
            else if (cond == 31) htmltext = "30610-15.htm";
            break;

          case DIETER:
            if (cond == 20) htmltext = "30111-01.htm";
            else if (cond == 21) htmltext = "30111-06.htm";
            else if (cond == 22) htmltext = "30111-07.htm";
            else if (cond == 23) htmltext = "30111-10.htm";
            else if (cond == 24) htmltext = "30111-11.htm";
            else if (cond > 24 && cond < 31)
              htmltext =
                  (!st.hasQuestItems(
                          SCRIPTURE_CHAPTER_1,
                          SCRIPTURE_CHAPTER_2,
                          SCRIPTURE_CHAPTER_3,
                          SCRIPTURE_CHAPTER_4))
                      ? "30111-12.htm"
                      : "30111-13.htm";
            else if (cond == 31) htmltext = "30111-15.htm";
            break;

          case EDROC:
            if (cond == 23) htmltext = "30230-01.htm";
            else if (cond == 24) htmltext = "30230-03.htm";
            else if (cond > 24) htmltext = "30230-04.htm";
            break;

          case RAUT:
            if (cond == 24) htmltext = "30316-01.htm";
            else if (cond == 25) htmltext = "30316-04.htm";
            else if (cond > 25) htmltext = "30316-05.htm";
            break;

          case TRIFF:
            if (cond == 25) htmltext = "30611-01.htm";
            else if (cond > 25) htmltext = "30611-05.htm";
            break;

          case VALKON:
            if (st.hasQuestItems(TRIFF_RING)) {
              if (!st.hasQuestItems(SCRIPTURE_CHAPTER_2)) {
                if (!st.hasQuestItems(VALKON_REQUEST)) {
                  if (!st.hasQuestItems(CRYSTAL_OF_PURITY_2)) htmltext = "30103-01.htm";
                  else {
                    htmltext = "30103-06.htm";
                    st.takeItems(CRYSTAL_OF_PURITY_2, 1);
                    st.giveItems(SCRIPTURE_CHAPTER_2, 1);
                  }
                } else htmltext = "30103-05.htm";
              } else htmltext = "30103-07.htm";
            }
            break;

          case POITAN:
            if (cond == 26 || cond == 27) {
              if (!st.hasQuestItems(POITAN_NOTES)) {
                htmltext = "30458-01.htm";
                st.giveItems(POITAN_NOTES, 1);
              } else htmltext = "30458-02.htm";
            } else if (cond == 28 || cond == 29) htmltext = "30458-03.htm";
            else if (cond == 30) htmltext = "30458-04.htm";
            break;

          case CASIAN:
            if ((cond == 26 || cond == 27) && st.hasQuestItems(POITAN_NOTES)) {
              if (st.hasQuestItems(SCRIPTURE_CHAPTER_1, SCRIPTURE_CHAPTER_2, SCRIPTURE_CHAPTER_3))
                htmltext = "30612-02.htm";
              else {
                htmltext = "30612-01.htm";
                if (cond == 26) {
                  st.set("cond", "27");
                  st.playSound(QuestState.SOUND_MIDDLE);
                }
              }
            } else if (cond == 28) htmltext = "30612-05.htm";
            else if (cond == 29) htmltext = "30612-06.htm";
            else if (cond == 30) htmltext = "30612-08.htm";
            break;
        }
        break;

      case STATE_COMPLETED:
        htmltext = getAlreadyCompletedMsg();
        break;
    }

    return htmltext;
  }
Esempio n. 5
0
  @Override
  public boolean useAdminCommand(String command, L2PcInstance activeChar) {
    if (command.equals("admin_forge")) showMainPage(activeChar);
    else if (command.startsWith("admin_forge2")) {
      try {
        StringTokenizer st = new StringTokenizer(command);
        st.nextToken();
        String format = st.nextToken();
        showPage2(activeChar, format);
      } catch (Exception ex) {
        activeChar.sendMessage("Usage: //forge2 format");
      }
    } else if (command.startsWith("admin_forge3")) {
      try {
        StringTokenizer st = new StringTokenizer(command);
        st.nextToken();
        String format = st.nextToken();
        boolean broadcast = false;

        if (format.toLowerCase().equals("broadcast")) {
          format = st.nextToken();
          broadcast = true;
        }

        AdminForgePacket sp = new AdminForgePacket();
        for (int i = 0; i < format.length(); i++) {
          String val = st.nextToken();
          if (val.toLowerCase().equals("$objid")) {
            val = String.valueOf(activeChar.getObjectId());
          } else if (val.toLowerCase().equals("$tobjid")) {
            val = String.valueOf(activeChar.getTarget().getObjectId());
          } else if (val.toLowerCase().equals("$bobjid")) {
            if (activeChar.getBoat() != null) {
              val = String.valueOf(activeChar.getBoat().getObjectId());
            }
          } else if (val.toLowerCase().equals("$clanid")) {
            val = String.valueOf(activeChar.getCharId());
          } else if (val.toLowerCase().equals("$allyid")) {
            val = String.valueOf(activeChar.getAllyId());
          } else if (val.toLowerCase().equals("$tclanid")) {
            val = String.valueOf(((L2PcInstance) activeChar.getTarget()).getCharId());
          } else if (val.toLowerCase().equals("$tallyid")) {
            val = String.valueOf(((L2PcInstance) activeChar.getTarget()).getAllyId());
          } else if (val.toLowerCase().equals("$x")) {
            val = String.valueOf(activeChar.getX());
          } else if (val.toLowerCase().equals("$y")) {
            val = String.valueOf(activeChar.getY());
          } else if (val.toLowerCase().equals("$z")) {
            val = String.valueOf(activeChar.getZ());
          } else if (val.toLowerCase().equals("$heading")) {
            val = String.valueOf(activeChar.getHeading());
          } else if (val.toLowerCase().equals("$tx")) {
            val = String.valueOf(activeChar.getTarget().getX());
          } else if (val.toLowerCase().equals("$ty")) {
            val = String.valueOf(activeChar.getTarget().getY());
          } else if (val.toLowerCase().equals("$tz")) {
            val = String.valueOf(activeChar.getTarget().getZ());
          } else if (val.toLowerCase().equals("$theading")) {
            val = String.valueOf(((L2PcInstance) activeChar.getTarget()).getHeading());
          }

          sp.addPart(format.getBytes()[i], val);
        }

        if (broadcast) activeChar.broadcastPacket(sp);
        else activeChar.sendPacket(sp);

        showPage3(activeChar, format, command);
      } catch (Exception ex) {
        activeChar.sendMessage("Usage: //forge or //forge2 format");
      }
    }
    return true;
  }