Advertisement
horato

Raidbosses

Jun 17th, 2011
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.38 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 com.l2jserver.gameserver.Announcements;
  18. import com.l2jserver.gameserver.ThreadPoolManager;
  19. import com.l2jserver.gameserver.model.actor.L2Npc;
  20. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  21. import com.l2jserver.util.Rnd;
  22.  
  23. public class customRaidbossIce extends L2AttackableAIScript
  24. {
  25. private static final int[] _RBs = {
  26. //TODO: some fucking IDs here
  27. 20432, 20432 };
  28. private static final int[][] _spawns = {
  29. { -55412, 190338, -4479 },
  30. { -57461, 190726, -4514 },
  31. { -57422, 188278, -4497 },
  32. { -60402, 188281, -4513 },
  33. { -54423, 188276, -4513 },
  34. { -58771, 186106, -4520 },
  35. { -55680, 185735, -4514 },
  36. { -59078, 185308, -4520 },
  37. { -57826, 183529, -4514 },
  38. { -56410, 184454, -4514 },
  39. { -55784, 180628, -4520 },
  40. { -54890, 185204, -4520 },
  41. { -54977, 180649, -4520 }
  42. };
  43. private static L2Npc _currentSpawn;
  44. private static int _currentSpawnLoc = 0;
  45. private static long _lastAttackTime = 0;
  46.  
  47. public customRaidbossIce(int questId, String name, String descr)
  48. {
  49. super(questId, name, descr);
  50. for (int id : _RBs)
  51. {
  52. addAttackId(id);
  53. addSpawnId(id);
  54. addKillId(id);
  55. }
  56. _currentSpawnLoc = Rnd.get(0, _spawns.length - 1);
  57.  
  58. _currentSpawn = addSpawn(_RBs[Rnd.get(_RBs.length)], _spawns[_currentSpawnLoc][0], _spawns[_currentSpawnLoc][1], _spawns[_currentSpawnLoc][2], 0, false, 0);
  59. ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable()
  60. {
  61. public void run()
  62. {
  63. if ((System.currentTimeMillis() - _lastAttackTime) > 600000)
  64. {
  65. respawn();
  66. }
  67. }
  68. }, 10, 1000);
  69.  
  70. }
  71.  
  72. @Override
  73. public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isPet)
  74. {
  75. _lastAttackTime = System.currentTimeMillis();
  76. return super.onAttack(npc, player, damage, isPet);
  77. }
  78.  
  79. @Override
  80. public String onKill(L2Npc npc, L2PcInstance killer, boolean isPet)
  81. {
  82. Announcements.getInstance().announceToAll("Raidboss " + npc.getName() + " was killed by " + killer.getName());
  83. _lastAttackTime = (System.currentTimeMillis() + 3600000);
  84. return super.onKill(npc, killer, isPet);
  85. }
  86.  
  87. @Override
  88. public String onSpawn(L2Npc npc)
  89. {
  90. _lastAttackTime = System.currentTimeMillis();
  91. Announcements.getInstance().announceToAll("Raidboss in Fire Temple was spawned.");
  92. return super.onSpawn(npc);
  93. }
  94.  
  95. private void respawn()
  96. {
  97. _currentSpawn.deleteMe();
  98. _currentSpawnLoc = Rnd.get(0, _spawns.length - 1);
  99. _currentSpawn = addSpawn(_RBs[Rnd.get(_RBs.length)], _spawns[_currentSpawnLoc][0], _spawns[_currentSpawnLoc][1], _spawns[_currentSpawnLoc][2], 0, false, 0);
  100. }
  101.  
  102. public static void main(String[] args)
  103. {
  104. new customRaidbossIce(-1, "customRaidbossIce", "ai");
  105. }
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement