OrcChange1.java 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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.OrcChange1;
  20. import ai.npc.AbstractNpcAI;
  21. import com.l2jserver.gameserver.enums.CategoryType;
  22. import com.l2jserver.gameserver.enums.Race;
  23. import com.l2jserver.gameserver.model.actor.L2Npc;
  24. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  25. import com.l2jserver.gameserver.model.base.ClassId;
  26. /**
  27. * Orc class transfer AI.
  28. * @author Adry_85
  29. */
  30. public final class OrcChange1 extends AbstractNpcAI
  31. {
  32. // NPCs
  33. private static int[] NPCS =
  34. {
  35. 30500, // Osborn
  36. 30505, // Drikus
  37. 30508, // Castor
  38. 32097, // Finker
  39. };
  40. // Items
  41. private static final int SHADOW_ITEM_EXCHANGE_COUPON_D_GRADE = 8869;
  42. private static final int MARK_OF_RAIDER = 1592;
  43. private static final int KHAVATARI_TOTEM = 1615;
  44. private static final int MASK_OF_MEDIUM = 1615;
  45. private OrcChange1()
  46. {
  47. super(OrcChange1.class.getSimpleName(), "village_master");
  48. addStartNpc(NPCS);
  49. addTalkId(NPCS);
  50. }
  51. @Override
  52. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  53. {
  54. String htmltext = null;
  55. switch (event)
  56. {
  57. case "30500-01.htm": // high_prefect_osborn003f
  58. case "30500-02.htm": // high_prefect_osborn006fa
  59. case "30500-03.htm": // high_prefect_osborn007fa
  60. case "30500-04.htm": // high_prefect_osborn006fb
  61. case "30500-05.htm": // high_prefect_osborn007fb
  62. case "30500-06.htm": // high_prefect_osborn003m
  63. case "30500-07.htm": // high_prefect_osborn006ma
  64. case "30500-08.htm": // high_prefect_osborn007ma
  65. case "30505-01.htm": // high_prefect_drikus003f
  66. case "30505-02.htm": // high_prefect_drikus006fa
  67. case "30505-03.htm": // high_prefect_drikus007fa
  68. case "30505-04.htm": // high_prefect_drikus006fb
  69. case "30505-05.htm": // high_prefect_drikus007fb
  70. case "30505-06.htm": // high_prefect_drikus003m
  71. case "30505-07.htm": // high_prefect_drikus006ma
  72. case "30505-08.htm": // high_prefect_drikus007ma
  73. case "30508-01.htm": // high_prefect_cional003f
  74. case "30508-02.htm": // high_prefect_cional006fa
  75. case "30508-03.htm": // high_prefect_cional007fa
  76. case "30508-04.htm": // high_prefect_cional006fb
  77. case "30508-05.htm": // high_prefect_cional007fb
  78. case "30508-06.htm": // high_prefect_cional003m
  79. case "30508-07.htm": // high_prefect_cional006ma
  80. case "30508-08.htm": // high_prefect_cional007ma
  81. case "32097-01.htm": // high_prefect_finker003f
  82. case "32097-02.htm": // high_prefect_finker006fa
  83. case "32097-03.htm": // high_prefect_finker007fa
  84. case "32097-04.htm": // high_prefect_finker006fb
  85. case "32097-05.htm": // high_prefect_finker007fb
  86. case "32097-06.htm": // high_prefect_finker003m
  87. case "32097-07.htm": // high_prefect_finker006ma
  88. case "32097-08.htm": // high_prefect_finker007ma
  89. {
  90. htmltext = event;
  91. break;
  92. }
  93. case "45":
  94. case "47":
  95. case "50":
  96. {
  97. htmltext = ClassChangeRequested(player, npc, Integer.valueOf(event));
  98. break;
  99. }
  100. }
  101. return htmltext;
  102. }
  103. private String ClassChangeRequested(L2PcInstance player, L2Npc npc, int classId)
  104. {
  105. String htmltext = null;
  106. if (player.isInCategory(CategoryType.SECOND_CLASS_GROUP))
  107. {
  108. htmltext = npc.getId() + "-09.htm"; // fnYouAreSecondClass
  109. }
  110. else if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP))
  111. {
  112. htmltext = npc.getId() + "-10.htm"; // fnYouAreThirdClass
  113. }
  114. else if (player.isInCategory(CategoryType.FOURTH_CLASS_GROUP))
  115. {
  116. htmltext = "30500-24.htm"; // fnYouAreFourthClass
  117. }
  118. else if ((classId == 45) && (player.getClassId() == ClassId.orcFighter))
  119. {
  120. if (player.getLevel() < 20)
  121. {
  122. if (hasQuestItems(player, MARK_OF_RAIDER))
  123. {
  124. htmltext = npc.getId() + "-11.htm"; // fnLowLevel11
  125. }
  126. else
  127. {
  128. htmltext = npc.getId() + "-12.htm"; // fnLowLevelNoProof11
  129. }
  130. }
  131. else if (hasQuestItems(player, MARK_OF_RAIDER))
  132. {
  133. takeItems(player, MARK_OF_RAIDER, -1);
  134. player.setClassId(45);
  135. player.setBaseClass(45);
  136. // SystemMessage and cast skill is done by setClassId
  137. player.broadcastUserInfo();
  138. giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_D_GRADE, 15);
  139. htmltext = npc.getId() + "-14.htm"; // fnAfterClassChange11
  140. }
  141. else
  142. {
  143. htmltext = npc.getId() + "-13.htm"; // fnNoProof11
  144. }
  145. }
  146. else if ((classId == 47) && (player.getClassId() == ClassId.orcFighter))
  147. {
  148. if (player.getLevel() < 20)
  149. {
  150. if (hasQuestItems(player, KHAVATARI_TOTEM))
  151. {
  152. htmltext = npc.getId() + "-15.htm"; // fnLowLevel12
  153. }
  154. else
  155. {
  156. htmltext = npc.getId() + "-16.htm"; // fnLowLevelNoProof12
  157. }
  158. }
  159. else if (hasQuestItems(player, KHAVATARI_TOTEM))
  160. {
  161. takeItems(player, KHAVATARI_TOTEM, -1);
  162. player.setClassId(47);
  163. player.setBaseClass(47);
  164. // SystemMessage and cast skill is done by setClassId
  165. player.broadcastUserInfo();
  166. giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_D_GRADE, 15);
  167. htmltext = npc.getId() + "-18.htm"; // fnAfterClassChange12
  168. }
  169. else
  170. {
  171. htmltext = npc.getId() + "-17.htm"; // fnNoProof12
  172. }
  173. }
  174. else if ((classId == 50) && (player.getClassId() == ClassId.orcMage))
  175. {
  176. if (player.getLevel() < 20)
  177. {
  178. if (hasQuestItems(player, MASK_OF_MEDIUM))
  179. {
  180. htmltext = npc.getId() + "-19.htm"; // fnLowLevel21
  181. }
  182. else
  183. {
  184. htmltext = npc.getId() + "-20.htm"; // fnLowLevelNoProof21
  185. }
  186. }
  187. else if (hasQuestItems(player, MASK_OF_MEDIUM))
  188. {
  189. takeItems(player, MASK_OF_MEDIUM, -1);
  190. player.setClassId(50);
  191. player.setBaseClass(50);
  192. // SystemMessage and cast skill is done by setClassId
  193. player.broadcastUserInfo();
  194. giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_D_GRADE, 15);
  195. htmltext = npc.getId() + "-22.htm"; // fnAfterClassChange21
  196. }
  197. else
  198. {
  199. htmltext = npc.getId() + "-21.htm"; // fnNoProof21
  200. }
  201. }
  202. return htmltext;
  203. }
  204. @Override
  205. public String onTalk(L2Npc npc, L2PcInstance player)
  206. {
  207. String htmltext = null;
  208. if (player.getRace() == Race.ORC)
  209. {
  210. if (player.isInCategory(CategoryType.FIGHTER_GROUP))
  211. {
  212. htmltext = npc.getId() + "-01.htm"; // fnClassList1
  213. }
  214. else if (player.isInCategory(CategoryType.MAGE_GROUP))
  215. {
  216. htmltext = npc.getId() + "-06.htm"; // fnClassList2
  217. }
  218. }
  219. else
  220. {
  221. htmltext = npc.getId() + "-23.htm"; // fnClassMismatch
  222. }
  223. return htmltext;
  224. }
  225. public static void main(String[] args)
  226. {
  227. new OrcChange1();
  228. }
  229. }