Q00146_TheZeroHour.java 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. * Copyright (C) 2004-2015 L2J DataPack
  3. *
  4. * This file is part of L2J DataPack.
  5. *
  6. * L2J DataPack is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * L2J DataPack is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. package quests.Q00146_TheZeroHour;
  20. import quests.Q00109_InSearchOfTheNest.Q00109_InSearchOfTheNest;
  21. import com.l2jserver.gameserver.model.actor.L2Npc;
  22. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  23. import com.l2jserver.gameserver.model.quest.Quest;
  24. import com.l2jserver.gameserver.model.quest.QuestState;
  25. import com.l2jserver.gameserver.model.quest.State;
  26. /**
  27. * The Zero Hour (146)
  28. * @author Gnacik, malyelfik
  29. */
  30. public class Q00146_TheZeroHour extends Quest
  31. {
  32. // NPCs
  33. private static final int KAHMAN = 31554;
  34. private static final int QUEEN_SHYEED = 25671;
  35. // Item
  36. private static final int KAHMANS_SUPPLY_BOX = 14849;
  37. private static final int FANG = 14859;
  38. public Q00146_TheZeroHour()
  39. {
  40. super(146, Q00146_TheZeroHour.class.getSimpleName(), "The Zero Hour");
  41. addStartNpc(KAHMAN);
  42. addTalkId(KAHMAN);
  43. addKillId(QUEEN_SHYEED);
  44. registerQuestItems(FANG);
  45. }
  46. @Override
  47. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  48. {
  49. final QuestState st = getQuestState(player, false);
  50. if (st == null)
  51. {
  52. return getNoQuestMsg(player);
  53. }
  54. if (event.equalsIgnoreCase("31554-03.htm"))
  55. {
  56. st.startQuest();
  57. }
  58. return event;
  59. }
  60. @Override
  61. public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
  62. {
  63. final L2PcInstance partyMember = getRandomPartyMember(killer, 1);
  64. if (partyMember != null)
  65. {
  66. final QuestState st = getQuestState(partyMember, false);
  67. if (!st.hasQuestItems(FANG))
  68. {
  69. st.giveItems(FANG, 1);
  70. st.setCond(2, true);
  71. }
  72. }
  73. return super.onKill(npc, killer, isSummon);
  74. }
  75. @Override
  76. public String onTalk(L2Npc npc, L2PcInstance player)
  77. {
  78. String htmltext = getNoQuestMsg(player);
  79. final QuestState st = getQuestState(player, true);
  80. if (st == null)
  81. {
  82. return htmltext;
  83. }
  84. switch (st.getState())
  85. {
  86. case State.CREATED:
  87. if (player.getLevel() < 81)
  88. {
  89. htmltext = "31554-02.htm";
  90. }
  91. else
  92. {
  93. final QuestState prev = player.getQuestState(Q00109_InSearchOfTheNest.class.getSimpleName());
  94. if ((prev != null) && prev.isCompleted())
  95. {
  96. htmltext = "31554-01a.htm";
  97. }
  98. else
  99. {
  100. htmltext = "31554-04.html";
  101. }
  102. }
  103. break;
  104. case State.STARTED:
  105. if (st.isCond(1))
  106. {
  107. htmltext = "31554-06.html";
  108. }
  109. else
  110. {
  111. st.giveItems(KAHMANS_SUPPLY_BOX, 1);
  112. st.addExpAndSp(154616, 12500);
  113. st.exitQuest(false, true);
  114. htmltext = "31554-05.html";
  115. }
  116. break;
  117. case State.COMPLETED:
  118. htmltext = "31554-01b.htm";
  119. break;
  120. }
  121. return htmltext;
  122. }
  123. }