Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
- package ai.group_template;
- import com.l2jserver.gameserver.Announcements;
- import com.l2jserver.gameserver.ThreadPoolManager;
- import com.l2jserver.gameserver.model.actor.L2Npc;
- import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
- import com.l2jserver.util.Rnd;
- public class customRaidbossIce extends L2AttackableAIScript
- {
- private static final int[] _RBs = {
- //TODO: some fucking IDs here
- 20432, 20432 };
- private static final int[][] _spawns = {
- { -55412, 190338, -4479 },
- { -57461, 190726, -4514 },
- { -57422, 188278, -4497 },
- { -60402, 188281, -4513 },
- { -54423, 188276, -4513 },
- { -58771, 186106, -4520 },
- { -55680, 185735, -4514 },
- { -59078, 185308, -4520 },
- { -57826, 183529, -4514 },
- { -56410, 184454, -4514 },
- { -55784, 180628, -4520 },
- { -54890, 185204, -4520 },
- { -54977, 180649, -4520 }
- };
- private static L2Npc _currentSpawn;
- private static int _currentSpawnLoc = 0;
- private static long _lastAttackTime = 0;
- public customRaidbossIce(int questId, String name, String descr)
- {
- super(questId, name, descr);
- for (int id : _RBs)
- {
- addAttackId(id);
- addSpawnId(id);
- addKillId(id);
- }
- _currentSpawnLoc = Rnd.get(0, _spawns.length - 1);
- _currentSpawn = addSpawn(_RBs[Rnd.get(_RBs.length)], _spawns[_currentSpawnLoc][0], _spawns[_currentSpawnLoc][1], _spawns[_currentSpawnLoc][2], 0, false, 0);
- ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable()
- {
- public void run()
- {
- if ((System.currentTimeMillis() - _lastAttackTime) > 600000)
- {
- respawn();
- }
- }
- }, 10, 1000);
- }
- @Override
- public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isPet)
- {
- _lastAttackTime = System.currentTimeMillis();
- return super.onAttack(npc, player, damage, isPet);
- }
- @Override
- public String onKill(L2Npc npc, L2PcInstance killer, boolean isPet)
- {
- Announcements.getInstance().announceToAll("Raidboss " + npc.getName() + " was killed by " + killer.getName());
- _lastAttackTime = (System.currentTimeMillis() + 3600000);
- return super.onKill(npc, killer, isPet);
- }
- @Override
- public String onSpawn(L2Npc npc)
- {
- _lastAttackTime = System.currentTimeMillis();
- Announcements.getInstance().announceToAll("Raidboss in Fire Temple was spawned.");
- return super.onSpawn(npc);
- }
- private void respawn()
- {
- _currentSpawn.deleteMe();
- _currentSpawnLoc = Rnd.get(0, _spawns.length - 1);
- _currentSpawn = addSpawn(_RBs[Rnd.get(_RBs.length)], _spawns[_currentSpawnLoc][0], _spawns[_currentSpawnLoc][1], _spawns[_currentSpawnLoc][2], 0, false, 0);
- }
- public static void main(String[] args)
- {
- new customRaidbossIce(-1, "customRaidbossIce", "ai");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement