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 java.util.concurrent.ScheduledFuture;
- 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 customRaidboss extends L2AttackableAIScript
- {
- private static final int[] _RBs = {
- //TODO: some fucking IDs here
- 20432, 20432 };
- private static final int[][] _spawns = {
- //TODO: Some spawns here
- { 83421, 148551, -3408 }, { 83300, 148551, -3408 } };
- private static L2Npc _currentSpawn;
- private static int _currentSpawnLoc = 0;
- private static long _lastAttackTime = 0;
- public customRaidboss(int questId, String name, String descr)
- {
- super(questId, name, descr);
- // for (int id : _RBs)
- // {
- addAttackId(20432);
- addSpawnId(20432);
- addKillId(20432);
- // }
- _currentSpawn = addSpawn(20432, _spawns[0][0], _spawns[0][1], _spawns[0][2], 0, false, 0);
- ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable()
- {
- public void run()
- {
- if ((System.currentTimeMillis() - _lastAttackTime) > 0.1)
- {
- respawn();
- }
- }
- }, 10, 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();
- return super.onKill(npc, killer, isPet);
- }
- @Override
- public String onSpawn(L2Npc npc)
- {
- Announcements.getInstance().announceToAll("Raidboss " + npc.getName() + " was spawned.");
- return super.onSpawn(npc);
- }
- private void respawn()
- {
- _currentSpawn.deleteMe();
- _currentSpawn = addSpawn(20432, _spawns[0][0], _spawns[0][1], _spawns[0][2], 0, false, 0);
- }
- public static void main(String[] args)
- {
- System.out.println("prdel");
- Announcements.getInstance().announceToAll("prdel");
- new customRaidboss(-1, "customRaidboss", "ai");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement