Q10274_CollectingInTheAir.java 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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.Q10274_CollectingInTheAir;
  20. import quests.Q10273_GoodDayToFly.Q10273_GoodDayToFly;
  21. import com.l2jserver.gameserver.enums.QuestSound;
  22. import com.l2jserver.gameserver.model.L2Object;
  23. import com.l2jserver.gameserver.model.actor.L2Npc;
  24. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  25. import com.l2jserver.gameserver.model.quest.Quest;
  26. import com.l2jserver.gameserver.model.quest.QuestState;
  27. import com.l2jserver.gameserver.model.quest.State;
  28. import com.l2jserver.gameserver.model.skills.Skill;
  29. /**
  30. * Collecting in the Air (10274)<br>
  31. * Original Jython script by Kerberos v1.0 on 2009/04/26.
  32. * @author nonom
  33. */
  34. public class Q10274_CollectingInTheAir extends Quest
  35. {
  36. // NPC
  37. private static final int LEKON = 32557;
  38. // Items
  39. private static final int SCROLL = 13844;
  40. private static final int RED = 13858;
  41. private static final int BLUE = 13859;
  42. private static final int GREEN = 13860;
  43. // Monsters
  44. private static final int MOBS[] =
  45. {
  46. 18684, // Red Star Stone
  47. 18685, // Red Star Stone
  48. 18686, // Red Star Stone
  49. 18687, // Blue Star Stone
  50. 18688, // Blue Star Stone
  51. 18689, // Blue Star Stone
  52. 18690, // Green Star Stone
  53. 18691, // Green Star Stone
  54. 18692, // Green Star Stone
  55. };
  56. public Q10274_CollectingInTheAir()
  57. {
  58. super(10274, Q10274_CollectingInTheAir.class.getSimpleName(), "Collecting in the Air");
  59. addStartNpc(LEKON);
  60. addTalkId(LEKON);
  61. addSkillSeeId(MOBS);
  62. registerQuestItems(SCROLL, RED, BLUE, GREEN);
  63. }
  64. @Override
  65. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  66. {
  67. final QuestState st = getQuestState(player, false);
  68. if (st == null)
  69. {
  70. return getNoQuestMsg(player);
  71. }
  72. if (event.equals("32557-03.html"))
  73. {
  74. st.startQuest();
  75. st.giveItems(SCROLL, 8);
  76. }
  77. return event;
  78. }
  79. @Override
  80. public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon)
  81. {
  82. final QuestState st = getQuestState(caster, false);
  83. if ((st == null) || !st.isStarted())
  84. {
  85. return null;
  86. }
  87. if (st.isCond(1) && (skill.getId() == 2630))
  88. {
  89. switch (npc.getId())
  90. {
  91. case 18684:
  92. case 18685:
  93. case 18686:
  94. st.giveItems(RED, 1);
  95. break;
  96. case 18687:
  97. case 18688:
  98. case 18689:
  99. st.giveItems(BLUE, 1);
  100. break;
  101. case 18690:
  102. case 18691:
  103. case 18692:
  104. st.giveItems(GREEN, 1);
  105. break;
  106. }
  107. st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
  108. npc.doDie(caster);
  109. }
  110. return super.onSkillSee(npc, caster, skill, targets, isSummon);
  111. }
  112. @Override
  113. public String onTalk(L2Npc npc, L2PcInstance player)
  114. {
  115. String htmltext = getNoQuestMsg(player);
  116. QuestState st = getQuestState(player, true);
  117. if (st == null)
  118. {
  119. return htmltext;
  120. }
  121. switch (st.getState())
  122. {
  123. case State.COMPLETED:
  124. htmltext = "32557-0a.html";
  125. break;
  126. case State.CREATED:
  127. st = player.getQuestState(Q10273_GoodDayToFly.class.getSimpleName());
  128. if (st == null)
  129. {
  130. htmltext = "32557-00.html";
  131. }
  132. else
  133. {
  134. htmltext = ((player.getLevel() >= 75) && st.isCompleted()) ? "32557-01.htm" : "32557-00.html";
  135. }
  136. break;
  137. case State.STARTED:
  138. if ((st.getQuestItemsCount(RED) + st.getQuestItemsCount(BLUE) + st.getQuestItemsCount(GREEN)) >= 8)
  139. {
  140. htmltext = "32557-05.html";
  141. st.giveItems(13728, 1);
  142. st.addExpAndSp(25160, 2525);
  143. st.exitQuest(false, true);
  144. }
  145. else
  146. {
  147. htmltext = "32557-04.html";
  148. }
  149. break;
  150. }
  151. return htmltext;
  152. }
  153. }