RaidbossInfo.java 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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 custom.RaidbossInfo;
  20. import java.util.ArrayList;
  21. import java.util.List;
  22. import com.l2jserver.gameserver.data.xml.impl.NpcData;
  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.util.Util;
  31. /**
  32. * Raidboss Info AI.<br>
  33. * Original Jython script Kerberos.
  34. * @author Nyaran
  35. */
  36. public final class RaidbossInfo extends Quest
  37. {
  38. // @formatter:off
  39. private static final int[] NPC =
  40. {
  41. 31729, 31730, 31731, 31732, 31733, 31734, 31735, 31736, 31737, 31738,
  42. 31739, 31740, 31741, 31742, 31743, 31744, 31745, 31746, 31747, 31748,
  43. 31749, 31750, 31751, 31752, 31753, 31754, 31755, 31756, 31757, 31758,
  44. 31759, 31760, 31761, 31762, 31763, 31764, 31765, 31766, 31767, 31768,
  45. 31769, 31770, 31771, 31772, 31773, 31774, 31775, 31776, 31777, 31778,
  46. 31779, 31780, 31781, 31782, 31783, 31784, 31785, 31786, 31787, 31788,
  47. 31789, 31790, 31791, 31792, 31793, 31794, 31795, 31796, 31797, 31798,
  48. 31799, 31800, 31801, 31802, 31803, 31804, 31805, 31806, 31807, 31808,
  49. 31809, 31810, 31811, 31812, 31813, 31814, 31815, 31816, 31817, 31818,
  50. 31819, 31820, 31821, 31822, 31823, 31824, 31825, 31826, 31827, 31828,
  51. 31829, 31830, 31831, 31832, 31833, 31834, 31835, 31836, 31837, 31838,
  52. 31839, 31840, 31841, 32337, 32338, 32339, 32340
  53. };
  54. // @formatter:on
  55. private static final List<Integer> RAIDS = new ArrayList<>();
  56. private RaidbossInfo()
  57. {
  58. super(-1, RaidbossInfo.class.getSimpleName(), "custom");
  59. addStartNpc(NPC);
  60. addTalkId(NPC);
  61. // Add all Raid Bosses to RAIDS list
  62. for (L2NpcTemplate raid : NpcData.getInstance().getAllNpcOfClassType("L2RaidBoss"))
  63. {
  64. RAIDS.add(raid.getId());
  65. }
  66. }
  67. @Override
  68. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  69. {
  70. String htmltext = event;
  71. if (Util.isDigit(event))
  72. {
  73. htmltext = null;
  74. int bossId = Integer.parseInt(event);
  75. if (RAIDS.contains(bossId))
  76. {
  77. final L2Spawn spawn = SpawnTable.getInstance().findAny(bossId);
  78. if (spawn != null)
  79. {
  80. final Location loc = spawn.getLocation();
  81. player.getRadar().addMarker(loc.getX(), loc.getY(), loc.getZ());
  82. }
  83. }
  84. }
  85. return htmltext;
  86. }
  87. @Override
  88. public String onTalk(L2Npc npc, L2PcInstance player)
  89. {
  90. return "info.htm";
  91. }
  92. public static void main(String args[])
  93. {
  94. new RaidbossInfo();
  95. }
  96. }