OrcChange2.java 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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.OrcChange2;
  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. * Orc class transfer AI.
  27. * @author Adry_85
  28. */
  29. public final class OrcChange2 extends AbstractNpcAI
  30. {
  31. // NPCs
  32. private static int[] NPCS =
  33. {
  34. 30513, // Penatus
  35. 30681, // Karia
  36. 30704, // Garvarentz
  37. 30865, // Ladanza
  38. 30913, // Tushku
  39. 31288, // Aklan
  40. 31326, // Lambac
  41. 31336, // Rahorakti
  42. 31977, // Shaka
  43. };
  44. // Items
  45. private static final int SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE = 8870;
  46. private static final int MARK_OF_CHALLENGER = 2627; // proof11x, proof21x
  47. private static final int MARK_OF_PILGRIM = 2721; // proof31x, proof32x
  48. private static final int MARK_OF_DUELIST = 2762; // proof21z
  49. private static final int MARK_OF_WARSPIRIT = 2879; // proof32z
  50. private static final int MARK_OF_GLORY = 3203; // proof11y, proof21y, proof31y, proof32y
  51. private static final int MARK_OF_CHAMPION = 3276; // proof11z
  52. private static final int MARK_OF_LORD = 3390; // proof31z
  53. // Classes
  54. private static final int DESTROYER = 46;
  55. private static final int TYRANT = 48;
  56. private static final int OVERLORD = 51;
  57. private static final int WARCRYER = 52;
  58. private OrcChange2()
  59. {
  60. super(OrcChange2.class.getSimpleName(), "village_master");
  61. addStartNpc(NPCS);
  62. addTalkId(NPCS);
  63. }
  64. @Override
  65. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  66. {
  67. String htmltext = null;
  68. switch (event)
  69. {
  70. case "30513-03.htm": // master_lv3_orc006ra
  71. case "30513-04.htm": // master_lv3_orc007ra
  72. case "30513-05.htm": // master_lv3_orc007rat
  73. case "30513-07.htm": // master_lv3_orc006ma
  74. case "30513-08.htm": // master_lv3_orc007ma
  75. case "30513-09.htm": // master_lv3_orc007mat
  76. case "30513-10.htm": // master_lv3_orc003s
  77. case "30513-11.htm": // master_lv3_orc006sa
  78. case "30513-12.htm": // master_lv3_orc007sa
  79. case "30513-13.htm": // master_lv3_orc007sat
  80. case "30513-14.htm": // master_lv3_orc006sb
  81. case "30513-15.htm": // master_lv3_orc007sb
  82. case "30513-16.htm": // master_lv3_orc007sbt
  83. {
  84. htmltext = event;
  85. break;
  86. }
  87. case "46":
  88. case "48":
  89. case "51":
  90. case "52":
  91. {
  92. htmltext = ClassChangeRequested(player, Integer.valueOf(event));
  93. break;
  94. }
  95. }
  96. return htmltext;
  97. }
  98. private String ClassChangeRequested(L2PcInstance player, int classId)
  99. {
  100. String htmltext = null;
  101. if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP))
  102. {
  103. htmltext = "30513-19.htm"; // fnYouAreThirdClass
  104. }
  105. else if ((classId == DESTROYER) && (player.getClassId() == ClassId.orcRaider))
  106. {
  107. if (player.getLevel() < 40)
  108. {
  109. if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_GLORY, MARK_OF_CHAMPION))
  110. {
  111. htmltext = "30513-20.htm"; // fnLowLevel11
  112. }
  113. else
  114. {
  115. htmltext = "30513-21.htm"; // fnLowLevelNoProof11
  116. }
  117. }
  118. else if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_GLORY, MARK_OF_CHAMPION))
  119. {
  120. takeItems(player, -1, MARK_OF_CHALLENGER, MARK_OF_GLORY, MARK_OF_CHAMPION);
  121. player.setClassId(DESTROYER);
  122. player.setBaseClass(DESTROYER);
  123. // SystemMessage and cast skill is done by setClassId
  124. player.broadcastUserInfo();
  125. giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15);
  126. htmltext = "30513-22.htm"; // fnAfterClassChange11
  127. }
  128. else
  129. {
  130. htmltext = "30513-23.htm"; // fnNoProof11
  131. }
  132. }
  133. else if ((classId == TYRANT) && (player.getClassId() == ClassId.orcMonk))
  134. {
  135. if (player.getLevel() < 40)
  136. {
  137. if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_GLORY, MARK_OF_DUELIST))
  138. {
  139. htmltext = "30513-24.htm"; // fnLowLevel21
  140. }
  141. else
  142. {
  143. htmltext = "30513-25.htm"; // fnLowLevelNoProof21
  144. }
  145. }
  146. else if (hasQuestItems(player, MARK_OF_CHALLENGER, MARK_OF_GLORY, MARK_OF_DUELIST))
  147. {
  148. takeItems(player, -1, MARK_OF_CHALLENGER, MARK_OF_GLORY, MARK_OF_DUELIST);
  149. player.setClassId(TYRANT);
  150. player.setBaseClass(TYRANT);
  151. // SystemMessage and cast skill is done by setClassId
  152. player.broadcastUserInfo();
  153. giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15);
  154. htmltext = "30513-26.htm"; // fnAfterClassChange21
  155. }
  156. else
  157. {
  158. htmltext = "30513-27.htm"; // fnNoProof21
  159. }
  160. }
  161. else if ((classId == OVERLORD) && (player.getClassId() == ClassId.orcShaman))
  162. {
  163. if (player.getLevel() < 40)
  164. {
  165. if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_GLORY, MARK_OF_LORD))
  166. {
  167. htmltext = "30513-28.htm"; // fnLowLevel31
  168. }
  169. else
  170. {
  171. htmltext = "30513-29.htm"; // fnLowLevelNoProof31
  172. }
  173. }
  174. else if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_GLORY, MARK_OF_LORD))
  175. {
  176. takeItems(player, -1, MARK_OF_PILGRIM, MARK_OF_GLORY, MARK_OF_LORD);
  177. player.setClassId(OVERLORD);
  178. player.setBaseClass(OVERLORD);
  179. // SystemMessage and cast skill is done by setClassId
  180. player.broadcastUserInfo();
  181. giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15);
  182. htmltext = "30513-30.htm"; // fnAfterClassChange31
  183. }
  184. else
  185. {
  186. htmltext = "30513-31.htm"; // fnNoProof31
  187. }
  188. }
  189. else if ((classId == WARCRYER) && (player.getClassId() == ClassId.orcShaman))
  190. {
  191. if (player.getLevel() < 40)
  192. {
  193. if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_GLORY, MARK_OF_WARSPIRIT))
  194. {
  195. htmltext = "30513-32.htm"; // fnLowLevel32
  196. }
  197. else
  198. {
  199. htmltext = "30513-33.htm"; // fnLowLevelNoProof32
  200. }
  201. }
  202. else if (hasQuestItems(player, MARK_OF_PILGRIM, MARK_OF_GLORY, MARK_OF_WARSPIRIT))
  203. {
  204. takeItems(player, -1, MARK_OF_PILGRIM, MARK_OF_GLORY, MARK_OF_WARSPIRIT);
  205. player.setClassId(WARCRYER);
  206. player.setBaseClass(WARCRYER);
  207. // SystemMessage and cast skill is done by setClassId
  208. player.broadcastUserInfo();
  209. giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15);
  210. htmltext = "30513-34.htm"; // fnAfterClassChange32
  211. }
  212. else
  213. {
  214. htmltext = "30513-35.htm"; // fnNoProof32
  215. }
  216. }
  217. return htmltext;
  218. }
  219. @Override
  220. public String onTalk(L2Npc npc, L2PcInstance player)
  221. {
  222. String htmltext = null;
  223. if (player.isInCategory(CategoryType.FOURTH_CLASS_GROUP) && (player.isInCategory(CategoryType.ORC_MALL_CLASS) || player.isInCategory(CategoryType.ORC_FALL_CLASS)))
  224. {
  225. htmltext = "30513-01.htm"; // fnYouAreFourthClass
  226. }
  227. else if (player.isInCategory(CategoryType.ORC_MALL_CLASS) || player.isInCategory(CategoryType.ORC_FALL_CLASS))
  228. {
  229. final ClassId classId = player.getClassId();
  230. if ((classId == ClassId.orcRaider) || (classId == ClassId.destroyer))
  231. {
  232. htmltext = "30513-02.htm"; // fnClassList1
  233. }
  234. else if ((classId == ClassId.orcMonk) || (classId == ClassId.tyrant))
  235. {
  236. htmltext = "30513-06.htm"; // fnClassList2
  237. }
  238. else if ((classId == ClassId.orcShaman) || (classId == ClassId.overlord) || (classId == ClassId.warcryer))
  239. {
  240. htmltext = "30513-10.htm"; // fnClassList3
  241. }
  242. else
  243. {
  244. htmltext = "30513-17.htm"; // fnYouAreFirstClass
  245. }
  246. }
  247. else
  248. {
  249. htmltext = "30513-18.htm"; // fnClassMismatch
  250. }
  251. return htmltext;
  252. }
  253. public static void main(String[] args)
  254. {
  255. new OrcChange2();
  256. }
  257. }