Ejemplo n.º 1
0
 public ServerObjectInfo(L2Npc activeChar, L2Character actor) {
   _activeChar = activeChar;
   _idTemplate = _activeChar.getTemplate().getDisplayId();
   _isAttackable = _activeChar.isAutoAttackable(actor);
   _collisionHeight = _activeChar.getCollisionHeight();
   _collisionRadius = _activeChar.getCollisionRadius();
   _x = _activeChar.getX();
   _y = _activeChar.getY();
   _z = _activeChar.getZ();
   _heading = _activeChar.getHeading();
   _name =
       _activeChar.getTemplate().isUsingServerSideName()
           ? _activeChar.getTemplate().getName()
           : "";
 }
Ejemplo n.º 2
0
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = getNoQuestMsg(player);
    final QuestState st = getQuestState(player, true);

    if (st == null) {
      return htmltext;
    }

    if (npc.getId() == KANEMIKA) {
      switch (st.getState()) {
        case State.COMPLETED:
          if (!st.isNowAvailable()) {
            htmltext = "32650-03.html";
            break;
          }
          st.setState(State.CREATED);
        case State.CREATED:
          htmltext = (player.getLevel() >= MIN_LEVEL) ? "32650-01.htm" : "32650-02.htm";
          break;
        case State.STARTED:
          if (st.isCond(1)) {
            htmltext =
                (!st.hasQuestItems(EVIDENCE_OF_MIGRATION)) ? "32650-08.html" : "32650-09.html";
          } else {
            st.giveAdena(
                65000, true); // Glory days reward: 6 886 980 exp, 8 116 410 sp, 371 400 Adena
            st.exitQuest(QuestType.DAILY, true);
            htmltext = "32650-10.html";
          }
          break;
      }
    } else if (st.isCond(1)) {
      if (npc.isBusy()) {
        return null;
      }

      if (getRandom(100) < 66) {
        st.giveItems(EVIDENCE_OF_MIGRATION, 1);
        st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
        npc.getAI()
            .setIntention(
                CtrlIntention.AI_INTENTION_MOVE_TO,
                new Location(npc.getX() + 100, npc.getY() + 100, npc.getZ(), 0));
        npc.setBusy(true);

        startQuestTimer("despawn", 3000, npc, player);

        if (st.getQuestItemsCount(EVIDENCE_OF_MIGRATION) == 10) {
          st.setCond(2, true);
        }
        htmltext = "32651-01.html";
      } else {
        if (getRandom(100) < 50) {
          npc.broadcastPacket(
              new NpcSay(
                  npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GRUNT_OH));
        } else {
          npc.broadcastPacket(
              new NpcSay(
                  npc.getObjectId(),
                  ChatType.NPC_GENERAL,
                  npc.getId(),
                  NpcStringId.GRUNT_WHAT_S_WRONG_WITH_ME));
        }
        npc.deleteMe();
        htmltext = null;

        final L2Attackable monster =
            (L2Attackable)
                addSpawn(
                    WARRIOR_MON,
                    npc.getX(),
                    npc.getY(),
                    npc.getZ(),
                    npc.getHeading(),
                    true,
                    600000);
        monster.setRunning();
        monster.addDamageHate(player, 0, 999);
        monster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
        showOnScreenMsg(
            player,
            NpcStringId
                .THE_GRAVE_ROBBER_WARRIOR_HAS_BEEN_FILLED_WITH_DARK_ENERGY_AND_IS_ATTACKING_YOU,
            5,
            5000);
      }
    }

    return htmltext;
  }
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    final QuestState st = getQuestState(player, false);
    if (st == null) {
      return null;
    }

    String htmltext = event;
    switch (event) {
      case "30894-02.html":
      case "30297-04.html":
      case "30612-05.html":
      case "30612-06.html":
      case "30612-07.html":
      case "30612-08.html":
      case "32369-04.html":
      case "32369-05.html":
      case "32369-07.html":
      case "32369-08.html":
      case "32369-09.html":
      case "32369-10.html":
        break;
      case "30894-01.html":
        st.startQuest();
        break;
      case "30894-03.html":
        st.setCond(2, true);
        st.giveItems(SEALED_PROPHECY_PATH_OF_THE_GOD, 1);
        break;
      case "30297-03.html":
        st.takeItems(SEALED_PROPHECY_PATH_OF_THE_GOD, -1);
        st.set("talk", "1");
        break;
      case "30297-05.html":
        st.unset("talk");
        st.setCond(3, true);
        st.giveItems(PROPHECY_PATH_OF_THE_GOD, 1);
        st.giveItems(EMPTY_SOUND_CRYSTAL, 1);
        break;
      case "30612-03.html":
        st.takeItems(PROPHECY_PATH_OF_THE_GOD, -1);
        st.set("talk", "1");
        break;
      case "30612-09.html":
        st.unset("talk");
        st.setCond(4, true);
        st.giveItems(ANGEL_MEDICINE, 1);
        break;
      case "32368-04.html":
        if (isAngelSpawned) {
          return "32368-03.html";
        }
        addSpawn(ANGEL, npc.getX() + 100, npc.getY() + 100, npc.getZ(), 0, false, 120000);
        startQuestTimer("despawn", 120000, null, player);
        isAngelSpawned = true;
        break;
      case "32369-03.html":
        st.takeItems(ANGEL_MEDICINE, -1);
        st.set("talk", "1");
        break;
      case "32369-06.html":
        st.set("talk", "2");
        break;
      case "32369-11.html":
        st.unset("talk");
        st.takeItems(EMPTY_SOUND_CRYSTAL, -1);
        st.giveItems(ANGELS_MESSAGE, 1);
        st.setCond(5, true);
        npc.deleteMe();
        isAngelSpawned = false;
        break;
      case "despawn":
        if (isAngelSpawned) {
          isAngelSpawned = false;
        }
      default:
        htmltext = null;
        break;
    }
    return htmltext;
  }