Q00423_TakeYourBestShot.java 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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.Q00423_TakeYourBestShot;
  20. import quests.Q00249_PoisonedPlainsOfTheLizardmen.Q00249_PoisonedPlainsOfTheLizardmen;
  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. * Take Your Best Shot (423)
  28. * @author Gnacik
  29. * @version 2010-06-26 Based on official server Franz
  30. */
  31. public class Q00423_TakeYourBestShot extends Quest
  32. {
  33. // NPCs
  34. private static final int BATRACOS = 32740;
  35. private static final int JOHNNY = 32744;
  36. // Monster
  37. private static final int TANTA_GUARD = 18862;
  38. // Item
  39. private static final int SEER_UGOROS_PASS = 15496;
  40. // Misc
  41. private static final int MIN_LEVEL = 82;
  42. public Q00423_TakeYourBestShot()
  43. {
  44. super(423, Q00423_TakeYourBestShot.class.getSimpleName(), "Take Your Best Shot!");
  45. addStartNpc(JOHNNY, BATRACOS);
  46. addTalkId(JOHNNY, BATRACOS);
  47. addFirstTalkId(BATRACOS);
  48. addKillId(TANTA_GUARD);
  49. }
  50. @Override
  51. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  52. {
  53. final QuestState st = getQuestState(player, false);
  54. if (st == null)
  55. {
  56. return null;
  57. }
  58. String htmltext = event;
  59. switch (event)
  60. {
  61. case "32740.html":
  62. case "32740-01.html":
  63. case "32744-02.html":
  64. case "32744-03.htm":
  65. break;
  66. case "32744-04.htm":
  67. st.startQuest();
  68. break;
  69. case "32744-quit.html":
  70. st.exitQuest(true);
  71. break;
  72. default:
  73. htmltext = null;
  74. break;
  75. }
  76. return htmltext;
  77. }
  78. @Override
  79. public String onFirstTalk(L2Npc npc, L2PcInstance player)
  80. {
  81. if (npc.isInsideRadius(96782, 85918, 0, 100, false, true))
  82. {
  83. return "32740-ugoros.html";
  84. }
  85. return "32740.html";
  86. }
  87. @Override
  88. public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
  89. {
  90. final QuestState st = getQuestState(killer, false);
  91. if ((st != null) && st.isCond(1))
  92. {
  93. st.setCond(2, true);
  94. }
  95. return super.onKill(npc, killer, isSummon);
  96. }
  97. @Override
  98. public String onTalk(L2Npc npc, L2PcInstance player)
  99. {
  100. final QuestState st = getQuestState(player, true);
  101. String htmltext = getNoQuestMsg(player);
  102. if (st == null)
  103. {
  104. return htmltext;
  105. }
  106. switch (npc.getId())
  107. {
  108. case JOHNNY:
  109. switch (st.getState())
  110. {
  111. case State.CREATED:
  112. final QuestState _prev = player.getQuestState(Q00249_PoisonedPlainsOfTheLizardmen.class.getSimpleName());
  113. if ((_prev != null) && _prev.isCompleted() && (player.getLevel() >= MIN_LEVEL))
  114. {
  115. htmltext = (st.hasQuestItems(SEER_UGOROS_PASS)) ? "32744-07.htm" : "32744-01.htm";
  116. }
  117. else
  118. {
  119. htmltext = "32744-00.htm";
  120. }
  121. break;
  122. case State.STARTED:
  123. if (st.isCond(1))
  124. {
  125. htmltext = "32744-05.html";
  126. }
  127. else if (st.isCond(2))
  128. {
  129. htmltext = "32744-06.html";
  130. }
  131. break;
  132. }
  133. break;
  134. case BATRACOS:
  135. switch (st.getState())
  136. {
  137. case State.CREATED:
  138. htmltext = (st.hasQuestItems(SEER_UGOROS_PASS)) ? "32740-05.html" : "32740-00.html";
  139. break;
  140. case State.STARTED:
  141. if (st.isCond(1))
  142. {
  143. htmltext = "32740-02.html";
  144. }
  145. else if (st.isCond(2))
  146. {
  147. st.giveItems(SEER_UGOROS_PASS, 1);
  148. st.exitQuest(true, true);
  149. htmltext = "32740-04.html";
  150. }
  151. break;
  152. }
  153. }
  154. return htmltext;
  155. }
  156. }