ElfHumanClericChange2.java 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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.ElfHumanClericChange2;
  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 ElfHumanClericChange2 extends AbstractNpcAI
  30. {
  31. // NPCs
  32. private static int[] NPCS =
  33. {
  34. 30120, // Maximilian
  35. 30191, // Hollint
  36. 30857, // Orven
  37. 30905, // Squillari
  38. 31279, // Gregory
  39. 31328, // Innocentin
  40. 31968, // Baryl
  41. };
  42. // Items
  43. private static final int SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE = 8870;
  44. private static final int MARK_OF_PILGRIM = 2721; // proof11x, proof12x, proof21x
  45. private static final int MARK_OF_TRUST = 2734; // proof11y, proof12y
  46. private static final int MARK_OF_HEALER = 2820; // proof11z, proof21z
  47. private static final int MARK_OF_REFORMER = 2821; // proof12z
  48. private static final int MARK_OF_LIFE = 3140; // proof21y
  49. // Classes
  50. private static final int BISHOP = 16;
  51. private static final int PROPHET = 17;
  52. private static final int ELDER = 30;
  53. private ElfHumanClericChange2()
  54. {
  55. super(ElfHumanClericChange2.class.getSimpleName(), "village_master");
  56. addStartNpc(NPCS);
  57. addTalkId(NPCS);
  58. }
  59. @Override
  60. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  61. {
  62. String htmltext = null;
  63. switch (event)
  64. {
  65. case "30120-02.htm": // master_lv3_hec003h
  66. case "30120-03.htm": // master_lv3_hec006ha
  67. case "30120-04.htm": // master_lv3_hec007ha
  68. case "30120-05.htm": // master_lv3_hec007hat
  69. case "30120-06.htm": // master_lv3_hec006hb
  70. case "30120-07.htm": // master_lv3_hec007hb
  71. case "30120-08.htm": // master_lv3_hec007hbt
  72. case "30120-10.htm": // master_lv3_hec006ea
  73. case "30120-11.htm": // master_lv3_hec007ea
  74. case "30120-12.htm": // master_lv3_hec007eat
  75. {
  76. htmltext = event;
  77. break;
  78. }
  79. case "16":
  80. case "17":
  81. case "30":
  82. {
  83. htmltext = ClassChangeRequested(player, Integer.valueOf(event));
  84. break;
  85. }
  86. }
  87. return htmltext;
  88. }
  89. private String ClassChangeRequested(L2PcInstance player, int classId)
  90. {
  91. String htmltext = null;
  92. if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP))
  93. {
  94. htmltext = "30120-15.htm"; // fnYouAreThirdClass
  95. }
  96. else if ((classId == BISHOP) && (player.getClassId() == ClassId.cleric))
  97. {
  98. if (player.getLevel() < 40)
  99. {
  100. if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_TRUST, MARK_OF_HEALER))
  101. {
  102. htmltext = "30120-16.htm"; // fnLowLevel11
  103. }
  104. else
  105. {
  106. htmltext = "30120-17.htm"; // fnLowLevelNoProof11
  107. }
  108. }
  109. else if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_TRUST, MARK_OF_HEALER))
  110. {
  111. takeItems(player, -1, MARK_OF_PILGRIM, MARK_OF_TRUST, MARK_OF_HEALER);
  112. player.setClassId(BISHOP);
  113. player.setBaseClass(BISHOP);
  114. // SystemMessage and cast skill is done by setClassId
  115. player.broadcastUserInfo();
  116. giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15);
  117. htmltext = "30120-18.htm"; // fnAfterClassChange11
  118. }
  119. else
  120. {
  121. htmltext = "30120-19.htm"; // fnNoProof11
  122. }
  123. }
  124. else if ((classId == PROPHET) && (player.getClassId() == ClassId.cleric))
  125. {
  126. if (player.getLevel() < 40)
  127. {
  128. if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_TRUST, MARK_OF_REFORMER))
  129. {
  130. htmltext = "30120-20.htm"; // fnLowLevel12
  131. }
  132. else
  133. {
  134. htmltext = "30120-21.htm"; // fnLowLevelNoProof12
  135. }
  136. }
  137. else if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_TRUST, MARK_OF_REFORMER))
  138. {
  139. takeItems(player, -1, MARK_OF_PILGRIM, MARK_OF_TRUST, MARK_OF_REFORMER);
  140. player.setClassId(PROPHET);
  141. player.setBaseClass(PROPHET);
  142. // SystemMessage and cast skill is done by setClassId
  143. player.broadcastUserInfo();
  144. giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15);
  145. htmltext = "30120-22.htm"; // fnAfterClassChange12
  146. }
  147. else
  148. {
  149. htmltext = "30120-23.htm"; // fnNoProof12
  150. }
  151. }
  152. else if ((classId == ELDER) && (player.getClassId() == ClassId.oracle))
  153. {
  154. if (player.getLevel() < 40)
  155. {
  156. if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_LIFE, MARK_OF_HEALER))
  157. {
  158. htmltext = "30120-24.htm"; // fnLowLevel21
  159. }
  160. else
  161. {
  162. htmltext = "30120-25.htm"; // fnLowLevelNoProof21
  163. }
  164. }
  165. else if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_LIFE, MARK_OF_HEALER))
  166. {
  167. takeItems(player, -1, MARK_OF_PILGRIM, MARK_OF_LIFE, MARK_OF_HEALER);
  168. player.setClassId(ELDER);
  169. player.setBaseClass(ELDER);
  170. // SystemMessage and cast skill is done by setClassId
  171. player.broadcastUserInfo();
  172. giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15);
  173. htmltext = "30120-26.htm"; // fnAfterClassChange21
  174. }
  175. else
  176. {
  177. htmltext = "30120-27.htm"; // fnNoProof21
  178. }
  179. }
  180. return htmltext;
  181. }
  182. @Override
  183. public String onTalk(L2Npc npc, L2PcInstance player)
  184. {
  185. String htmltext = null;
  186. if (player.isInCategory(CategoryType.CLERIC_GROUP) && player.isInCategory(CategoryType.FOURTH_CLASS_GROUP) && (player.isInCategory(CategoryType.HUMAN_CALL_CLASS) || player.isInCategory(CategoryType.ELF_CALL_CLASS)))
  187. {
  188. htmltext = "30120-01.htm"; // fnYouAreFourthClass
  189. }
  190. else if (player.isInCategory(CategoryType.CLERIC_GROUP) && (player.isInCategory(CategoryType.HUMAN_CALL_CLASS) || player.isInCategory(CategoryType.ELF_CALL_CLASS)))
  191. {
  192. final ClassId classId = player.getClassId();
  193. if ((classId == ClassId.cleric) || (classId == ClassId.bishop) || (classId == ClassId.prophet))
  194. {
  195. htmltext = "30120-02.htm"; // fnClassList1
  196. }
  197. else if ((classId == ClassId.oracle) || (classId == ClassId.elder))
  198. {
  199. htmltext = "30120-09.htm"; // fnClassList2
  200. }
  201. else
  202. {
  203. htmltext = "30120-13.htm"; // fnYouAreFirstClass
  204. }
  205. }
  206. else
  207. {
  208. htmltext = "30120-14.htm"; // fnClassMismatch
  209. }
  210. return htmltext;
  211. }
  212. public static void main(String[] args)
  213. {
  214. new ElfHumanClericChange2();
  215. }
  216. }