Q10273_GoodDayToFly.java 4.2 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.Q10273_GoodDayToFly;
  20. import com.l2jserver.gameserver.enums.QuestSound;
  21. import com.l2jserver.gameserver.model.actor.L2Npc;
  22. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  23. import com.l2jserver.gameserver.model.holders.SkillHolder;
  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. * Good Day to Fly (10273)<br>
  29. * Original Jython script by Kerberos v1.0 on 2009/04/25
  30. * @author nonom
  31. */
  32. public class Q10273_GoodDayToFly extends Quest
  33. {
  34. // NPC
  35. private static final int LEKON = 32557;
  36. // Monsters
  37. private static final int[] MOBS =
  38. {
  39. 22614, // Vulture Rider
  40. 22615, // Vulture Rider
  41. };
  42. // Item
  43. private static final int MARK = 13856;
  44. // Skills
  45. private static final SkillHolder AURA_BIRD_FALCON = new SkillHolder(5982, 1);
  46. private static final SkillHolder AURA_BIRD_OWL = new SkillHolder(5983, 1);
  47. public Q10273_GoodDayToFly()
  48. {
  49. super(10273, Q10273_GoodDayToFly.class.getSimpleName(), "Good Day to Fly");
  50. addStartNpc(LEKON);
  51. addTalkId(LEKON);
  52. addKillId(MOBS);
  53. registerQuestItems(MARK);
  54. }
  55. @Override
  56. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  57. {
  58. final QuestState st = getQuestState(player, false);
  59. if (st == null)
  60. {
  61. return getNoQuestMsg(player);
  62. }
  63. switch (event)
  64. {
  65. case "32557-06.htm":
  66. st.startQuest();
  67. break;
  68. case "32557-09.html":
  69. st.set("transform", "1");
  70. AURA_BIRD_FALCON.getSkill().applyEffects(player, player);
  71. break;
  72. case "32557-10.html":
  73. st.set("transform", "2");
  74. AURA_BIRD_OWL.getSkill().applyEffects(player, player);
  75. break;
  76. case "32557-13.html":
  77. switch (st.getInt("transform"))
  78. {
  79. case 1:
  80. AURA_BIRD_FALCON.getSkill().applyEffects(player, player);
  81. break;
  82. case 2:
  83. AURA_BIRD_OWL.getSkill().applyEffects(player, player);
  84. break;
  85. }
  86. break;
  87. }
  88. return event;
  89. }
  90. @Override
  91. public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
  92. {
  93. final QuestState st = getQuestState(killer, false);
  94. if ((st == null) || !st.isStarted())
  95. {
  96. return null;
  97. }
  98. final long count = st.getQuestItemsCount(MARK);
  99. if (st.isCond(1) && (count < 5))
  100. {
  101. st.giveItems(MARK, 1);
  102. if (count == 4)
  103. {
  104. st.setCond(2, true);
  105. }
  106. else
  107. {
  108. st.playSound(QuestSound.ITEMSOUND_QUEST_ITEMGET);
  109. }
  110. }
  111. return null;
  112. }
  113. @Override
  114. public String onTalk(L2Npc npc, L2PcInstance player)
  115. {
  116. String htmltext = getNoQuestMsg(player);
  117. final QuestState st = getQuestState(player, true);
  118. if (st == null)
  119. {
  120. return htmltext;
  121. }
  122. final int transform = st.getInt("transform");
  123. switch (st.getState())
  124. {
  125. case State.COMPLETED:
  126. htmltext = "32557-0a.html";
  127. break;
  128. case State.CREATED:
  129. htmltext = (player.getLevel() < 75) ? "32557-00.html" : "32557-01.htm";
  130. break;
  131. default:
  132. if (st.getQuestItemsCount(MARK) >= 5)
  133. {
  134. htmltext = "32557-14.html";
  135. if (transform == 1)
  136. {
  137. st.giveItems(13553, 1);
  138. }
  139. else if (transform == 2)
  140. {
  141. st.giveItems(13554, 1);
  142. }
  143. st.giveItems(13857, 1);
  144. st.addExpAndSp(25160, 2525);
  145. st.exitQuest(false, true);
  146. }
  147. else if (transform == 0)
  148. {
  149. htmltext = "32557-07.html";
  150. }
  151. else
  152. {
  153. htmltext = "32557-11.html";
  154. }
  155. break;
  156. }
  157. return htmltext;
  158. }
  159. }