Q00641_AttackSailren.java 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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.Q00641_AttackSailren;
  20. import quests.Q00126_TheNameOfEvil2.Q00126_TheNameOfEvil2;
  21. import com.l2jserver.gameserver.enums.QuestSound;
  22. import com.l2jserver.gameserver.model.actor.L2Npc;
  23. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  24. import com.l2jserver.gameserver.model.quest.Quest;
  25. import com.l2jserver.gameserver.model.quest.QuestState;
  26. import com.l2jserver.gameserver.model.quest.State;
  27. /**
  28. * Attack Sailren! (641)
  29. * @author Adry_85
  30. */
  31. public class Q00641_AttackSailren extends Quest
  32. {
  33. // NPC
  34. private static final int SHILENS_STONE_STATUE = 32109;
  35. // Items
  36. public static final int GAZKH_FRAGMENT = 8782;
  37. public static final int GAZKH = 8784;
  38. public static int[] MOBS =
  39. {
  40. 22196, // Velociraptor
  41. 22197, // Velociraptor
  42. 22198, // Velociraptor
  43. 22218, // Velociraptor
  44. 22223, // Velociraptor
  45. 22199, // Pterosaur
  46. };
  47. public Q00641_AttackSailren()
  48. {
  49. super(641, Q00641_AttackSailren.class.getSimpleName(), "Attack Sailren!");
  50. addStartNpc(SHILENS_STONE_STATUE);
  51. addTalkId(SHILENS_STONE_STATUE);
  52. addKillId(MOBS);
  53. registerQuestItems(GAZKH_FRAGMENT);
  54. }
  55. @Override
  56. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  57. {
  58. QuestState st = getQuestState(player, false);
  59. if (st == null)
  60. {
  61. return getNoQuestMsg(player);
  62. }
  63. switch (event)
  64. {
  65. case "32109-1.html":
  66. st.startQuest();
  67. break;
  68. case "32109-2a.html":
  69. if (st.getQuestItemsCount(GAZKH_FRAGMENT) >= 30)
  70. {
  71. st.giveItems(GAZKH, 1);
  72. st.exitQuest(true, true);
  73. }
  74. break;
  75. }
  76. return event;
  77. }
  78. @Override
  79. public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
  80. {
  81. final L2PcInstance partyMember = getRandomPartyMember(player, 1);
  82. if (partyMember != null)
  83. {
  84. final QuestState st = getQuestState(partyMember, false);
  85. if (st != null)
  86. {
  87. st.giveItems(GAZKH_FRAGMENT, 1);
  88. if (st.getQuestItemsCount(GAZKH_FRAGMENT) < 30)
  89. {
  90. st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
  91. }
  92. else
  93. {
  94. st.setCond(2, true);
  95. }
  96. }
  97. }
  98. return super.onKill(npc, player, isSummon);
  99. }
  100. @Override
  101. public String onTalk(L2Npc npc, L2PcInstance player)
  102. {
  103. String htmltext = getNoQuestMsg(player);
  104. QuestState st = getQuestState(player, true);
  105. if (st == null)
  106. {
  107. return htmltext;
  108. }
  109. switch (st.getState())
  110. {
  111. case State.CREATED:
  112. if (player.getLevel() < 77)
  113. {
  114. htmltext = "32109-0.htm";
  115. }
  116. else
  117. {
  118. st = player.getQuestState(Q00126_TheNameOfEvil2.class.getSimpleName());
  119. htmltext = ((st != null) && st.isCompleted()) ? "32109-0a.htm" : "32109-0b.htm";
  120. }
  121. break;
  122. case State.STARTED:
  123. htmltext = (st.isCond(1)) ? "32109-1a.html" : "32109-2.html";
  124. break;
  125. }
  126. return htmltext;
  127. }
  128. }