DwarfWarehouseChange2.java 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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.DwarfWarehouseChange2;
  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. * Dwarf class transfer AI.
  27. * @author Adry_85
  28. */
  29. public final class DwarfWarehouseChange2 extends AbstractNpcAI
  30. {
  31. // NPCs
  32. private static int[] NPCS =
  33. {
  34. 30511, // Gesto
  35. 30676, // Croop
  36. 30685, // Baxt
  37. 30845, // Klump
  38. 30894, // Natools
  39. 31269, // Mona
  40. 31314, // Donal
  41. 31958, // Yasheni
  42. };
  43. // Items
  44. private static final int SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE = 8870;
  45. private static final int MARK_OF_SEARCHER = 2809; // proof11z
  46. private static final int MARK_OF_GUILDSMAN = 3119; // proof11x
  47. private static final int MARK_OF_PROSPERITY = 3238; // proof11y
  48. // Class
  49. private static final int BOUNTY_HUNTER = 55;
  50. private DwarfWarehouseChange2()
  51. {
  52. super(DwarfWarehouseChange2.class.getSimpleName(), "village_master");
  53. addStartNpc(NPCS);
  54. addTalkId(NPCS);
  55. }
  56. @Override
  57. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  58. {
  59. String htmltext = null;
  60. switch (event)
  61. {
  62. case "30511-03.htm": // master_lv3_ware006fa
  63. case "30511-04.htm": // master_lv3_ware007fa
  64. case "30511-05.htm": // master_lv3_ware007fat
  65. {
  66. htmltext = event;
  67. break;
  68. }
  69. case "55":
  70. {
  71. htmltext = ClassChangeRequested(player, Integer.valueOf(event));
  72. break;
  73. }
  74. }
  75. return htmltext;
  76. }
  77. private String ClassChangeRequested(L2PcInstance player, int classId)
  78. {
  79. String htmltext = null;
  80. if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP))
  81. {
  82. htmltext = "30511-08.htm"; // fnYouAreThirdClass
  83. }
  84. else if ((classId == BOUNTY_HUNTER) && (player.getClassId() == ClassId.scavenger))
  85. {
  86. if (player.getLevel() < 40)
  87. {
  88. if (hasQuestItems(player, MARK_OF_GUILDSMAN, MARK_OF_PROSPERITY, MARK_OF_SEARCHER))
  89. {
  90. htmltext = "30511-09.htm"; // fnLowLevel11
  91. }
  92. else
  93. {
  94. htmltext = "30511-10.htm"; // fnLowLevelNoProof11
  95. }
  96. }
  97. else if (hasQuestItems(player, MARK_OF_GUILDSMAN, MARK_OF_PROSPERITY, MARK_OF_SEARCHER))
  98. {
  99. takeItems(player, -1, MARK_OF_GUILDSMAN, MARK_OF_PROSPERITY, MARK_OF_SEARCHER);
  100. player.setClassId(BOUNTY_HUNTER);
  101. player.setBaseClass(BOUNTY_HUNTER);
  102. // SystemMessage and cast skill is done by setClassId
  103. player.broadcastUserInfo();
  104. giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_C_GRADE, 15);
  105. htmltext = "30511-11.htm"; // fnAfterClassChange11
  106. }
  107. else
  108. {
  109. htmltext = "30511-12.htm"; // fnNoProof11
  110. }
  111. }
  112. return htmltext;
  113. }
  114. @Override
  115. public String onTalk(L2Npc npc, L2PcInstance player)
  116. {
  117. String htmltext = null;
  118. if (player.isInCategory(CategoryType.FOURTH_CLASS_GROUP) && player.isInCategory(CategoryType.BOUNTY_HUNTER_GROUP))
  119. {
  120. htmltext = "30511-01.htm"; // fnYouAreFourthClass
  121. }
  122. else if (player.isInCategory(CategoryType.BOUNTY_HUNTER_GROUP))
  123. {
  124. final ClassId classId = player.getClassId();
  125. if ((classId == ClassId.scavenger) || (classId == ClassId.bountyHunter))
  126. {
  127. htmltext = "30511-02.htm"; // fnClassList1
  128. }
  129. else
  130. {
  131. htmltext = "30511-06.htm"; // fnYouAreFirstClass
  132. }
  133. }
  134. else
  135. {
  136. htmltext = "30511-07.htm"; // fnClassMismatch
  137. }
  138. return htmltext;
  139. }
  140. public static void main(String[] args)
  141. {
  142. new DwarfWarehouseChange2();
  143. }
  144. }