DarkElvenChange2.java 5.1 KB

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