ElfHumanWizardChange2.java 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  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.ElfHumanWizardChange2;
  20. import ai.npc.AbstractNpcAI;
  21. import com.l2jserver.gameserver.enums.CategoryType;
  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. /**
  26. * Elf Human class transfer AI.
  27. * @author Adry_85
  28. */
  29. public final class ElfHumanWizardChange2 extends AbstractNpcAI
  30. {
  31. // NPCs
  32. private static int[] NPCS =
  33. {
  34. 30115, // Jurek
  35. 30174, // Arkenias
  36. 30176, // Valleria
  37. 30694, // Scraide
  38. 30854, // Drikiyan
  39. 31331, // Valdis
  40. 31755, // Halaster
  41. 31996, // Javier
  42. };
  43. // Items
  44. private static final int SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE = 8870;
  45. private static final int MARK_OF_SCHOLAR = 2674; // proof11x, proof12x, proof13x, proof21x, proof22x
  46. private static final int MARK_OF_TRUST = 2734; // proof11y, proof12y, proof13y
  47. private static final int MARK_OF_MAGUS = 2840; // proof11z, proof21z
  48. private static final int MARK_OF_WITCHCRAFT = 3307; // proof12z
  49. private static final int MARK_OF_SUMMONER = 3336; // proof13z, proof22z
  50. private static final int MARK_OF_LIFE = 3140; // proof21y, proof22y
  51. // Classes
  52. private static final int SORCERER = 12;
  53. private static final int NECROMANCER = 13;
  54. private static final int WARLOCK = 14;
  55. private static final int SPELLSINGER = 27;
  56. private static final int ELEMENTAL_SUMMONER = 28;
  57. private ElfHumanWizardChange2()
  58. {
  59. super(ElfHumanWizardChange2.class.getSimpleName(), "village_master");
  60. addStartNpc(NPCS);
  61. addTalkId(NPCS);
  62. }
  63. @Override
  64. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  65. {
  66. String htmltext = null;
  67. switch (event)
  68. {
  69. case "30115-02.htm": // master_lv3_hew003h
  70. case "30115-03.htm": // master_lv3_hew006ha
  71. case "30115-04.htm": // master_lv3_hew007ha
  72. case "30115-05.htm": // master_lv3_hew007hat
  73. case "30115-06.htm": // master_lv3_hew006hb
  74. case "30115-07.htm": // master_lv3_hew007hb
  75. case "30115-08.htm": // master_lv3_hew007hbt
  76. case "30115-09.htm": // master_lv3_hew006hc
  77. case "30115-10.htm": // master_lv3_hew007hc
  78. case "30115-11.htm": // master_lv3_hew007hct
  79. case "30115-12.htm": // master_lv3_hew003e
  80. case "30115-13.htm": // master_lv3_hew006ea
  81. case "30115-14.htm": // master_lv3_hew007ea
  82. case "30115-15.htm": // master_lv3_hew007eat
  83. case "30115-16.htm": // master_lv3_hew006eb
  84. case "30115-17.htm": // master_lv3_hew007eb
  85. case "30115-18.htm": // master_lv3_hew007eb
  86. {
  87. htmltext = event;
  88. break;
  89. }
  90. case "12":
  91. case "13":
  92. case "14":
  93. case "27":
  94. case "28":
  95. {
  96. htmltext = ClassChangeRequested(player, Integer.valueOf(event));
  97. break;
  98. }
  99. }
  100. return htmltext;
  101. }
  102. private String ClassChangeRequested(L2PcInstance player, int classId)
  103. {
  104. String htmltext = null;
  105. if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP))
  106. {
  107. htmltext = "30115-21.htm"; // fnYouAreThirdClass
  108. }
  109. else if ((classId == SORCERER) && (player.getClassId() == ClassId.wizard))
  110. {
  111. if (player.getLevel() < 40)
  112. {
  113. if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_MAGUS))
  114. {
  115. htmltext = "30115-22.htm"; // fnLowLevel11
  116. }
  117. else
  118. {
  119. htmltext = "30115-23.htm"; // fnLowLevelNoProof11
  120. }
  121. }
  122. else if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_MAGUS))
  123. {
  124. takeItems(player, -1, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_MAGUS);
  125. player.setClassId(SORCERER);
  126. player.setBaseClass(SORCERER);
  127. // SystemMessage and cast skill is done by setClassId
  128. player.broadcastUserInfo();
  129. giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15);
  130. htmltext = "30115-24.htm"; // fnAfterClassChange11
  131. }
  132. else
  133. {
  134. htmltext = "30115-25.htm"; // fnNoProof11
  135. }
  136. }
  137. else if ((classId == NECROMANCER) && (player.getClassId() == ClassId.wizard))
  138. {
  139. if (player.getLevel() < 40)
  140. {
  141. if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_WITCHCRAFT))
  142. {
  143. htmltext = "30115-26.htm"; // fnLowLevel12
  144. }
  145. else
  146. {
  147. htmltext = "30115-27.htm"; // fnLowLevelNoProof12
  148. }
  149. }
  150. else if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_WITCHCRAFT))
  151. {
  152. takeItems(player, -1, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_WITCHCRAFT);
  153. player.setClassId(NECROMANCER);
  154. player.setBaseClass(NECROMANCER);
  155. // SystemMessage and cast skill is done by setClassId
  156. player.broadcastUserInfo();
  157. giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15);
  158. htmltext = "30115-28.htm"; // fnAfterClassChange12
  159. }
  160. else
  161. {
  162. htmltext = "30115-29.htm"; // fnNoProof12
  163. }
  164. }
  165. else if ((classId == WARLOCK) && (player.getClassId() == ClassId.wizard))
  166. {
  167. if (player.getLevel() < 40)
  168. {
  169. if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_SUMMONER))
  170. {
  171. htmltext = "30115-30.htm"; // fnLowLevel13
  172. }
  173. else
  174. {
  175. htmltext = "30115-31.htm"; // fnLowLevelNoProof13
  176. }
  177. }
  178. else if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_SUMMONER))
  179. {
  180. takeItems(player, -1, MARK_OF_SCHOLAR, MARK_OF_TRUST, MARK_OF_SUMMONER);
  181. player.setClassId(WARLOCK);
  182. player.setBaseClass(WARLOCK);
  183. // SystemMessage and cast skill is done by setClassId
  184. player.broadcastUserInfo();
  185. giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15);
  186. htmltext = "30115-32.htm"; // fnAfterClassChange13
  187. }
  188. else
  189. {
  190. htmltext = "30115-33.htm"; // fnNoProof13
  191. }
  192. }
  193. else if ((classId == SPELLSINGER) && (player.getClassId() == ClassId.elvenWizard))
  194. {
  195. if (player.getLevel() < 40)
  196. {
  197. if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_LIFE, MARK_OF_MAGUS))
  198. {
  199. htmltext = "30115-34.htm"; // fnLowLevel21
  200. }
  201. else
  202. {
  203. htmltext = "30115-35.htm"; // fnLowLevelNoProof21
  204. }
  205. }
  206. else if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_LIFE, MARK_OF_MAGUS))
  207. {
  208. takeItems(player, -1, MARK_OF_SCHOLAR, MARK_OF_LIFE, MARK_OF_MAGUS);
  209. player.setClassId(SPELLSINGER);
  210. player.setBaseClass(SPELLSINGER);
  211. // SystemMessage and cast skill is done by setClassId
  212. player.broadcastUserInfo();
  213. giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15);
  214. htmltext = "30115-36.htm"; // fnAfterClassChange21
  215. }
  216. else
  217. {
  218. htmltext = "30115-37.htm"; // fnNoProof21
  219. }
  220. }
  221. else if ((classId == ELEMENTAL_SUMMONER) && (player.getClassId() == ClassId.elvenWizard))
  222. {
  223. if (player.getLevel() < 40)
  224. {
  225. if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_LIFE, MARK_OF_SUMMONER))
  226. {
  227. htmltext = "30115-38.htm"; // fnLowLevel22
  228. }
  229. else
  230. {
  231. htmltext = "30115-39.htm"; // fnLowLevelNoProof22
  232. }
  233. }
  234. else if (hasQuestItems(player, MARK_OF_SCHOLAR, MARK_OF_LIFE, MARK_OF_SUMMONER))
  235. {
  236. takeItems(player, -1, MARK_OF_SCHOLAR, MARK_OF_LIFE, MARK_OF_SUMMONER);
  237. player.setClassId(ELEMENTAL_SUMMONER);
  238. player.setBaseClass(ELEMENTAL_SUMMONER);
  239. // SystemMessage and cast skill is done by setClassId
  240. player.broadcastUserInfo();
  241. giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15);
  242. htmltext = "30115-40.htm"; // fnAfterClassChange22
  243. }
  244. else
  245. {
  246. htmltext = "30115-41.htm"; // fnNoProof22
  247. }
  248. }
  249. return htmltext;
  250. }
  251. @Override
  252. public String onTalk(L2Npc npc, L2PcInstance player)
  253. {
  254. String htmltext = null;
  255. if (player.isInCategory(CategoryType.WIZARD_GROUP) && player.isInCategory(CategoryType.FOURTH_CLASS_GROUP) && (player.isInCategory(CategoryType.HUMAN_MALL_CLASS) || player.isInCategory(CategoryType.ELF_MALL_CLASS)))
  256. {
  257. htmltext = "30115-01.htm"; // fnYouAreFourthClass
  258. }
  259. else if (player.isInCategory(CategoryType.WIZARD_GROUP) && (player.isInCategory(CategoryType.HUMAN_MALL_CLASS) || player.isInCategory(CategoryType.ELF_MALL_CLASS)))
  260. {
  261. final ClassId classId = player.getClassId();
  262. if ((classId == ClassId.wizard) || (classId == ClassId.sorceror) || (classId == ClassId.necromancer) || (classId == ClassId.warlock))
  263. {
  264. htmltext = "30115-02.htm"; // fnClassList1
  265. }
  266. else if ((classId == ClassId.elvenWizard) || (classId == ClassId.spellsinger) || (classId == ClassId.elementalSummoner))
  267. {
  268. htmltext = "30115-12.htm"; // fnClassList2
  269. }
  270. else
  271. {
  272. htmltext = "30115-19.htm"; // fnYouAreFirstClass
  273. }
  274. }
  275. else
  276. {
  277. htmltext = "30115-20.htm"; // fnClassMismatch
  278. }
  279. return htmltext;
  280. }
  281. public static void main(String[] args)
  282. {
  283. new ElfHumanWizardChange2();
  284. }
  285. }