RaidbossInfo.java 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. /*
  2. * Copyright (C) 2004-2013 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 custom.RaidbossInfo;
  20. import java.util.Map;
  21. import javolution.util.FastMap;
  22. import com.l2jserver.gameserver.datatables.NpcTable;
  23. import com.l2jserver.gameserver.datatables.SpawnTable;
  24. import com.l2jserver.gameserver.model.L2Spawn;
  25. import com.l2jserver.gameserver.model.Location;
  26. import com.l2jserver.gameserver.model.actor.L2Npc;
  27. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  28. import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
  29. import com.l2jserver.gameserver.model.quest.Quest;
  30. import com.l2jserver.gameserver.model.quest.QuestState;
  31. import com.l2jserver.gameserver.util.Util;
  32. /**
  33. * Raidboss Info AI.<br>
  34. * Original Jython script Kerberos.
  35. * @author Nyaran
  36. */
  37. public class RaidbossInfo extends Quest
  38. {
  39. private static final String qn = "RaidbossInfo";
  40. private static final int[] NPC =
  41. {
  42. 31729,
  43. 31730,
  44. 31731,
  45. 31732,
  46. 31733,
  47. 31734,
  48. 31735,
  49. 31736,
  50. 31737,
  51. 31738,
  52. 31739,
  53. 31740,
  54. 31741,
  55. 31742,
  56. 31743,
  57. 31744,
  58. 31745,
  59. 31746,
  60. 31747,
  61. 31748,
  62. 31749,
  63. 31750,
  64. 31751,
  65. 31752,
  66. 31753,
  67. 31754,
  68. 31755,
  69. 31756,
  70. 31757,
  71. 31758,
  72. 31759,
  73. 31760,
  74. 31761,
  75. 31762,
  76. 31763,
  77. 31764,
  78. 31765,
  79. 31766,
  80. 31767,
  81. 31768,
  82. 31769,
  83. 31770,
  84. 31771,
  85. 31772,
  86. 31773,
  87. 31774,
  88. 31775,
  89. 31776,
  90. 31777,
  91. 31778,
  92. 31779,
  93. 31780,
  94. 31781,
  95. 31782,
  96. 31783,
  97. 31784,
  98. 31785,
  99. 31786,
  100. 31787,
  101. 31788,
  102. 31789,
  103. 31790,
  104. 31791,
  105. 31792,
  106. 31793,
  107. 31794,
  108. 31795,
  109. 31796,
  110. 31797,
  111. 31798,
  112. 31799,
  113. 31800,
  114. 31801,
  115. 31802,
  116. 31803,
  117. 31804,
  118. 31805,
  119. 31806,
  120. 31807,
  121. 31808,
  122. 31809,
  123. 31810,
  124. 31811,
  125. 31812,
  126. 31813,
  127. 31814,
  128. 31815,
  129. 31816,
  130. 31817,
  131. 31818,
  132. 31819,
  133. 31820,
  134. 31821,
  135. 31822,
  136. 31823,
  137. 31824,
  138. 31825,
  139. 31826,
  140. 31827,
  141. 31828,
  142. 31829,
  143. 31830,
  144. 31831,
  145. 31832,
  146. 31833,
  147. 31834,
  148. 31835,
  149. 31836,
  150. 31837,
  151. 31838,
  152. 31839,
  153. 31840,
  154. 31841,
  155. 32337,
  156. 32338,
  157. 32339,
  158. 32340
  159. };
  160. private static final Map<Integer, Location> RADAR = new FastMap<>();
  161. @Override
  162. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  163. {
  164. String htmltext = event;
  165. QuestState st = player.getQuestState(qn);
  166. if (st == null)
  167. {
  168. return htmltext;
  169. }
  170. if (Util.isDigit(event))
  171. {
  172. htmltext = null;
  173. int rbid = Integer.parseInt(event);
  174. if (RADAR.containsKey(rbid))
  175. {
  176. Location loc = RADAR.get(rbid);
  177. st.addRadar(loc.getX(), loc.getY(), loc.getZ());
  178. }
  179. st.exitQuest(true);
  180. }
  181. return htmltext;
  182. }
  183. @Override
  184. public String onTalk(L2Npc npc, L2PcInstance player)
  185. {
  186. return "info.htm";
  187. }
  188. public RaidbossInfo(int id, String name, String descr)
  189. {
  190. super(id, name, descr);
  191. addStartNpc(NPC);
  192. addTalkId(NPC);
  193. // Add all Raid Bosses to RAIDS list
  194. for (L2NpcTemplate raid : NpcTable.getInstance().getAllNpcOfClassType("L2RaidBoss"))
  195. {
  196. final L2Spawn spawn = SpawnTable.getInstance().getFirstSpawn(raid.getId());
  197. RADAR.put(raid.getId(), spawn != null ? spawn.getLocation() : new Location(0, 0, 0));
  198. }
  199. }
  200. public static void main(String args[])
  201. {
  202. new RaidbossInfo(-1, qn, "custom");
  203. }
  204. }