Q00358_IllegitimateChildOfTheGoddess.java 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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.Q00358_IllegitimateChildOfTheGoddess;
  20. import java.util.HashMap;
  21. import java.util.Map;
  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. /**
  27. * Illegitimate Child of the Goddess (358)
  28. * @author Adry_85
  29. */
  30. public final class Q00358_IllegitimateChildOfTheGoddess extends Quest
  31. {
  32. // NPC
  33. private static final int OLTRAN = 30862;
  34. // Item
  35. private static final int SNAKE_SCALE = 5868;
  36. // Misc
  37. private static final int MIN_LEVEL = 63;
  38. private static final int SNAKE_SCALE_COUNT = 108;
  39. // Rewards
  40. private static final int[] REWARDS = new int[]
  41. {
  42. 5364, // Recipe: Sealed Dark Crystal Shield(60%)
  43. 5366, // Recipe: Sealed Shield of Nightmare(60%)
  44. 6329, // Recipe: Sealed Phoenix Necklace(70%)
  45. 6331, // Recipe: Sealed Phoenix Earring(70%)
  46. 6333, // Recipe: Sealed Phoenix Ring(70%)
  47. 6335, // Recipe: Sealed Majestic Necklace(70%)
  48. 6337, // Recipe: Sealed Majestic Earring(70%)
  49. 6339, // Recipe: Sealed Majestic Ring(70%)
  50. };
  51. // Mobs
  52. private static final Map<Integer, Double> MOBS = new HashMap<>();
  53. static
  54. {
  55. MOBS.put(20672, 0.71); // trives
  56. MOBS.put(20673, 0.74); // falibati
  57. }
  58. public Q00358_IllegitimateChildOfTheGoddess()
  59. {
  60. super(358, Q00358_IllegitimateChildOfTheGoddess.class.getSimpleName(), "Illegitimate Child of the Goddess");
  61. addStartNpc(OLTRAN);
  62. addTalkId(OLTRAN);
  63. addKillId(MOBS.keySet());
  64. registerQuestItems(SNAKE_SCALE);
  65. }
  66. @Override
  67. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  68. {
  69. final QuestState st = getQuestState(player, false);
  70. if (st == null)
  71. {
  72. return null;
  73. }
  74. String htmltext = null;
  75. switch (event)
  76. {
  77. case "30862-02.htm":
  78. case "30862-03.htm":
  79. {
  80. htmltext = event;
  81. break;
  82. }
  83. case "30862-04.htm":
  84. {
  85. st.startQuest();
  86. htmltext = event;
  87. break;
  88. }
  89. }
  90. return htmltext;
  91. }
  92. @Override
  93. public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
  94. {
  95. final QuestState st = getRandomPartyMemberState(player, 1, 3, npc);
  96. if ((st != null) && st.giveItemRandomly(npc, SNAKE_SCALE, 1, SNAKE_SCALE_COUNT, MOBS.get(npc.getId()), true))
  97. {
  98. st.setCond(2, true);
  99. }
  100. return super.onKill(npc, player, isSummon);
  101. }
  102. @Override
  103. public String onTalk(L2Npc npc, L2PcInstance player)
  104. {
  105. final QuestState st = getQuestState(player, true);
  106. String htmltext = getNoQuestMsg(player);
  107. if (st.isCreated())
  108. {
  109. htmltext = ((player.getLevel() >= MIN_LEVEL) ? "30862-01.htm" : "30862-05.html");
  110. }
  111. else if (st.isStarted())
  112. {
  113. if (getQuestItemsCount(player, SNAKE_SCALE) < SNAKE_SCALE_COUNT)
  114. {
  115. htmltext = "30862-06.html";
  116. }
  117. else
  118. {
  119. rewardItems(player, REWARDS[getRandom(REWARDS.length)], 1);
  120. st.exitQuest(true, true);
  121. htmltext = "30862-07.html";
  122. }
  123. }
  124. return htmltext;
  125. }
  126. }