예제 #1
0
파일: MC_Show.java 프로젝트: impos89/trunk
 @Override
 public String onSpawn(L2Npc npc) {
   if (IS_STARTED) {
     switch (npc.getId()) {
       case 32433:
         {
           autoChat(npc, MESSAGES[0], ChatType.NPC_SHOUT);
           startQuestTimer("1", 30000, npc, null);
           break;
         }
       case 32431:
         {
           npc.getAI()
               .setIntention(
                   CtrlIntention.AI_INTENTION_MOVE_TO, new Location(-56657, -56338, -2008, 33102));
           startQuestTimer("social1", 6000, npc, null, true);
           startQuestTimer("7", 215000, npc, null);
           break;
         }
       case 32432:
         {
           startQuestTimer("social1", 6000, npc, null, true);
           startQuestTimer("7", 215000, npc, null);
           break;
         }
       case 32442:
       case 32443:
       case 32444:
       case 32445:
       case 32446:
         {
           startQuestTimer("11", 100000, npc, null);
           break;
         }
       case 32424:
       case 32425:
       case 32426:
       case 32427:
       case 32428:
         {
           startQuestTimer("social1", 5500, npc, null);
           startQuestTimer("social1", 12500, npc, null);
           startQuestTimer("28", 19700, npc, null);
           break;
         }
     }
   }
   return super.onSpawn(npc);
 }
  @Override
  public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) {
    if (Util.checkIfInRange(1500, killer, npc, true)) {
      for (int i = 0; i < 20; i++) {
        final L2Npc guardian = addSpawn(SOUL_OF_TREE_GUARDIAN, npc);
        startQuestTimer("DESPAWN_GUARDIAN", 300000, guardian, null);

        if (i == 0) {
          npc.setTarget(killer);
          npc.doCast(VICIOUS_POISON.getSkill());
        }

        npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, killer);
      }
    }
    return super.onKill(npc, killer, isSummon);
  }
예제 #3
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;
  }
예제 #4
0
파일: MC_Show.java 프로젝트: impos89/trunk
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    if ((event == null) || event.isEmpty()) {
      _log.warning("MC_Show: Null/Empty event for npc " + npc + " and player " + player + "!");
      return null;
    }

    if (event.equalsIgnoreCase("Start")) {
      IS_STARTED = true;
      addSpawn(MC, -56698, -56430, -2008, 32768, false, 0);
    } else if ((npc != null) && IS_STARTED) {
      // TODO switch on event
      if (event.equalsIgnoreCase("6")) {
        autoChat(npc, MESSAGES[6], ChatType.NPC_SHOUT);
        npc.getAI()
            .setIntention(
                CtrlIntention.AI_INTENTION_MOVE_TO, new Location(-56511, -56647, -2008, 36863));
        npc.broadcastPacket(new PlaySound(1, "NS22_F", 0, 0, 0, 0, 0));
        addSpawn(SINGERS[0], -56344, -56328, -2008, 32768, false, 224000);
        addSpawn(SINGERS[1], -56552, -56245, -2008, 36863, false, 224000);
        addSpawn(SINGERS[1], -56546, -56426, -2008, 28672, false, 224000);
        addSpawn(SINGERS[1], -56570, -56473, -2008, 28672, false, 224000);
        addSpawn(SINGERS[1], -56594, -56516, -2008, 28672, false, 224000);
        addSpawn(SINGERS[1], -56580, -56203, -2008, 36863, false, 224000);
        addSpawn(SINGERS[1], -56606, -56157, -2008, 36863, false, 224000);
        startQuestTimer("7", 215000, npc, null);
      } else if (event.equalsIgnoreCase("7")) {
        switch (npc.getId()) {
          case 32433:
            {
              autoChat(npc, MESSAGES[7], ChatType.NPC_SHOUT);
              npc.getAI()
                  .setIntention(
                      CtrlIntention.AI_INTENTION_MOVE_TO,
                      new Location(-56698, -56430, -2008, 32768));
              startQuestTimer("8", 12000, npc, null);
              break;
            }
          default:
            {
              cancelQuestTimer("social1", npc, null);
              npc.getAI()
                  .setIntention(
                      CtrlIntention.AI_INTENTION_MOVE_TO,
                      new Location(-56594, -56064, -2008, 32768));
              break;
            }
        }
      } else if (event.equalsIgnoreCase("10")) {
        npc.getAI()
            .setIntention(
                CtrlIntention.AI_INTENTION_MOVE_TO, new Location(-56483, -56665, -2034, 32768));
        npc.broadcastPacket(new PlaySound(1, "TP05_F", 0, 0, 0, 0, 0));
        startQuestTimer(
            "npc1_1", 3000, addSpawn(CIRCUS[0], -56495, -56375, -2008, 32768, false, 101000), null);
        startQuestTimer(
            "npc2_1", 3000, addSpawn(CIRCUS[0], -56491, -56289, -2008, 32768, false, 101000), null);
        startQuestTimer(
            "npc3_1", 3000, addSpawn(CIRCUS[1], -56502, -56246, -2008, 32768, false, 101000), null);
        startQuestTimer(
            "npc4_1", 3000, addSpawn(CIRCUS[1], -56496, -56429, -2008, 32768, false, 101000), null);
        startQuestTimer(
            "npc5_1", 3500, addSpawn(CIRCUS[2], -56505, -56334, -2008, 32768, false, 101000), null);
        startQuestTimer(
            "npc6_1", 4000, addSpawn(CIRCUS[3], -56545, -56427, -2008, 32768, false, 101000), null);
        startQuestTimer(
            "npc7_1", 4000, addSpawn(CIRCUS[3], -56552, -56248, -2008, 32768, false, 101000), null);
        startQuestTimer(
            "npc8_1", 3000, addSpawn(CIRCUS[4], -56493, -56473, -2008, 32768, false, 101000), null);
        startQuestTimer(
            "npc9_1", 3000, addSpawn(CIRCUS[4], -56504, -56201, -2008, 32768, false, 101000), null);
        startQuestTimer("11", 100000, npc, null);
      } else if (event.equalsIgnoreCase("11")) {
        switch (npc.getId()) {
          case 32433:
            {
              autoChat(npc, MESSAGES[11], ChatType.NPC_SHOUT);
              npc.getAI()
                  .setIntention(
                      CtrlIntention.AI_INTENTION_MOVE_TO,
                      new Location(-56698, -56430, -2008, 32768));
              startQuestTimer("12", 5000, npc, null);
              break;
            }
          default:
            {
              npc.getAI()
                  .setIntention(
                      CtrlIntention.AI_INTENTION_MOVE_TO,
                      new Location(-56343, -56330, -2008, 32768));
              break;
            }
        }
      } else if (event.equalsIgnoreCase("14")) {
        startQuestTimer(
            "social1",
            2000,
            addSpawn(INDIVIDUALS[0], -56700, -56385, -2008, 32768, false, 49000),
            null);
        startQuestTimer("15", 7000, npc, null);
      } else if (event.equalsIgnoreCase("17")) {
        autoChat(npc, MESSAGES[16], ChatType.NPC_SHOUT);
        startQuestTimer(
            "social1",
            2000,
            addSpawn(INDIVIDUALS[1], -56700, -56340, -2008, 32768, false, 32000),
            null);
        startQuestTimer("18", 9000, npc, null);
      } else if (event.equalsIgnoreCase("20")) {
        startQuestTimer(
            "social1",
            2000,
            addSpawn(INDIVIDUALS[2], -56703, -56296, -2008, 32768, false, 13000),
            null);
        startQuestTimer("21", 8000, npc, null);
      } else if (event.equalsIgnoreCase("23")) {
        npc.getAI()
            .setIntention(
                CtrlIntention.AI_INTENTION_MOVE_TO, new Location(-56702, -56340, -2008, 32768));
        startQuestTimer("24", 2800, npc, null);
        addSpawn(SHOWSTUFF[0], -56672, -56406, -2000, 32768, false, 20900);
        addSpawn(SHOWSTUFF[1], -56648, -56368, -2000, 32768, false, 20900);
        addSpawn(SHOWSTUFF[2], -56608, -56338, -2000, 32768, false, 20900);
        addSpawn(SHOWSTUFF[3], -56652, -56307, -2000, 32768, false, 20900);
        addSpawn(SHOWSTUFF[4], -56672, -56272, -2000, 32768, false, 20900);
      } else if (event.equalsIgnoreCase("28")) {
        autoChat(npc, MESSAGES[23], ChatType.NPC_GENERAL);
        startQuestTimer("social1", 1, npc, null);
      } else if (event.equalsIgnoreCase("29")) {
        npc.getAI()
            .setIntention(
                CtrlIntention.AI_INTENTION_MOVE_TO, new Location(-56730, -56340, -2008, 32768));
        startQuestTimer("clean_npc", 4100, npc, null);
        startQuestTimer("timer_check", 60000, null, null, true);
      } else if (event.equalsIgnoreCase("social1")) {
        npc.broadcastSocialAction(1);
      } else if (event.equalsIgnoreCase("clean_npc")) {
        IS_STARTED = false;
        npc.deleteMe();
      } else {
        if (TALKS.containsKey(event)) {
          final ShoutInfo si = TALKS.get(event);
          if (si != null) {
            autoChat(npc, si.getNpcStringId(), ChatType.NPC_SHOUT);
            startQuestTimer(si.getNextEvent(), si.getTime(), npc, null);
          }
        } else if (WALKS.containsKey(event)) {
          final WalkInfo wi = WALKS.get(event);
          if (wi != null) {
            npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, wi.getCharPos());
            startQuestTimer(wi.getNextEvent(), wi.getTime(), npc, null);
          }
        }
      }
    }
    return null;
  }