Exemple #1
0
  @Override
  public final String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) {
    final QuestState st = getQuestState(player, false);
    if (st == null) {
      return null;
    }

    for (int _gk[] : _gatekeepers) {
      if (npc.getId() == _gk[0]) {
        // Drop key
        npc.dropItem(player, _gk[1], 1);

        // Check if gatekeeper should open bridge, and open it
        if (_gk[2] > 0) {
          final InstanceWorld tmpworld =
              InstanceManager.getInstance().getWorld(player.getInstanceId());
          if (tmpworld instanceof NornilsWorld) {
            openDoor(_gk[2], tmpworld.getInstanceId());
          }
        }
      }
      if (npc.getId() == 18355) {
        spawn2(npc);
      }
    }
    return super.onKill(npc, player, isSummon);
  }
Exemple #2
0
  @Override
  public final String onTalk(L2Npc npc, L2PcInstance player) {
    if (Util.contains(_final_gates, npc.getId())) {
      return npc.getId() + "-01.html";
    }

    return null;
  }
Exemple #3
0
 @Override
 public final String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) {
   if ((npc.getId() == _herb_jar) && !npc.isDead()) {
     dropHerb(npc, attacker, HP_HERBS_DROPLIST);
     dropHerb(npc, attacker, MP_HERBS_DROPLIST);
     npc.doDie(attacker);
   } else if ((npc.getId() == 18362) && (npc.getInstanceId() > 0)) {
     spawn1(npc);
   }
   return null;
 }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    final QuestState st = getQuestState(player, true);
    String htmltext = getNoQuestMsg(player);
    if (st == null) {
      return htmltext;
    }

    switch (st.getState()) {
      case State.COMPLETED:
        {
          if (npc.getId() == NAMELESS_SPIRIT) {
            htmltext = "31453-06.html";
          }
          break;
        }
      case State.CREATED:
        {
          htmltext =
              ((player.getLevel() >= MIN_LEVEL) && st.hasQuestItems(ANTIQUE_BROOCH))
                  ? "31453-01.htm"
                  : "31453-05.html";
          break;
        }
      case State.STARTED:
        {
          if (npc.getId() == NAMELESS_SPIRIT) {
            if (st.isCond(1)) {
              if (st.hasQuestItems(ANTIQUE_BROOCH)) {
                htmltext = "31453-07.html";
              } else {
                htmltext = "31453-08.html";
                st.exitQuest(true);
              }
            } else if (st.isCond(2)) {
              htmltext = "31453-09.html";
            }
          } else if (npc.getId() == DEVORIN) {
            if (st.isCond(1)) {
              htmltext = "32009-01.html";
            } else if (st.isCond(2)) {
              htmltext = "32009-05.html";
            }
          }
          break;
        }
    }
    return htmltext;
  }
 @Override
 public String onTalk(L2Npc npc, L2PcInstance player) {
   final QuestState qs = getQuestState(player, true);
   String texthtml = null;
   switch (qs.getState()) {
     case State.CREATED:
       {
         texthtml = npc.getId() == ZENATH ? "33509-01.htm" : getNoQuestMsg(player);
         break;
       }
     case State.STARTED:
       {
         switch (npc.getId()) {
           case ZENATH:
             {
               if (qs.isCond(1)) {
                 texthtml = "33509-03.htm";
               } else if (qs.isCond(2)) // report defeated kanilov, get the sketch
               {
                 giveItems(player, SAKUMS_SKETCH_A, 1);
                 qs.setCond(3);
                 texthtml = "33509-05.html";
               } else {
                 texthtml = "33509-06.html";
               }
               break;
             }
           case ADV_GUILDSMAN:
             {
               if (qs.isCond(3)) // start end quest dialogs
               {
                 texthtml = "31795-01.html";
               } else {
                 texthtml = getNoQuestMsg(player);
               }
               break;
             }
         }
         break;
       }
     case State.COMPLETED:
       {
         texthtml =
             npc.getId() == ADV_GUILDSMAN ? "31795-04.html" : getAlreadyCompletedMsg(player);
         break;
       }
   }
   return texthtml;
 }
  @Override
  public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) {
    final QuestState qs = getQuestState(killer, false);

    if ((qs != null)
        && qs.isCond(1)
        && (getQuestItemsCount(killer, PECULIAR_MUSHROOM_SPORE) < 10)) {
      switch (npc.getId()) {
        case GROWLER:
        case ROBUST_GROWLER:
          {
            final int killCount = qs.getInt(KILL_VAR) + 1;
            if (killCount >= 3) {
              addAttackPlayerDesire(addSpawn(EVOLVED_GROWLER, npc.getLocation()), killer);
              qs.set(KILL_VAR, 0);
            } else {
              qs.set(KILL_VAR, killCount);
            }
            break;
          }
        case EVOLVED_GROWLER:
          {
            if (giveItemRandomly(killer, npc, PECULIAR_MUSHROOM_SPORE, 1, 10, 1.0, true)) {
              qs.setCond(2);
            }
            break;
          }
      }
    }
    return super.onKill(npc, killer, isSummon);
  }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    final QuestState qs = getQuestState(player, true);
    String htmltext = getNoQuestMsg(player);

    if (qs.isCompleted()) {
      htmltext = getAlreadyCompletedMsg(player);
    }

    switch (npc.getId()) {
      case LEIRA:
        {
          if (qs.isCreated()) {
            htmltext = "33952-01.htm";
          } else if (qs.isStarted()) {
            htmltext = "33952-03.html";
          }
          break;
        }
      case MILONE:
        {
          if (qs.isCond(2)) {
            htmltext = "33953-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 "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) {
    String htmltext = getNoQuestMsg(player);
    final QuestState st = getQuestState(player, true);
    if (st == null) {
      return htmltext;
    }

    switch (npc.getId()) {
      case ANTON:
        switch (st.getState()) {
          case State.CREATED:
            htmltext = (player.getLevel() < 75) ? "31338-0a.htm" : "31338-0b.htm";
            break;
          case State.STARTED:
            htmltext = "31338-1a.html";
            break;
          case State.COMPLETED:
            htmltext = getAlreadyCompletedMsg(player);
            break;
        }
        break;
      case MARQUEZ:
        if (st.isCond(1)) {
          htmltext = "32113-1.html";
        }
        break;
    }
    return htmltext;
  }
Exemple #10
0
 @Override
 public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) {
   switch (npc.getId()) {
     case LIZARDMAN_SUB_LEADER:
     case LIZARDMAN_SENTINEL:
       {
         final QuestState qs = getRandomPartyMemberState(killer, 1, 3, npc);
         if ((qs != null)
             && giveItemRandomly(
                 qs.getPlayer(), npc, FEATHER.getId(), 1, FEATHER.getCount(), 1.0, true)) {
           qs.setCond(2);
         }
         break;
       }
     case LIZARDMAN_LEADER:
     case LIZARDMAN_SHAMAN:
       {
         final QuestState qs = getRandomPartyMemberState(killer, 6, 3, npc);
         if ((qs != null)
             && giveItemRandomly(
                 qs.getPlayer(),
                 npc,
                 TOTEM_TOOTH_2ND.getId(),
                 1,
                 TOTEM_TOOTH_2ND.getCount(),
                 0.5,
                 true)) {
           qs.setCond(7);
         }
         break;
       }
   }
   return super.onKill(npc, killer, isSummon);
 }
  @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;
  }
Exemple #12
0
 @Override
 public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) {
   final ItemChanceHolder holder = MONSTERS.get(npc.getId());
   if (getRandom(10000) <= holder.getChance()) {
     npc.dropItem(killer, holder);
   }
   return super.onKill(npc, killer, isSummon);
 }
 @Override
 public String onTalk(L2Npc npc, L2PcInstance player) {
   final QuestState st = getQuestState(player, true);
   final QuestState st2 = player.getQuestState(Q00115_TheOtherSideOfTruth.class.getSimpleName());
   String htmltext = getNoQuestMsg(player);
   switch (npc.getId()) {
     case RAFFORTY:
       {
         if (st.isCreated()) {
           if (player.getLevel() < MIN_LVL) {
             htmltext = "32020-01.htm";
           } else {
             htmltext = ((st2 != null) && (st2.isCompleted())) ? "32020-02.htm" : "32020-03.htm";
           }
         } else if (st.isStarted()) {
           final long hasQuestItems =
               getQuestItemsCount(player, SILVER_ICE_CRYSTAL, BLACK_ICE_CRYSTAL);
           if ((st2 != null) && st2.isCompleted()) {
             htmltext = (hasQuestItems > 0) ? "32020-13.html" : "32020-11.html";
             if (st.isCond(1)) {
               st.setCond(2, true);
             }
           } else {
             htmltext = (hasQuestItems > 0) ? "32020-12.html" : "32020-10.html";
           }
         }
         break;
       }
     case ICE_SHELF:
       {
         // TODO: In High Five this quest have an updated reward system.
         if (st.isStarted()) {
           if (hasQuestItems(player, SILVER_ICE_CRYSTAL)) {
             final int val = st.getInt("ex") % 10;
             if (val == 0) {
               htmltext = "32023-03.html";
               st.set("ex", 0);
             } else {
               htmltext = "32023-09.html";
             }
           } else {
             htmltext = "32023-02.html";
           }
         } else {
           htmltext = "32023-01.html";
         }
         break;
       }
   }
   return htmltext;
 }
Exemple #14
0
 @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 onTalk(L2Npc npc, L2PcInstance player) {
    final QuestState qs = getQuestState(player, true);
    String htmltext = null;

    switch (qs.getState()) {
      case State.CREATED:
        {
          htmltext = npc.getId() == THEODORE ? "32975-01.htm" : "32974-04.html";
          break;
        }
      case State.STARTED:
        {
          htmltext = npc.getId() == THEODORE ? "32975-04.html" : "32974-01.html";
          break;
        }
      case State.COMPLETED:
        {
          htmltext = npc.getId() == THEODORE ? "32975-05.html" : "32974-03.html";
          break;
        }
    }
    return htmltext;
  }
Exemple #16
0
  @Override
  public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    String htmltext = event;
    final QuestState st = getQuestState(player, false);
    if (st == null) {
      return getNoQuestMsg(player);
    }

    if ((npc.getId() == _garden_guard) && event.equalsIgnoreCase("enter_instance")) {
      try {
        htmltext = enterInstance(npc, player);
      } catch (Exception e) {
      }
    } else if ((npc.getId() == 32258) && event.equalsIgnoreCase("exit")) {
      try {
        exitInstance(player);
      } catch (Exception e) {
      }
    } else if (Util.contains(_final_gates, npc.getId())) {
      if (event.equalsIgnoreCase("32260-02.html")
          || event.equalsIgnoreCase("32261-02.html")
          || event.equalsIgnoreCase("32262-02.html")) {
        st.unset("correct");
      } else if (Util.isDigit(event)) {
        int correct = st.getInt("correct");
        correct++;
        st.set("correct", String.valueOf(correct));
        htmltext = npc.getId() + "-0" + String.valueOf(correct + 2) + ".html";
      } else if (event.equalsIgnoreCase("check")) {
        final int correct = st.getInt("correct");
        if ((npc.getId() == 32260) && (correct == 3)) {
          openDoor(st, player, 16200014);
        } else if ((npc.getId() == 32261) && (correct == 3)) {
          openDoor(st, player, 16200015);
        } else if ((npc.getId() == 32262) && (correct == 4)) {
          openDoor(st, player, 16200016);
        } else {
          return npc.getId() + "-00.html";
        }
      }
    }
    return htmltext;
  }
  @Override
  public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) {
    final QuestState st = getRandomPartyMemberState(killer, -1, 3, npc);
    if (st != null) {
      final DropInfo info = MONSTERS.get(npc.getId());
      if (st.getCond() >= 1) {
        giveItemRandomly(
            st.getPlayer(), npc, SILVER_ICE_CRYSTAL, 1, 0, info.getFirstChance(), true);
      }

      if (info.getSecondChance() > 0) {
        final QuestState st2 =
            st.getPlayer().getQuestState(Q00115_TheOtherSideOfTruth.class.getSimpleName());
        if ((st.getCond() >= 2) && (st2 != null) && st2.isCompleted()) {
          giveItemRandomly(
              st.getPlayer(), npc, SILVER_HEMOCYTE, 1, 0, info.getSecondChance(), true);
        }
      }
    }
    return super.onKill(npc, killer, isSummon);
  }
 @Override
 public String onSpawn(L2Npc npc) {
   switch (npc.getId()) {
     case WITCH_ATHREA:
       {
         if (npc.isScriptValue(50301)) {
           startQuestTimer("DESPAWN_WITCH_ATHREA", 5000, npc, null);
           npc.broadcastPacket(new NpcSay(npc, ChatType.NPC_GENERAL, NpcStringId.WAR_AND_DEATH));
         }
         break;
       }
     case WITCH_KALIS:
       {
         if (npc.isScriptValue(50302)) {
           startQuestTimer("DESPAWN_WITCH_KALIS", 5000, npc, null);
           npc.broadcastPacket(
               new NpcSay(npc, ChatType.NPC_GENERAL, NpcStringId.AMBITION_AND_POWER));
         }
         break;
       }
     case IMPERIAL_COFFER:
       {
         startQuestTimer("DESPAWN_IMPERIAL_COFFER", 180000, npc, null);
         npc.broadcastPacket(
             new NpcSay(
                 npc,
                 ChatType.NPC_GENERAL,
                 NpcStringId
                     .CURSE_OF_THE_GODS_ON_THE_ONE_THAT_DEFILES_THE_PROPERTY_OF_THE_EMPIRE));
         break;
       }
     case BLITZ_WYRM:
       {
         startQuestTimer("DESPAWN_BLITZ_WYRM", 180000, npc, null);
         break;
       }
   }
   return super.onSpawn(npc);
 }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance player) {
    String htmltext = getNoQuestMsg(player);
    final QuestState st = getQuestState(player, true);
    if (st == null) {
      return htmltext;
    }

    switch (npc.getId()) {
      case NATOOLS:
        switch (st.getState()) {
          case State.STARTED:
            switch (st.getCond()) {
              case 1:
                htmltext = "30894-01.html";
                break;
              default:
                htmltext = "30894-04.html";
                break;
            }
            break;
          case State.COMPLETED:
            htmltext = getAlreadyCompletedMsg(player);
            break;
        }
        break;
      case TOBIAS:
        if (st.isStarted()) {
          switch (st.getCond()) {
            case 1:
              htmltext = "30297-01.html";
              break;
            case 2:
              htmltext = (st.isSet("talk")) ? "30297-04.html" : "30297-02.html";
              break;
            case 3:
            case 4:
              htmltext = "30297-06.html";
              break;
            case 5:
              st.giveAdena(89046, true);
              if (player.getLevel() <= MAX_REWARD_LEVEL) {
                st.addExpAndSp(223036, 13901);
              }
              st.exitQuest(false, true);
              htmltext = "30297-07.html";
              break;
          }
        }
        break;
      case CASIAN:
        if (st.isStarted()) {
          switch (st.getCond()) {
            case 1:
            case 2:
              htmltext = "30612-01.html";
              break;
            case 3:
              htmltext = (st.isSet("talk")) ? "30612-04.html" : "30612-02.html";
              break;
            default:
              htmltext = "30612-10.html";
              break;
          }
        }
        break;
      case ROCK:
        if (st.isStarted()) {
          switch (st.getCond()) {
            case 1:
            case 2:
            case 3:
              htmltext = "32368-01.html";
              break;
            case 4:
              htmltext = "32368-02.html";
              break;
            case 5:
              htmltext = "32368-05.html";
              break;
          }
        }
        break;
      case ANGEL:
        if (st.isStarted()) {
          switch (st.getCond()) {
            case 1:
            case 2:
            case 3:
              htmltext = "32369-01.html";
              break;
            case 4:
              if (st.getInt("talk") == 1) {
                htmltext = "32369-04.html";
              } else if (st.getInt("talk") == 2) {
                htmltext = "32369-07.html";
              } else {
                htmltext = "32369-02.html";
              }
              break;
          }
        }
        break;
    }
    return htmltext;
  }
 @Override
 public String onTalk(L2Npc npc, L2PcInstance player) {
   String htmltext = getNoQuestMsg(player);
   final QuestState st = getQuestState(player, true);
   if (st == null) {
     return htmltext;
   }
   switch (npc.getId()) {
     case SYLVAIN:
       switch (st.getCond()) {
         case 1:
           htmltext = "30070-02.htm";
           break;
         case 2:
         case 3:
         case 4:
         case 5:
         case 6:
           htmltext = "30070-03.html";
           break;
         case 7:
           htmltext = "30070-04.html";
           break;
         default:
           if (st.isCompleted()) {
             return getAlreadyCompletedMsg(player);
           }
           final QuestState qs =
               player.getQuestState(Q00137_TempleChampionPart1.class.getSimpleName());
           htmltext =
               (player.getLevel() >= 36)
                   ? ((qs != null) && qs.isCompleted()) ? "30070-01.htm" : "30070-00a.htm"
                   : "30070-00.htm";
           break;
       }
       break;
     case PUPINA:
       switch (st.getCond()) {
         case 2:
           htmltext = "30118-01.html";
           break;
         case 3:
         case 4:
           htmltext = "30118-07.html";
           break;
         case 5:
           htmltext = "30118-08.html";
           if (st.hasQuestItems(ANGUS_RECOMMENDATION)) {
             st.takeItems(ANGUS_RECOMMENDATION, -1);
           }
           break;
         case 6:
           htmltext = "30118-10.html";
           break;
       }
       break;
     case ANGUS:
       switch (st.getCond()) {
         case 3:
           htmltext = "30474-01.html";
           break;
         case 4:
           if (st.getQuestItemsCount(RELICS_OF_THE_DARK_ELF_TRAINEE) >= 10) {
             st.takeItems(RELICS_OF_THE_DARK_ELF_TRAINEE, -1);
             st.giveItems(ANGUS_RECOMMENDATION, 1);
             st.setCond(5, true);
             htmltext = "30474-04.html";
           } else {
             htmltext = "30474-03.html";
           }
           break;
         case 5:
           htmltext = "30474-05.html";
           break;
       }
       break;
     case SLA:
       switch (st.getCond()) {
         case 6:
           switch (st.getInt("talk")) {
             case 1:
               htmltext = "30666-02.html";
               break;
             case 2:
               htmltext = "30666-03.html";
               break;
             default:
               htmltext = "30666-01.html";
               break;
           }
           break;
         case 7:
           htmltext = "30666-09.html";
           break;
       }
       break;
   }
   return htmltext;
 }
Exemple #21
0
 @Override
 public String onTalk(L2Npc npc, L2PcInstance talker) {
   final QuestState qs = getQuestState(talker, true);
   String htmltext = getNoQuestMsg(talker);
   switch (npc.getId()) {
     case IRIS:
       {
         switch (qs.getCond()) {
           case 3:
             {
               htmltext = "30034-01.html";
               break;
             }
           case 4:
             {
               htmltext = "30034-04.html";
               break;
             }
           case 5:
             {
               htmltext = "30034-05.html";
               break;
             }
           case 6:
             {
               htmltext = "30034-09.html";
               break;
             }
           case 7:
             {
               if (hasItem(talker, TOTEM_TOOTH_2ND)) {
                 htmltext = "30034-08.html";
               }
               break;
             }
         }
         break;
       }
     case MAGISTER_ROHMER:
       {
         if (qs.isCond(4)) {
           htmltext = "30344-01.html";
         } else if (qs.isCond(5)) {
           htmltext = "30344-04.html";
         }
         break;
       }
     case GUARD_LUIS:
       {
         if (qs.isCreated()) {
           htmltext = (talker.getLevel() >= MIN_LVL) ? "30386-01.htm" : "30386-02.htm";
         } else if (qs.isStarted()) {
           switch (qs.getCond()) {
             case 1:
               {
                 htmltext = "30386-05.html";
                 break;
               }
             case 2:
               {
                 if (hasItem(talker, FEATHER)) {
                   htmltext = "30386-04.html";
                 }
                 break;
               }
             case 3:
               {
                 htmltext = "30386-08.html";
                 break;
               }
           }
         } else if (qs.isCompleted()) {
           htmltext = getAlreadyCompletedMsg(talker);
         }
         break;
       }
   }
   return htmltext;
 }
  @Override
  public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon) {
    final QuestState qs = getQuestState(attacker, false);
    if ((qs != null) && qs.isCond(2)) {
      if (isSummon) {
        final NpcData data = NPC_DATA.get(npc.getId());
        if ((qs.getMemoState() % data.memoStateMod) < data.memoStateValue) {
          final L2Summon pet = attacker.getPet();
          if ((pet != null) && (pet.getControlObjectId() == qs.getInt("fluteObjectId"))) {
            final int hits = qs.getInt("hits") + 1;
            qs.set("hits", hits);

            if (hits < data.minHits) {
              if ((npc.getId() == TREE_OF_ABYSS) && (getRandom(100) < 2)) {
                npc.setTarget(attacker);
                npc.doCast(DRYAD_ROOT.getSkill());
              }
            } else if (getRandom(100) < 2) {
              if (hasQuestItems(attacker, FAIRY_LEAF)) {
                npc.broadcastPacket(
                    new NpcSay(npc, ChatType.NPC_GENERAL, NpcStringId.GIVE_ME_A_FAIRY_LEAF));
                takeItems(attacker, FAIRY_LEAF, 1);
                qs.setMemoState(qs.getMemoState() + data.memoStateValue);
                qs.unset("hits");
                playSound(attacker, QuestSound.ITEMSOUND_QUEST_MIDDLE);

                if (qs.getMemoState() == 15) {
                  qs.setCond(3);
                }
              }
            }
          }
        } else {
          switch (getRandom(3)) {
            case 0:
              npc.broadcastPacket(
                  new NpcSay(npc, ChatType.NPC_GENERAL, NpcStringId.WHY_DO_YOU_BOTHER_ME_AGAIN));
              break;
            case 1:
              npc.broadcastPacket(new NpcSay(npc, ChatType.NPC_GENERAL, data.message));
              break;
            case 2:
              npc.broadcastPacket(
                  new NpcSay(
                      npc,
                      ChatType.NPC_GENERAL,
                      NpcStringId.LEAVE_NOW_BEFORE_YOU_INCUR_THE_WRATH_OF_THE_GUARDIAN_GHOST));
              break;
          }
        }
      } else if (getRandom(100) < 30) {
        npc.setTarget(attacker);
        npc.doCast(VICIOUS_POISON.getSkill());
      }
    } else if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.67)) && (getRandom(100) < 30)) {
      npc.setTarget(attacker);
      npc.doCast(VICIOUS_POISON.getSkill());
    }

    return super.onAttack(npc, attacker, damage, isSummon);
  }
  @Override
  public String onTalk(L2Npc npc, L2PcInstance talker) {
    final QuestState qs = getQuestState(talker, true);
    String htmltext = getNoQuestMsg(talker);

    switch (npc.getId()) {
      case CRONOS:
        {
          switch (qs.getState()) {
            case State.CREATED:
              {
                final long fluteCount =
                    getQuestItemsCount(
                        talker, DRAGONFLUTE_OF_WIND, DRAGONFLUTE_OF_STAR, DRAGONFLUTE_OF_TWILIGHT);
                if (fluteCount == 0) {
                  break; // this quest does not show up if no flute in inventory
                }

                if (talker.getLevel() < MIN_PLAYER_LVL) {
                  htmltext = "30610-01.htm";
                } else if (fluteCount > 1) {
                  htmltext = "30610-02.htm";
                } else if (getFlute(talker).getEnchantLevel() < MIN_HACHLING_LVL) {
                  htmltext = "30610-03.html";
                } else {
                  htmltext = "30610-04.htm";
                }
                break;
              }
            case State.STARTED:
              {
                htmltext = "30610-07.html";
                break;
              }
            case State.COMPLETED:
              {
                htmltext = getAlreadyCompletedMsg(talker);
                break;
              }
          }
          break;
        }
      case MIMYU:
        {
          switch (qs.getMemoState()) {
            case 100:
              {
                qs.setMemoState(200);
                htmltext = "30747-01.html";
                break;
              }
            case 200:
              {
                final L2Summon summon = talker.getPet();

                if (summon == null) {
                  htmltext = "30747-02.html";
                } else if (summon.getControlObjectId() != qs.getInt("fluteObjectId")) {
                  htmltext = "30747-03.html";
                } else {
                  htmltext = "30747-04.html";
                }
                break;
              }
            case 0:
              {
                htmltext = "30747-07.html";
                break;
              }
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
            case 8:
            case 9:
            case 10:
            case 11:
            case 12:
            case 13:
            case 14:
              {
                if (hasQuestItems(talker, FAIRY_LEAF)) {
                  htmltext = "30747-11.html";
                }
                break;
              }
            case 15:
              {
                if (!hasQuestItems(talker, FAIRY_LEAF)) {
                  final L2Summon summon = talker.getPet();

                  if (summon == null) {
                    htmltext = "30747-12.html";
                  } else if (summon.getControlObjectId() == qs.getInt("fluteObjectId")) {
                    qs.setMemoState(16);
                    htmltext = "30747-13.html";
                  } else {
                    htmltext = "30747-14.html";
                  }
                }
                break;
              }
            case 16:
              {
                if (!hasQuestItems(talker, FAIRY_LEAF)) {
                  if (talker.hasSummon()) {
                    htmltext = "30747-15.html";
                  } else {
                    final long fluteCount =
                        getQuestItemsCount(
                            talker,
                            DRAGONFLUTE_OF_WIND,
                            DRAGONFLUTE_OF_STAR,
                            DRAGONFLUTE_OF_TWILIGHT);

                    if (fluteCount > 1) {
                      htmltext = "30747-17.html";
                    } else if (fluteCount == 1) {
                      final L2ItemInstance flute = getFlute(talker);

                      if (flute.getObjectId() == qs.getInt("fluteObjectId")) {
                        // TODO what if the hatchling has items in his inventory?
                        // Should they be transfered to the strider or given to the player?
                        switch (flute.getId()) {
                          case DRAGONFLUTE_OF_WIND:
                            takeItems(talker, DRAGONFLUTE_OF_WIND, -1);
                            giveItems(talker, DRAGON_BUGLE_OF_WIND, 1);
                            break;
                          case DRAGONFLUTE_OF_STAR:
                            takeItems(talker, DRAGONFLUTE_OF_STAR, -1);
                            giveItems(talker, DRAGON_BUGLE_OF_STAR, 1);
                            break;
                          case DRAGONFLUTE_OF_TWILIGHT:
                            takeItems(talker, DRAGONFLUTE_OF_TWILIGHT, -1);
                            giveItems(talker, DRAGON_BUGLE_OF_TWILIGHT, 1);
                            break;
                        }

                        qs.exitQuest(true, true);
                        htmltext = "30747-16.html";
                      } else {
                        npc.setTarget(talker);
                        npc.doCast(CURSE_OF_MIMYU.getSkill());
                        htmltext = "30747-18.html";
                      }
                    }
                  }
                }
                break;
              }
          }
          break;
        }
    }
    return htmltext;
  }
  @Override
  public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) {
    final QuestState qs = getQuestState(killer, false);
    if ((qs == null) || !qs.isStarted() || !Util.checkIfInRange(1500, npc, killer, true)) {
      return super.onKill(npc, killer, isSummon);
    }

    final L2Clan clan = killer.getClan();
    if (clan == null) {
      return super.onKill(npc, killer, isSummon);
    }

    final L2PcInstance leader = clan.getLeader().getPlayerInstance();
    if ((leader == null) || !Util.checkIfInRange(1500, npc, leader, true)) {
      return super.onKill(npc, killer, isSummon);
    }

    final QuestState leaderQS = getQuestState(leader, false);
    if (leaderQS == null) {
      return super.onKill(npc, killer, isSummon);
    }

    switch (npc.getId()) {
      case DRAKE:
      case DRAKE2:
        {
          if ((leaderQS.getMemoState() >= 2000) || (leaderQS.getMemoState() < 3000)) {
            giveItemRandomly(leader, MIST_DRAKES_EGG, 1, 10, 0.1, true);

            giveItemRandomly(leader, DRAKES_EGG, 1, 10, 0.5, true);
          }
          break;
        }
      case THUNDER_WYRM:
      case THUNDER_WYRM2:
        {
          if ((leaderQS.getMemoState() >= 2000) || (leaderQS.getMemoState() < 3000)) {
            giveItemRandomly(leader, THUNDER_WYRM_EGG, 1, 10, 0.5, true);
          }
          break;
        }
      case GRAVE_GUARD:
        {
          if ((leaderQS.getMemoState() < 8511) || (leaderQS.getMemoState() >= 8500)) {
            leaderQS.setMemoState(leaderQS.getMemoState() + 1);

            if ((leaderQS.getMemoState() >= 8505) && (getRandom(100) < 50)) {
              leaderQS.setMemoState(8500);
              addSpawn(GRAVE_KEYMASTER, npc, true, 0, false);
            } else if (leaderQS.getMemoState() >= 8510) {
              leaderQS.setMemoState(8500);
              addSpawn(GRAVE_KEYMASTER, npc, true, 0, false);
            }
          }
          break;
        }
      case SPITEFUL_SOUL_LEADER:
        {
          if (leaderQS.getMemoState() == 5000) {
            final int rand = getRandom(100);
            if (rand < 10) {
              giveItemRandomly(leader, SPITEFUL_SOUL_ENERGY, 1, 10, 1, false);
            } else if (rand < 60) {
              giveItems(leader, SPITEFUL_SOUL_VENGEANCE, 1);
            }
          }
          break;
        }
      case BLITZ_WYRM:
        {
          if ((leaderQS.getMemoState() >= 2000) || (leaderQS.getMemoState() < 3000)) {
            giveItemRandomly(leader, BLITZ_WYRM_EGG, 1, 10, 1, true);
          }
          break;
        }
      case GRAVE_KEYMASTER:
        {
          if (leaderQS.getMemoState() >= 8500) {
            giveItemRandomly(leader, IMPERIAL_KEY, 1, 6, 1, true);
          }
          break;
        }
      case IMPERIAL_GRAVEKEEPER:
        {
          if ((leaderQS.getMemoState() < 8511) || (leaderQS.getMemoState() >= 8500)) {
            addSpawn(IMPERIAL_COFFER, npc, true, 0, false);
          }
          break;
        }
    }
    return super.onKill(npc, killer, isSummon);
  }
 @Override
 public String onTalk(L2Npc npc, L2PcInstance player) {
   final QuestState qs = getQuestState(player, true);
   final QuestState lqs = getLeaderQuestState(player, getName());
   String htmltext = getNoQuestMsg(player);
   if (qs.isCreated() || qs.isCompleted()) {
     if (npc.getId() == SIR_GUSTAV_ATHEBALDT) {
       if (lqs != null) {
         if (player.isClanLeader()) {
           final L2Clan clan = player.getClan();
           if (clan != null) {
             if (clan.getLevel() < 4) {
               htmltext = "30760-01.html";
             } else if (clan.getLevel() >= 5) {
               htmltext = "30760-02.html";
             } else if ((clan.getLevel() == 4) && hasQuestItems(player, SEAL_OF_ASPIRATION)) {
               htmltext = "30760-03.html";
             } else if ((clan.getLevel() == 4) && !hasQuestItems(player, SEAL_OF_ASPIRATION)) {
               htmltext = "30760-04.html";
             }
           }
         } else {
           htmltext = "30760-04t.html";
         }
       }
     }
   } else if (qs.isStarted()) {
     switch (npc.getId()) {
       case SIR_GUSTAV_ATHEBALDT:
         {
           if (lqs != null) {
             if (qs.getMemoState() == 1000) {
               htmltext = "30760-09.html";
             } else if (qs.getMemoState() == 2000) {
               htmltext = "30760-10.html";
             } else if (qs.getMemoState() == 3000) {
               if (!player.isClanLeader()) {
                 htmltext = "30760-11t.html";
               } else {
                 htmltext = "30760-11.html";
               }
             } else if (qs.getMemoState() == 4000) {
               htmltext = "30760-13.html";
             } else if (qs.getMemoState() == 5000) {
               htmltext = "30760-14.html";
             } else if (qs.getMemoState() == 6000) {
               if (!player.isClanLeader()) {
                 htmltext = "30760-15t.html";
               } else {
                 htmltext = "30760-15.html";
               }
             } else if (qs.getMemoState() == 7000) {
               htmltext = "30760-17.html";
             } else if ((qs.getMemoState() >= 8000) && (qs.getMemoState() < 8700)) {
               htmltext = "30760-18.html";
             } else if ((qs.getMemoState() >= 8700)
                 && (qs.getMemoState() < 10000)
                 && player.isClanLeader()) {
               htmltext = "30760-19.html";
             } else if ((qs.getMemoState() == 9000) && !player.isClanLeader()) {
               htmltext = "30760-19t.html";
             } else if (qs.getMemoState() == 10000) {
               if (!player.isClanLeader()) {
                 htmltext = "30760-24t.html";
               } else {
                 htmltext = "30760-24.html";
               }
             }
           }
           break;
         }
       case HEAD_BLACKSMITH_KUSTO:
         {
           if ((lqs != null) && !player.isClanLeader()) {
             htmltext = "30512-01a.html";
           } else if (!hasAtLeastOneQuestItem(player, BROOCH_OF_THE_MAGPIE, BLACK_ANVIL_COIN)) {
             htmltext = "30512-01.html";
           } else if (hasQuestItems(player, BROOCH_OF_THE_MAGPIE)) {
             htmltext = "30512-02.html";
           } else if ((lqs != null)
               && hasQuestItems(player, BLACK_ANVIL_COIN)
               && !hasQuestItems(player, BROOCH_OF_THE_MAGPIE)) {
             htmltext = "30512-04.html";
           }
           break;
         }
       case MARTIEN:
         {
           if (lqs != null) {
             if ((qs.getMemoState() == 1000)) {
               if (!player.isClanLeader()) {
                 htmltext = "30645-01.html";
               } else {
                 htmltext = "30645-02.html";
               }
             } else if ((qs.getMemoState() < 3000) && (qs.getMemoState() >= 2000)) {
               if ((getQuestItemsCount(player, MIST_DRAKES_EGG) < 10)
                   || (getQuestItemsCount(player, BLITZ_WYRM_EGG) < 10)
                   || (getQuestItemsCount(player, THUNDER_WYRM_EGG) < 10)
                   || (getQuestItemsCount(player, DRAKES_EGG) < 10)) {
                 htmltext = "30645-04.html";
               } else {
                 takeItems(player, MIST_DRAKES_EGG, -1);
                 takeItems(player, BLITZ_WYRM_EGG, -1);
                 takeItems(player, DRAKES_EGG, -1);
                 takeItems(player, THUNDER_WYRM_EGG, -1);
                 qs.setMemoState(3000);
                 qs.setCond(3, true);
                 htmltext = "30645-05.html";
               }
             } else if ((qs.getMemoState() == 3000)) {
               htmltext = "30645-07.html";
             } else if ((qs.getMemoState() > 3000)) {
               htmltext = "30645-08.html";
             }
           }
           break;
         }
       case WITCH_ATHREA:
         {
           if (lqs != null) {
             htmltext = "30758-01.html";
           }
           break;
         }
       case WITCH_KALIS:
         {
           if (lqs != null) {
             htmltext = "30759-01.html";
           }
           break;
         }
       case CORPSE_OF_FRITZ:
         {
           if ((qs.getMemoState() < 3000) && (qs.getMemoState() >= 2000)) {
             htmltext = "30761-01.html";
           }
           break;
         }
       case CORPSE_OF_LUTZ:
         {
           if ((qs.getMemoState() < 3000) && (qs.getMemoState() >= 2000)) {
             htmltext = "30762-01.html";
           }
           break;
         }
       case CORPSE_OF_KURTZ:
         {
           if (((qs.getMemoState() < 3000) && (qs.getMemoState() == 2000))
               || (qs.getMemoState() == 2110)
               || (qs.getMemoState() == 2010)
               || (qs.getMemoState() == 2100)) {
             htmltext = "30763-01.html";
           } else if ((qs.getMemoState() == 2001)
               || (qs.getMemoState() == 2111)
               || (qs.getMemoState() == 2011)
               || (qs.getMemoState() == 2101)) {
             htmltext = "30763-03.html";
           }
           break;
         }
       case BALTHAZAR:
         {
           if (lqs != null) {
             if ((qs.getMemoState() == 4000)) {
               if (!player.isClanLeader()) {
                 htmltext = "30764-01.html";
               } else if (!hasQuestItems(player, BLACK_ANVIL_COIN) && player.isClanLeader()) {
                 htmltext = "30764-02.html";
               } else if (hasQuestItems(player, BLACK_ANVIL_COIN)) {
                 htmltext = "30764-04.html";
               }
             } else if ((qs.getMemoState() == 5000)) {
               if (getQuestItemsCount(player, SPITEFUL_SOUL_ENERGY) < 10) {
                 htmltext = "30764-07a.html";
               } else {
                 takeItems(player, SPITEFUL_SOUL_ENERGY, -1);
                 qs.setMemoState(6000);
                 qs.setCond(6, true);
                 htmltext = "30764-08a.html";
               }
             } else if ((qs.getMemoState() >= 6000)) {
               htmltext = "30764-09.html";
             }
           }
           break;
         }
       case IMPERIAL_COFFER:
         {
           if (lqs != null) {
             if ((qs.getMemoState() >= 8500) && (qs.getMemoState() < 8700)) {
               if (getQuestItemsCount(player, IMPERIAL_KEY) >= 6) {
                 if (!player.isClanLeader()) {
                   htmltext = "30765-01.html";
                 } else {
                   htmltext = "30765-03.html";
                 }
               }
             } else if (qs.getMemoState() >= 8700) {
               htmltext = "30765-05.html";
             }
           }
           break;
         }
       case WITCH_CLEO:
         {
           if (lqs != null) {
             if (!player.isClanLeader()) {
               htmltext = "30766-01.html";
             } else if (qs.getMemoState() == 8000) {
               htmltext = "30766-02.html";
             } else if (qs.getMemoState() == 8100) {
               htmltext = "30766-05.html";
             } else if ((qs.getMemoState() > 8100) && (qs.getMemoState() < 10000)) {
               htmltext = "30766-06.html";
             } else if ((qs.getMemoState() == 10000) && player.isClanLeader()) {
               htmltext = "30766-07.html";
             }
           }
           break;
         }
       case SIR_ERIC_RODEMAI:
         {
           if (lqs != null) {
             if (qs.getMemoState() == 7000) {
               if (!player.isClanLeader()) {
                 htmltext = "30868-01.html";
               } else {
                 htmltext = "30868-02.html";
               }
             } else if (qs.getMemoState() == 8000) {
               htmltext = "30868-05.html";
             } else if (qs.getMemoState() == 8100) {
               if (player.isClanLeader()) {
                 qs.setMemoState(8500);
                 qs.setCond(10, true);
                 htmltext = "30868-06.html";
               } else {
                 htmltext = "30868-07.html";
               }
             } else if ((qs.getMemoState() < 8511) && (qs.getMemoState() >= 8500)) {
               htmltext = "30868-08.html";
             } else if (qs.getMemoState() == 8700) {
               htmltext = "30868-09.html";
             } else if (qs.getMemoState() >= 9000) {
               htmltext = "30868-11.html";
             }
             break;
           }
         }
     }
   }
   return htmltext;
 }
  @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;
  }
Exemple #27
0
 @Override
 public final String onFirstTalk(L2Npc npc, L2PcInstance player) {
   getQuestState(player, true);
   return npc.getId() + ".html";
 }
Exemple #28
0
  @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;
  }
Exemple #29
0
 private void autoChat(L2Npc npc, NpcStringId npcString, ChatType type) {
   npc.broadcastPacket(new NpcSay(npc.getObjectId(), type, npc.getId(), npcString));
 }