DarkElvenChange2.java 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  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 village_master.DarkElvenChange2;
  20. import com.l2jserver.gameserver.enums.QuestSound;
  21. import com.l2jserver.gameserver.enums.Race;
  22. import com.l2jserver.gameserver.model.actor.L2Npc;
  23. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  24. import com.l2jserver.gameserver.model.base.ClassId;
  25. import com.l2jserver.gameserver.model.quest.Quest;
  26. import com.l2jserver.gameserver.util.Util;
  27. /**
  28. * Dark Elven Change Part 2.
  29. * @author nonom
  30. */
  31. public final class DarkElvenChange2 extends Quest
  32. {
  33. // NPCs
  34. private static int[] NPCS =
  35. {
  36. 30195, // Brecson
  37. 30699, // Medown
  38. 30474, // Angus
  39. 31324, // Andromeda
  40. 30862, // Oltran
  41. 30910, // Xairakin
  42. 31285, // Samael
  43. 31334, // Tifaren
  44. 31974, // Drizzit
  45. 32096, // Helminter
  46. };
  47. // Items
  48. private static int MARK_OF_CHALLENGER = 2627;
  49. private static int MARK_OF_DUTY = 2633;
  50. private static int MARK_OF_SEEKER = 2673;
  51. private static int MARK_OF_SCHOLAR = 2674;
  52. private static int MARK_OF_PILGRIM = 2721;
  53. private static int MARK_OF_DUELIST = 2762;
  54. private static int MARK_OF_SEARCHER = 2809;
  55. private static int MARK_OF_REFORMER = 2821;
  56. private static int MARK_OF_MAGUS = 2840;
  57. private static int MARK_OF_FATE = 3172;
  58. private static int MARK_OF_SAGITTARIUS = 3293;
  59. private static int MARK_OF_WITCHCRAFT = 3307;
  60. private static int MARK_OF_SUMMONER = 3336;
  61. // @formatter:off
  62. private static int[][] CLASSES =
  63. {
  64. { 33, 32, 26, 27, 28, 29, MARK_OF_DUTY, MARK_OF_FATE, MARK_OF_WITCHCRAFT }, // SK
  65. { 34, 32, 30, 31, 32, 33, MARK_OF_CHALLENGER, MARK_OF_FATE, MARK_OF_DUELIST }, // BD
  66. { 43, 42, 34, 35, 36, 37, MARK_OF_PILGRIM, MARK_OF_FATE, MARK_OF_REFORMER }, // SE
  67. { 36, 35, 38, 39, 40, 41, MARK_OF_SEEKER, MARK_OF_FATE, MARK_OF_SEARCHER }, // AW
  68. { 37, 35, 42, 43, 44, 45, MARK_OF_SEEKER, MARK_OF_FATE, MARK_OF_SAGITTARIUS }, // PR
  69. { 40, 39, 46, 47, 48, 49, MARK_OF_SCHOLAR, MARK_OF_FATE, MARK_OF_MAGUS }, // SH
  70. { 41, 39, 50, 51, 52, 53, MARK_OF_SCHOLAR, MARK_OF_FATE, MARK_OF_SUMMONER }, // PS
  71. };
  72. // @formatter:on
  73. private DarkElvenChange2()
  74. {
  75. super(-1, DarkElvenChange2.class.getSimpleName(), "village_master");
  76. addStartNpc(NPCS);
  77. addTalkId(NPCS);
  78. }
  79. @Override
  80. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  81. {
  82. if (Util.isDigit(event))
  83. {
  84. int i = Integer.valueOf(event);
  85. final ClassId cid = player.getClassId();
  86. if ((cid.getRace() == Race.DARK_ELF) && (cid.getId() == CLASSES[i][1]))
  87. {
  88. int suffix;
  89. final boolean item1 = hasQuestItems(player, CLASSES[i][6]);
  90. final boolean item2 = hasQuestItems(player, CLASSES[i][7]);
  91. final boolean item3 = hasQuestItems(player, CLASSES[i][8]);
  92. if (player.getLevel() < 40)
  93. {
  94. suffix = (!item1 || !item2 || !item3) ? CLASSES[i][2] : CLASSES[i][3];
  95. }
  96. else
  97. {
  98. if (!item1 || !item2 || !item3)
  99. {
  100. suffix = CLASSES[i][4];
  101. }
  102. else
  103. {
  104. suffix = CLASSES[i][5];
  105. takeItems(player, CLASSES[i][6], -1);
  106. takeItems(player, CLASSES[i][7], -1);
  107. takeItems(player, CLASSES[i][8], -1);
  108. playSound(player, QuestSound.ITEMSOUND_QUEST_FANFARE_2);
  109. player.setClassId(CLASSES[i][0]);
  110. player.setBaseClass(CLASSES[i][0]);
  111. player.broadcastUserInfo();
  112. }
  113. }
  114. event = "30474-" + suffix + ".html";
  115. }
  116. }
  117. return event;
  118. }
  119. @Override
  120. public String onTalk(L2Npc npc, L2PcInstance player)
  121. {
  122. String htmltext = getNoQuestMsg(player);
  123. if (player.isSubClassActive())
  124. {
  125. return htmltext;
  126. }
  127. final ClassId cid = player.getClassId();
  128. if (cid.getRace() == Race.DARK_ELF)
  129. {
  130. switch (cid)
  131. {
  132. case palusKnight:
  133. {
  134. htmltext = "30474-01.html";
  135. break;
  136. }
  137. case shillienOracle:
  138. {
  139. htmltext = "30474-08.html";
  140. break;
  141. }
  142. case assassin:
  143. {
  144. htmltext = "30474-12.html";
  145. break;
  146. }
  147. case darkWizard:
  148. {
  149. htmltext = "30474-19.html";
  150. break;
  151. }
  152. default:
  153. {
  154. if (cid.level() == 0)
  155. {
  156. // first occupation not made yet
  157. htmltext = "30474-55.html";
  158. }
  159. else if (cid.level() >= 2)
  160. {
  161. // second/third occupation change already made
  162. htmltext = "30474-54.html";
  163. }
  164. else
  165. {
  166. htmltext = "30474-56.html";
  167. }
  168. }
  169. }
  170. }
  171. else
  172. {
  173. htmltext = "30474-56.html"; // other races
  174. }
  175. return htmltext;
  176. }
  177. public static void main(String[] args)
  178. {
  179. new DarkElvenChange2();
  180. }
  181. }