DwarfWarehouseChange1.java 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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.DwarfWarehouseChange1;
  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 DwarfWarehouseChange1 extends AbstractNpcAI
  30. {
  31. // NPCs
  32. private static int[] NPCS =
  33. {
  34. 30498, // Moke
  35. 30503, // Rikadio
  36. 30594, // Ranspo
  37. 32092, // Alder
  38. };
  39. // Items
  40. private static final int SHADOW_ITEM_EXCHANGE_COUPON_D_GRADE = 8869;
  41. private static final int RING_OF_RAVEN = 1642;
  42. // Class
  43. private static final int SCAVENGER = 54;
  44. private DwarfWarehouseChange1()
  45. {
  46. super(DwarfWarehouseChange1.class.getSimpleName(), "village_master");
  47. addStartNpc(NPCS);
  48. addTalkId(NPCS);
  49. }
  50. @Override
  51. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  52. {
  53. String htmltext = null;
  54. switch (event)
  55. {
  56. case "30498-01.htm": // warehouse_chief_moke003f
  57. case "30498-02.htm": // warehouse_chief_moke006fa
  58. case "30498-03.htm": // warehouse_chief_moke007fa
  59. case "30498-04.htm": // warehouse_chief_moke006fb
  60. case "30503-01.htm": // warehouse_chief_rikadio003f
  61. case "30503-02.htm": // warehouse_chief_rikadio006fa
  62. case "30503-03.htm": // warehouse_chief_rikadio007fa
  63. case "30503-04.htm": // warehouse_chief_rikadio006fb
  64. case "30594-01.htm": // warehouse_chief_ranspo003f
  65. case "30594-02.htm": // warehouse_chief_ranspo006fa
  66. case "30594-03.htm": // warehouse_chief_ranspo007fa
  67. case "30594-04.htm": // warehouse_chief_ranspo006fb
  68. case "32092-01.htm": // warehouse_chief_older003f
  69. case "32092-02.htm": // warehouse_chief_older006fa
  70. case "32092-03.htm": // warehouse_chief_older007fa
  71. case "32092-04.htm": // warehouse_chief_older006fb
  72. {
  73. htmltext = event;
  74. break;
  75. }
  76. case "54":
  77. {
  78. htmltext = ClassChangeRequested(player, npc, Integer.valueOf(event));
  79. break;
  80. }
  81. }
  82. return htmltext;
  83. }
  84. private String ClassChangeRequested(L2PcInstance player, L2Npc npc, int classId)
  85. {
  86. String htmltext = null;
  87. if (player.isInCategory(CategoryType.SECOND_CLASS_GROUP))
  88. {
  89. htmltext = npc.getId() + "-06.htm"; // fnYouAreSecondClass
  90. }
  91. else if (player.isInCategory(CategoryType.THIRD_CLASS_GROUP))
  92. {
  93. htmltext = npc.getId() + "-07.htm"; // fnYouAreThirdClass
  94. }
  95. else if (player.isInCategory(CategoryType.FOURTH_CLASS_GROUP))
  96. {
  97. htmltext = "30498-12.htm"; // fnYouAreFourthClass
  98. }
  99. else if ((classId == SCAVENGER) && (player.getClassId() == ClassId.dwarvenFighter))
  100. {
  101. if (player.getLevel() < 20)
  102. {
  103. if (hasQuestItems(player, RING_OF_RAVEN))
  104. {
  105. htmltext = npc.getId() + "-08.htm"; // fnLowLevel11
  106. }
  107. else
  108. {
  109. htmltext = npc.getId() + "-09.htm"; // fnLowLevelNoProof11
  110. }
  111. }
  112. else if (hasQuestItems(player, RING_OF_RAVEN))
  113. {
  114. takeItems(player, RING_OF_RAVEN, -1);
  115. player.setClassId(SCAVENGER);
  116. player.setBaseClass(SCAVENGER);
  117. // SystemMessage and cast skill is done by setClassId
  118. player.broadcastUserInfo();
  119. giveItems(player, SHADOW_ITEM_EXCHANGE_COUPON_D_GRADE, 15);
  120. htmltext = npc.getId() + "-10.htm"; // fnAfterClassChange11
  121. }
  122. else
  123. {
  124. htmltext = npc.getId() + "-11.htm"; // fnNoProof11
  125. }
  126. }
  127. return htmltext;
  128. }
  129. @Override
  130. public String onTalk(L2Npc npc, L2PcInstance player)
  131. {
  132. String htmltext = null;
  133. if (player.isInCategory(CategoryType.BOUNTY_HUNTER_GROUP))
  134. {
  135. htmltext = npc.getId() + "-01.htm"; // fnClassList1
  136. }
  137. else
  138. {
  139. htmltext = npc.getId() + "-05.htm"; // fnClassMismatch
  140. }
  141. return htmltext;
  142. }
  143. public static void main(String[] args)
  144. {
  145. new DwarfWarehouseChange1();
  146. }
  147. }