Advertisement
horato

Raidbosses

Jun 16th, 2011
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.92 KB | None | 0 0
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package ai.group_template;
  16.  
  17. import java.util.concurrent.ScheduledFuture;
  18.  
  19. import com.l2jserver.gameserver.Announcements;
  20. import com.l2jserver.gameserver.ThreadPoolManager;
  21. import com.l2jserver.gameserver.model.actor.L2Npc;
  22. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  23. import com.l2jserver.util.Rnd;
  24.  
  25. public class customRaidboss extends L2AttackableAIScript
  26. {
  27. private static final int[] _RBs = {
  28. //TODO: some fucking IDs here
  29. 20432, 20432 };
  30. private static final int[][] _spawns = {
  31. //TODO: Some spawns here
  32. { 83421, 148551, -3408 }, { 83300, 148551, -3408 } };
  33. private static L2Npc _currentSpawn;
  34. private static int _currentSpawnLoc = 0;
  35. private static long _lastAttackTime = 0;
  36.  
  37. public customRaidboss(int questId, String name, String descr)
  38. {
  39. super(questId, name, descr);
  40. // for (int id : _RBs)
  41. // {
  42. addAttackId(20432);
  43. addSpawnId(20432);
  44. addKillId(20432);
  45. // }
  46. _currentSpawn = addSpawn(20432, _spawns[0][0], _spawns[0][1], _spawns[0][2], 0, false, 0);
  47. ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable()
  48. {
  49. public void run()
  50. {
  51. if ((System.currentTimeMillis() - _lastAttackTime) > 0.1)
  52. {
  53. respawn();
  54. }
  55. }
  56. }, 10, 10 * 1000);
  57.  
  58. }
  59.  
  60. @Override
  61. public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isPet)
  62. {
  63. _lastAttackTime = System.currentTimeMillis();
  64. return super.onAttack(npc, player, damage, isPet);
  65. }
  66.  
  67. @Override
  68. public String onKill(L2Npc npc, L2PcInstance killer, boolean isPet)
  69. {
  70. Announcements.getInstance().announceToAll("Raidboss " + npc.getName() + " was killed by " + killer.getName());
  71. _lastAttackTime = System.currentTimeMillis();
  72. return super.onKill(npc, killer, isPet);
  73. }
  74.  
  75. @Override
  76. public String onSpawn(L2Npc npc)
  77. {
  78. Announcements.getInstance().announceToAll("Raidboss " + npc.getName() + " was spawned.");
  79. return super.onSpawn(npc);
  80. }
  81.  
  82. private void respawn()
  83. {
  84. _currentSpawn.deleteMe();
  85. _currentSpawn = addSpawn(20432, _spawns[0][0], _spawns[0][1], _spawns[0][2], 0, false, 0);
  86. }
  87.  
  88. public static void main(String[] args)
  89. {
  90. System.out.println("prdel");
  91. Announcements.getInstance().announceToAll("prdel");
  92. new customRaidboss(-1, "customRaidboss", "ai");
  93. }
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement