DarkElvenChange2.java 5.0 KB

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