Q00368_TrespassingIntoTheHolyGround.java 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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.Q00368_TrespassingIntoTheHolyGround;
  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. * Trespassing into the Holy Ground (368)
  28. * @author Adry_85
  29. */
  30. public final class Q00368_TrespassingIntoTheHolyGround extends Quest
  31. {
  32. // NPC
  33. private static final int RESTINA = 30926;
  34. // Item
  35. private static final int BLADE_STAKATO_FANG = 5881;
  36. // Misc
  37. private static final int MIN_LEVEL = 36;
  38. // Mobs
  39. private static final Map<Integer, Double> MOBS = new HashMap<>();
  40. static
  41. {
  42. MOBS.put(20794, 0.60); // blade_stakato
  43. MOBS.put(20795, 0.57); // blade_stakato_worker
  44. MOBS.put(20796, 0.61); // blade_stakato_soldier
  45. MOBS.put(20797, 0.93); // blade_stakato_drone
  46. }
  47. public Q00368_TrespassingIntoTheHolyGround()
  48. {
  49. super(368, Q00368_TrespassingIntoTheHolyGround.class.getSimpleName(), "Trespassing into the Holy Ground");
  50. addStartNpc(RESTINA);
  51. addTalkId(RESTINA);
  52. addKillId(MOBS.keySet());
  53. registerQuestItems(BLADE_STAKATO_FANG);
  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 null;
  62. }
  63. String htmltext = null;
  64. switch (event)
  65. {
  66. case "30926-02.htm":
  67. {
  68. st.startQuest();
  69. htmltext = event;
  70. break;
  71. }
  72. case "30926-05.html":
  73. {
  74. st.exitQuest(true, true);
  75. htmltext = event;
  76. break;
  77. }
  78. case "30926-06.html":
  79. {
  80. htmltext = event;
  81. break;
  82. }
  83. }
  84. return htmltext;
  85. }
  86. @Override
  87. public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
  88. {
  89. final int i;
  90. switch (npc.getId())
  91. {
  92. case 20795:
  93. case 20797:
  94. {
  95. i = 1;
  96. break;
  97. }
  98. default:
  99. {
  100. i = 3;
  101. break;
  102. }
  103. }
  104. final QuestState st = getRandomPartyMemberState(player, -1, i, npc);
  105. if (st != null)
  106. {
  107. st.giveItemRandomly(npc, BLADE_STAKATO_FANG, 1, 0, MOBS.get(npc.getId()), true);
  108. }
  109. return super.onKill(npc, player, isSummon);
  110. }
  111. @Override
  112. public String onTalk(L2Npc npc, L2PcInstance player)
  113. {
  114. final QuestState st = getQuestState(player, true);
  115. String htmltext = getNoQuestMsg(player);
  116. if (st == null)
  117. {
  118. return htmltext;
  119. }
  120. if (st.isCreated())
  121. {
  122. htmltext = ((player.getLevel() >= MIN_LEVEL) ? "30926-01.htm" : "30926-03.html");
  123. }
  124. else if (st.isStarted())
  125. {
  126. if (hasQuestItems(player, BLADE_STAKATO_FANG))
  127. {
  128. final long count = getQuestItemsCount(player, BLADE_STAKATO_FANG);
  129. final long bonus = (count >= 10 ? 9450 : 2000);
  130. giveAdena(player, (count * 250) + bonus, true);
  131. takeItems(player, BLADE_STAKATO_FANG, -1);
  132. htmltext = "30926-04.html";
  133. }
  134. else
  135. {
  136. htmltext = "30926-07.html";
  137. }
  138. }
  139. return htmltext;
  140. }
  141. }