Jump to content
  • 0

Change Required Amount Of Players For Grandbosses/instances


Question

Posted

Where do I need to go in my files to change these values?

For example I want to set up that you need atleast 5 people to join Valakas/Antharas/Zaken.

I want that people can teleport into a instance alone.

For example seed of destruction. Does someone knows how I can edit these values?

Cause I will need like 20+ people for Valakas or Antharas right now

11 answers to this question

Recommended Posts

  • 0
Posted

Where do I need to go in my files to change these values?

For example I want to set up that you need atleast 5 people to join Valakas/Antharas/Zaken.

I want that people can teleport into a instance alone.

For example seed of destruction. Does someone knows how I can edit these values?

Cause I will need like 20+ people for Valakas or Antharas right now

go to game/data/scripts/ai/individual and here are all java files from bosses. so here you find that of you search

 

p.s that directory is from freya pack i dont know what pack you use but all that files are in scripts

  • 0
Posted

For example here is the antharas script, I dont know which value to edit...

/*
 * Copyright (C) 2004-2013 L2J DataPack
 * 
 * This file is part of L2J DataPack.
 * 
 * L2J DataPack 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.
 * 
 * L2J DataPack 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.individual;


import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ScheduledFuture;


import javolution.util.FastList;
import javolution.util.FastMap;
import ai.npc.AbstractNpcAI;


import com.l2jserver.Config;
import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.datatables.NpcTable;
import com.l2jserver.gameserver.datatables.SkillTable;
import com.l2jserver.gameserver.datatables.SpawnTable;
import com.l2jserver.gameserver.instancemanager.GrandBossManager;
import com.l2jserver.gameserver.model.L2CharPosition;
import com.l2jserver.gameserver.model.L2Spawn;
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2GrandBossInstance;
import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jserver.gameserver.model.skills.L2Skill;
import com.l2jserver.gameserver.model.zone.type.L2BossZone;
import com.l2jserver.gameserver.network.serverpackets.Earthquake;
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
import com.l2jserver.gameserver.network.serverpackets.PlaySound;
import com.l2jserver.gameserver.network.serverpackets.SpecialCamera;


/**
 * Antharas' AI.
 * @author L2J_JP SANDMAN
 */
public class Antharas extends AbstractNpcAI
{
// config
private static final int FWA_ACTIVITYTIMEOFANTHARAS = 120;
// private static final int FWA_APPTIMEOFANTHARAS = 1800000;
private static final int FWA_INACTIVITYTIME = 900000;
private static final boolean FWA_OLDANTHARAS = false;
private static final boolean FWA_MOVEATRANDOM = true;
private static final boolean FWA_DOSERVEREARTHQUAKE = true;
private static final int FWA_LIMITOFWEAK = 45;
private static final int FWA_LIMITOFNORMAL = 63;
private static final int FWA_MAXMOBS = 10; // this includes Antharas itself
private static final int FWA_INTERVALOFMOBSWEAK = 180000;
private static final int FWA_INTERVALOFMOBSNORMAL = 150000;
private static final int FWA_INTERVALOFMOBSSTRONG = 120000;
private static final int FWA_PERCENTOFBEHEMOTH = 60;
private static final int FWA_SELFDESTRUCTTIME = 15000;
// Location of teleport cube.
private final int _teleportCubeId = 31859;
private final int _teleportCubeLocation[][] =
{
{
177615,
114941,
-7709,
0
}
};


protected List<L2Spawn> _teleportCubeSpawn = new FastList<>();
protected List<L2Npc> _teleportCube = new FastList<>();
// Spawn data of monsters.
protected Map<Integer, L2Spawn> _monsterSpawn = new FastMap<>();
// Instance of monsters.
protected List<L2Npc> _monsters = new FastList<>();
protected L2GrandBossInstance _antharas = null;
// Antharas Ids
private static final int ANTHARAS_OLD_ID = 29019;
private static final int ANTHARAS_WEAK_ID = 29066;
private static final int ANTHARAS_NORMAL_ID = 29067;
private static final int ANTHARAS_STRONG_ID = 29068;
// Tasks.
protected ScheduledFuture<?> _cubeSpawnTask = null;
protected ScheduledFuture<?> _monsterSpawnTask = null;
protected ScheduledFuture<?> _activityCheckTask = null;
protected ScheduledFuture<?> _socialTask = null;
protected ScheduledFuture<?> _mobiliseTask = null;
protected ScheduledFuture<?> _mobsSpawnTask = null;
protected ScheduledFuture<?> _selfDestructionTask = null;
protected ScheduledFuture<?> _moveAtRandomTask = null;
protected ScheduledFuture<?> _movieTask = null;
// Antharas Status Tracking :
private static final byte DORMANT = 0; // Antharas is spawned and no one has entered yet. Entry is unlocked
private static final byte WAITING = 1; // Antharas is spawend and someone has entered, triggering a 30 minute window for additional people to enter
// before he unleashes his attack. Entry is unlocked
private static final byte FIGHTING = 2; // Antharas is engaged in battle, annihilating his foes. Entry is locked
private static final byte DEAD = 3; // Antharas has been killed. Entry is locked


protected static long _LastAction = 0;


protected static L2BossZone _Zone;


private Antharas(String name, String descr)
{
super(name, descr);
registerMobs(ANTHARAS_OLD_ID, ANTHARAS_WEAK_ID, ANTHARAS_NORMAL_ID, ANTHARAS_STRONG_ID, 29069, 29070, 29071, 29072, 29073, 29074, 29075, 29076);
init();
}


// Initialize
private void init()
{
// Setting spawn data of monsters.
try
{
_Zone = GrandBossManager.getInstance().getZone(179700, 113800, -7709);
L2NpcTemplate template1;
L2Spawn tempSpawn;


// Old Antharas
template1 = NpcTable.getInstance().getTemplate(ANTHARAS_OLD_ID);
tempSpawn = new L2Spawn(template1);
tempSpawn.setLocx(181323);
tempSpawn.setLocy(114850);
tempSpawn.setLocz(-7623);
tempSpawn.setHeading(32542);
tempSpawn.setAmount(1);
tempSpawn.setRespawnDelay(FWA_ACTIVITYTIMEOFANTHARAS * 2);
SpawnTable.getInstance().addNewSpawn(tempSpawn, false);
_monsterSpawn.put(29019, tempSpawn);


// Weak Antharas
template1 = NpcTable.getInstance().getTemplate(ANTHARAS_WEAK_ID);
tempSpawn = new L2Spawn(template1);
tempSpawn.setLocx(181323);
tempSpawn.setLocy(114850);
tempSpawn.setLocz(-7623);
tempSpawn.setHeading(32542);
tempSpawn.setAmount(1);
tempSpawn.setRespawnDelay(FWA_ACTIVITYTIMEOFANTHARAS * 2);
SpawnTable.getInstance().addNewSpawn(tempSpawn, false);
_monsterSpawn.put(29066, tempSpawn);


// Normal Antharas
template1 = NpcTable.getInstance().getTemplate(ANTHARAS_NORMAL_ID);
tempSpawn = new L2Spawn(template1);
tempSpawn.setLocx(181323);
tempSpawn.setLocy(114850);
tempSpawn.setLocz(-7623);
tempSpawn.setHeading(32542);
tempSpawn.setAmount(1);
tempSpawn.setRespawnDelay(FWA_ACTIVITYTIMEOFANTHARAS * 2);
SpawnTable.getInstance().addNewSpawn(tempSpawn, false);
_monsterSpawn.put(29067, tempSpawn);


// Strong Antharas
template1 = NpcTable.getInstance().getTemplate(ANTHARAS_STRONG_ID);
tempSpawn = new L2Spawn(template1);
tempSpawn.setLocx(181323);
tempSpawn.setLocy(114850);
tempSpawn.setLocz(-7623);
tempSpawn.setHeading(32542);
tempSpawn.setAmount(1);
tempSpawn.setRespawnDelay(FWA_ACTIVITYTIMEOFANTHARAS * 2);
SpawnTable.getInstance().addNewSpawn(tempSpawn, false);
_monsterSpawn.put(29068, tempSpawn);
}
catch (Exception e)
{
_log.warning(e.getMessage());
}


// Setting spawn data of teleport cube.
try
{
L2NpcTemplate Cube = NpcTable.getInstance().getTemplate(_teleportCubeId);
L2Spawn spawnDat;
for (int[] element : _teleportCubeLocation)
{
spawnDat = new L2Spawn(Cube);
spawnDat.setAmount(1);
spawnDat.setLocx(element[0]);
spawnDat.setLocy(element[1]);
spawnDat.setLocz(element[2]);
spawnDat.setHeading(element[3]);
spawnDat.setRespawnDelay(60);
spawnDat.setLocation(0);
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
_teleportCubeSpawn.add(spawnDat);
}
}
catch (Exception e)
{
_log.warning(e.getMessage());
}
int status = GrandBossManager.getInstance().getBossStatus(ANTHARAS_OLD_ID);
if (FWA_OLDANTHARAS || (status == WAITING))
{
StatsSet info = GrandBossManager.getInstance().getStatsSet(ANTHARAS_OLD_ID);
Long respawnTime = info.getLong("respawn_time");
if ((status == DEAD) && (respawnTime <= System.currentTimeMillis()))
{
// the time has already expired while the server was offline. Immediately spawn antharas in his cave.
// also, the status needs to be changed to DORMANT
GrandBossManager.getInstance().setBossStatus(ANTHARAS_OLD_ID, DORMANT);
status = DORMANT;
}
else if (status == FIGHTING)
{
int loc_x = info.getInteger("loc_x");
int loc_y = info.getInteger("loc_y");
int loc_z = info.getInteger("loc_z");
int heading = info.getInteger("heading");
int hp = info.getInteger("currentHP");
int mp = info.getInteger("currentMP");
_antharas = (L2GrandBossInstance) addSpawn(ANTHARAS_OLD_ID, loc_x, loc_y, loc_z, heading, false, 0);
GrandBossManager.getInstance().addBoss(_antharas);
_antharas.setCurrentHpMp(hp, mp);
_LastAction = System.currentTimeMillis();
// Start repeating timer to check for inactivity
_activityCheckTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new CheckActivity(), 60000, 60000);
}
else if (status == DEAD)
{
ThreadPoolManager.getInstance().scheduleGeneral(new UnlockAntharas(ANTHARAS_OLD_ID), respawnTime - System.currentTimeMillis());
}
else
{
setAntharasSpawnTask();
}
}
else
{
int statusWeak = GrandBossManager.getInstance().getBossStatus(ANTHARAS_WEAK_ID);
int statusNormal = GrandBossManager.getInstance().getBossStatus(ANTHARAS_NORMAL_ID);
int statusStrong = GrandBossManager.getInstance().getBossStatus(ANTHARAS_STRONG_ID);
int antharasId = 0;
if ((statusWeak == FIGHTING) || (statusWeak == DEAD))
{
antharasId = ANTHARAS_WEAK_ID;
status = statusWeak;
}
else if ((statusNormal == FIGHTING) || (statusNormal == DEAD))
{
antharasId = ANTHARAS_NORMAL_ID;
status = statusNormal;
}
else if ((statusStrong == FIGHTING) || (statusStrong == DEAD))
{
antharasId = ANTHARAS_STRONG_ID;
status = statusStrong;
}
if ((antharasId != 0) && (status == FIGHTING))
{
StatsSet info = GrandBossManager.getInstance().getStatsSet(antharasId);
int loc_x = info.getInteger("loc_x");
int loc_y = info.getInteger("loc_y");
int loc_z = info.getInteger("loc_z");
int heading = info.getInteger("heading");
int hp = info.getInteger("currentHP");
int mp = info.getInteger("currentMP");
_antharas = (L2GrandBossInstance) addSpawn(antharasId, loc_x, loc_y, loc_z, heading, false, 0);
GrandBossManager.getInstance().addBoss(_antharas);
_antharas.setCurrentHpMp(hp, mp);
_LastAction = System.currentTimeMillis();
// Start repeating timer to check for inactivity
_activityCheckTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new CheckActivity(), 60000, 60000);
}
else if ((antharasId != 0) && (status == DEAD))
{
StatsSet info = GrandBossManager.getInstance().getStatsSet(antharasId);
Long respawnTime = info.getLong("respawn_time");
if (respawnTime <= System.currentTimeMillis())
{
// the time has already expired while the server was offline. Immediately spawn antharas in his cave.
// also, the status needs to be changed to DORMANT
GrandBossManager.getInstance().setBossStatus(antharasId, DORMANT);
status = DORMANT;
}
else
{
ThreadPoolManager.getInstance().scheduleGeneral(new UnlockAntharas(antharasId), respawnTime - System.currentTimeMillis());
}
}
}
}


// Do spawn teleport cube.
public void spawnCube()
{
if (_mobsSpawnTask != null)
{
_mobsSpawnTask.cancel(true);
_mobsSpawnTask = null;
}
if (_selfDestructionTask != null)
{
_selfDestructionTask.cancel(true);
_selfDestructionTask = null;
}
if (_activityCheckTask != null)
{
_activityCheckTask.cancel(false);
_activityCheckTask = null;
}


for (L2Spawn spawnDat : _teleportCubeSpawn)
{
_teleportCube.add(spawnDat.doSpawn());
}
}


// Setting Antharas spawn task.
public void setAntharasSpawnTask()
{
if (_monsterSpawnTask == null)
{
synchronized (this)
{
if (_monsterSpawnTask == null)
{
GrandBossManager.getInstance().setBossStatus(ANTHARAS_OLD_ID, WAITING);
_monsterSpawnTask = ThreadPoolManager.getInstance().scheduleGeneral(new AntharasSpawn(1), (Config.ANTHARAS_WAIT_TIME * 60000));
}
}
}
}


@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
if (event.equalsIgnoreCase("waiting"))
{
setAntharasSpawnTask();
}


return super.onAdvEvent(event, npc, player);
}


protected void startMinionSpawns(int antharasId)
{
int intervalOfMobs;


// Interval of minions is decided by the type of Antharas
// that invaded the lair.
switch (antharasId)
{
case ANTHARAS_WEAK_ID:
intervalOfMobs = FWA_INTERVALOFMOBSWEAK;
break;
case ANTHARAS_NORMAL_ID:
intervalOfMobs = FWA_INTERVALOFMOBSNORMAL;
break;
default:
intervalOfMobs = FWA_INTERVALOFMOBSSTRONG;
break;
}


// Spawn mobs.
_mobsSpawnTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new MobsSpawn(), intervalOfMobs, intervalOfMobs);
}


// Do spawn Antharas.
private class AntharasSpawn implements Runnable
{
private int _taskId = 0;
private final Collection<L2Character> _players = _Zone.getCharactersInside();


public AntharasSpawn(int taskId)
{
_taskId = taskId;
}


@Override
public void run()
{
int npcId;
L2Spawn antharasSpawn = null;


switch (_taskId)
{
case 1: // Spawn.
// Strength of Antharas is decided by the number of players that
// invaded the lair.
_monsterSpawnTask.cancel(false);
_monsterSpawnTask = null;
if (FWA_OLDANTHARAS)
{
npcId = 29019; // old
}
else if (_players.size() <= FWA_LIMITOFWEAK)
{
npcId = 29066; // weak
}
else if (_players.size() > FWA_LIMITOFNORMAL)
{
npcId = 29068; // strong
}
else
{
npcId = 29067; // normal
}


// Do spawn.
antharasSpawn = _monsterSpawn.get(npcId);
_antharas = (L2GrandBossInstance) antharasSpawn.doSpawn();
GrandBossManager.getInstance().addBoss(_antharas);


_monsters.add(_antharas);
_antharas.setIsImmobilized(true);


GrandBossManager.getInstance().setBossStatus(ANTHARAS_OLD_ID, DORMANT);
GrandBossManager.getInstance().setBossStatus(npcId, FIGHTING);
_LastAction = System.currentTimeMillis();
// Start repeating timer to check for inactivity
_activityCheckTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new CheckActivity(), 60000, 60000);


// Setting 1st time of minions spawn task.
if (!FWA_OLDANTHARAS)
{
startMinionSpawns(npcId);
}


// Set next task.
if (_socialTask != null)
{
_socialTask.cancel(true);
_socialTask = null;
}
_socialTask = ThreadPoolManager.getInstance().scheduleGeneral(new AntharasSpawn(2), 16);
break;
case 2:
// Set camera.
broadcastPacket(new SpecialCamera(_antharas.getObjectId(), 700, 13, -19, 0, 20000, 0, 0, 1, 0));


// Set next task.
if (_socialTask != null)
{
_socialTask.cancel(true);
_socialTask = null;
}
_socialTask = ThreadPoolManager.getInstance().scheduleGeneral(new AntharasSpawn(3), 3000);
break;


case 3:
// Do social.
broadcastPacket(new SpecialCamera(_antharas.getObjectId(), 700, 13, 0, 6000, 20000, 0, 0, 1, 0));
// Set next task.
if (_socialTask != null)
{
_socialTask.cancel(true);
_socialTask = null;
}
_socialTask = ThreadPoolManager.getInstance().scheduleGeneral(new AntharasSpawn(4), 10000);
break;
case 4:
broadcastPacket(new SpecialCamera(_antharas.getObjectId(), 3700, 0, -3, 0, 10000, 0, 0, 1, 0));
// Set next task.
if (_socialTask != null)
{
_socialTask.cancel(true);
_socialTask = null;
}
_socialTask = ThreadPoolManager.getInstance().scheduleGeneral(new AntharasSpawn(5), 200);
break;


case 5:
// Do social.
broadcastPacket(new SpecialCamera(_antharas.getObjectId(), 1100, 0, -3, 22000, 30000, 0, 0, 1, 0));
// Set next task.
if (_socialTask != null)
{
_socialTask.cancel(true);
_socialTask = null;
}
_socialTask = ThreadPoolManager.getInstance().scheduleGeneral(new AntharasSpawn(6), 10800);
break;


case 6:
// Set camera.
broadcastPacket(new SpecialCamera(_antharas.getObjectId(), 1100, 0, -3, 300, 7000, 0, 0, 1, 0));
// Set next task.
if (_socialTask != null)
{
_socialTask.cancel(true);
_socialTask = null;
}
_socialTask = ThreadPoolManager.getInstance().scheduleGeneral(new AntharasSpawn(7), 1900);
break;


case 7:
_antharas.abortCast();


_mobiliseTask = ThreadPoolManager.getInstance().scheduleGeneral(new SetMobilised(_antharas), 16);


// Move at random.
if (FWA_MOVEATRANDOM)
{
L2CharPosition pos = new L2CharPosition(getRandom(175000, 178500), getRandom(112400, 116000), -7707, 0);
_moveAtRandomTask = ThreadPoolManager.getInstance().scheduleGeneral(new MoveAtRandom(_antharas, pos), 500);
}


if (_socialTask != null)
{
_socialTask.cancel(true);
_socialTask = null;
}
break;
}
}
}


protected void broadcastPacket(L2GameServerPacket mov)
{
if (_Zone != null)
{
for (L2Character characters : _Zone.getCharactersInside())
{
if (characters.isPlayer())
{
characters.sendPacket(mov);
}
}
}
}


// Do spawn Behemoth or Bomber.
private class MobsSpawn implements Runnable
{
public MobsSpawn()
{
}


@Override
public void run()
{
L2NpcTemplate template1;
L2Spawn tempSpawn;
boolean isBehemoth = getRandom(100) < FWA_PERCENTOFBEHEMOTH;
try
{
int mobNumber = (isBehemoth ? 2 : 3);
// Set spawn.
for (int i = 0; i < mobNumber; i++)
{
if (_monsters.size() >= FWA_MAXMOBS)
{
break;
}
int npcId;
if (isBehemoth)
{
npcId = 29069;
}
else
{
npcId = getRandom(29070, 29076);
}
template1 = NpcTable.getInstance().getTemplate(npcId);
tempSpawn = new L2Spawn(template1);
// allocates it at random in the lair of Antharas.
int tried = 0;
boolean notFound = true;
int x = 175000;
int y = 112400;
int dt = ((_antharas.getX() - x) * (_antharas.getX() - x)) + ((_antharas.getY() - y) * (_antharas.getY() - y));
while ((tried++ < 25) && notFound)
{
int rx = getRandom(175000, 179900);
int ry = getRandom(112400, 116000);
int rdt = ((_antharas.getX() - rx) * (_antharas.getX() - rx)) + ((_antharas.getY() - ry) * (_antharas.getY() - ry));
if (GeoData.getInstance().canSeeTarget(_antharas.getX(), _antharas.getY(), -7704, rx, ry, -7704))
{
if (rdt < dt)
{
x = rx;
y = ry;
dt = rdt;
if (rdt <= 900000)
{
notFound = false;
}
}
}
}
tempSpawn.setLocx(x);
tempSpawn.setLocy(y);
tempSpawn.setLocz(-7704);
tempSpawn.setHeading(0);
tempSpawn.setAmount(1);
tempSpawn.setRespawnDelay(FWA_ACTIVITYTIMEOFANTHARAS * 2);
SpawnTable.getInstance().addNewSpawn(tempSpawn, false);
// Do spawn.
_monsters.add(tempSpawn.doSpawn());
}
}
catch (Exception e)
{
_log.warning(e.getMessage());
}
}
}


@Override
public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon)
{
switch (npc.getNpcId())
{
case 29070:
case 29071:
case 29072:
case 29073:
case 29074:
case 29075:
case 29076:
if ((_selfDestructionTask == null) && !npc.isDead())
{
_selfDestructionTask = ThreadPoolManager.getInstance().scheduleGeneral(new SelfDestructionOfBomber(npc), FWA_SELFDESTRUCTTIME);
}
break;
}
return super.onAggroRangeEnter(npc, player, isSummon);
}


// Do self destruction.
private class SelfDestructionOfBomber implements Runnable
{
private final L2Npc _bomber;


public SelfDestructionOfBomber(L2Npc bomber)
{
_bomber = bomber;
}


@Override
public void run()
{
L2Skill skill = null;
switch (_bomber.getNpcId())
{
case 29070:
case 29071:
case 29072:
case 29073:
case 29074:
case 29075:
skill = SkillTable.getInstance().getInfo(5097, 1);
break;
case 29076:
skill = SkillTable.getInstance().getInfo(5094, 1);
break;
}


_bomber.doCast(skill);
if (_selfDestructionTask != null)
{
_selfDestructionTask.cancel(false);
_selfDestructionTask = null;
}
}
}


@Override
public String onSpellFinished(L2Npc npc, L2PcInstance player, L2Skill skill)
{
if (npc.isInvul())
{
return null;
}
else if ((skill != null) && ((skill.getId() == 5097) || (skill.getId() == 5094)))
{
switch (npc.getNpcId())
{
case 29070:
case 29071:
case 29072:
case 29073:
case 29074:
case 29075:
case 29076:
npc.doDie(npc);
break;
}
}
return super.onSpellFinished(npc, player, skill);
}


// At end of activity time.
protected class CheckActivity implements Runnable
{
@Override
public void run()
{
Long temp = (System.currentTimeMillis() - _LastAction);
if (temp > FWA_INACTIVITYTIME)
{
GrandBossManager.getInstance().setBossStatus(_antharas.getNpcId(), DORMANT);
setUnspawn();
}
}
}


// Clean Antharas's lair.
public void setUnspawn()
{
// Eliminate players.
_Zone.oustAllPlayers();


// Not executed tasks is canceled.
if (_cubeSpawnTask != null)
{
_cubeSpawnTask.cancel(true);
_cubeSpawnTask = null;
}
if (_monsterSpawnTask != null)
{
_monsterSpawnTask.cancel(true);
_monsterSpawnTask = null;
}
if (_activityCheckTask != null)
{
_activityCheckTask.cancel(false);
_activityCheckTask = null;
}
if (_socialTask != null)
{
_socialTask.cancel(true);
_socialTask = null;
}
if (_mobiliseTask != null)
{
_mobiliseTask.cancel(true);
_mobiliseTask = null;
}
if (_mobsSpawnTask != null)
{
_mobsSpawnTask.cancel(true);
_mobsSpawnTask = null;
}
if (_selfDestructionTask != null)
{
_selfDestructionTask.cancel(true);
_selfDestructionTask = null;
}
if (_moveAtRandomTask != null)
{
_moveAtRandomTask.cancel(true);
_moveAtRandomTask = null;
}


// Delete monsters.
for (L2Npc mob : _monsters)
{
mob.getSpawn().stopRespawn();
mob.deleteMe();
}
_monsters.clear();


// Delete teleport cube.
for (L2Npc cube : _teleportCube)
{
cube.getSpawn().stopRespawn();
cube.deleteMe();
}
_teleportCube.clear();
}


// Do spawn teleport cube.
private class CubeSpawn implements Runnable
{
private final int _type;


public CubeSpawn(int type)
{
_type = type;
}


@Override
public void run()
{
if (_type == 0)
{
spawnCube();
_cubeSpawnTask = ThreadPoolManager.getInstance().scheduleGeneral(new CubeSpawn(1), 1800000);
}
else
{
setUnspawn();
}
}
}


// UnLock Antharas.
private static class UnlockAntharas implements Runnable
{
private final int _bossId;


public UnlockAntharas(int bossId)
{
_bossId = bossId;
}


@Override
public void run()
{
GrandBossManager.getInstance().setBossStatus(_bossId, DORMANT);
if (FWA_DOSERVEREARTHQUAKE)
{
for (L2PcInstance p : L2World.getInstance().getAllPlayersArray())
{
p.broadcastPacket(new Earthquake(185708, 114298, -8221, 20, 10));
}
}
}
}


// Action is enabled the boss.
private class SetMobilised implements Runnable
{
private final L2GrandBossInstance _boss;


public SetMobilised(L2GrandBossInstance boss)
{
_boss = boss;
}


@Override
public void run()
{
_boss.setIsImmobilized(false);


// When it is possible to act, a social action is canceled.
if (_socialTask != null)
{
_socialTask.cancel(true);
_socialTask = null;
}
}
}


// Move at random on after Antharas appears.
private static class MoveAtRandom implements Runnable
{
private final L2Npc _npc;
private final L2CharPosition _pos;


public MoveAtRandom(L2Npc npc, L2CharPosition pos)
{
_npc = npc;
_pos = pos;
}


@Override
public void run()
{
_npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, _pos);
}
}


@Override
public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon)
{
if ((npc.getNpcId() == 29019) || (npc.getNpcId() == 29066) || (npc.getNpcId() == 29067) || (npc.getNpcId() == 29068))
{
_LastAction = System.currentTimeMillis();
if (GrandBossManager.getInstance().getBossStatus(_antharas.getNpcId()) != FIGHTING)
{
_Zone.oustAllPlayers();
}
else if (!FWA_OLDANTHARAS && (_mobsSpawnTask == null))
{
startMinionSpawns(npc.getNpcId());
}
}
else if ((npc.getNpcId() > 29069) && (npc.getNpcId() < 29077) && (npc.getCurrentHp() <= damage))
{
L2Skill skill = null;
switch (npc.getNpcId())
{
case 29070:
case 29071:
case 29072:
case 29073:
case 29074:
case 29075:
skill = SkillTable.getInstance().getInfo(5097, 1);
break;
case 29076:
skill = SkillTable.getInstance().getInfo(5094, 1);
break;
}


npc.doCast(skill);
}
return super.onAttack(npc, attacker, damage, isSummon);
}


@Override
public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
{
if ((npc.getNpcId() == 29019) || (npc.getNpcId() == 29066) || (npc.getNpcId() == 29067) || (npc.getNpcId() == 29068))
{
broadcastPacket(new SpecialCamera(_antharas.getObjectId(), 1200, 20, -10, 0, 13000, 0, 0, 1, 0));
npc.broadcastPacket(new PlaySound(1, "BS01_D", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
_cubeSpawnTask = ThreadPoolManager.getInstance().scheduleGeneral(new CubeSpawn(0), 10000);
GrandBossManager.getInstance().setBossStatus(npc.getNpcId(), DEAD);
// Calculate Min and Max respawn times randomly.
long respawnTime = Config.ANTHARAS_SPAWN_INTERVAL + getRandom(-Config.ANTHARAS_SPAWN_RANDOM, Config.ANTHARAS_SPAWN_RANDOM);
respawnTime *= 3600000;


ThreadPoolManager.getInstance().scheduleGeneral(new UnlockAntharas(npc.getNpcId()), respawnTime);
// also save the respawn time so that the info is maintained past reboots
StatsSet info = GrandBossManager.getInstance().getStatsSet(npc.getNpcId());
info.set("respawn_time", (System.currentTimeMillis() + respawnTime));
GrandBossManager.getInstance().setStatsSet(npc.getNpcId(), info);
}
else if (npc.getNpcId() == 29069)
{
int countHPHerb = getRandom(6, 18);
int countMPHerb = getRandom(6, 18);
for (int i = 0; i < countHPHerb; i++)
{
((L2MonsterInstance) npc).dropItem(killer, 8602, 1);
}
for (int i = 0; i < countMPHerb; i++)
{
((L2MonsterInstance) npc).dropItem(killer, 8605, 1);
}
}
if (_monsters.contains(npc))
{
_monsters.remove(npc);
}
return super.onKill(npc, killer, isSummon);
}


public static void main(String[] args)
{
new Antharas(Antharas.class.getSimpleName(), "ai");
}
}
  • 0
Posted

 

For example here is the antharas script, I dont know which value to edit...

/*
 * Copyright (C) 2004-2013 L2J DataPack
 * 
 * This file is part of L2J DataPack.
 * 
 * L2J DataPack 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.
 * 
 * L2J DataPack 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.individual;


import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ScheduledFuture;


import javolution.util.FastList;
import javolution.util.FastMap;
import ai.npc.AbstractNpcAI;


import com.l2jserver.Config;
import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.datatables.NpcTable;
import com.l2jserver.gameserver.datatables.SkillTable;
import com.l2jserver.gameserver.datatables.SpawnTable;
import com.l2jserver.gameserver.instancemanager.GrandBossManager;
import com.l2jserver.gameserver.model.L2CharPosition;
import com.l2jserver.gameserver.model.L2Spawn;
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2GrandBossInstance;
import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jserver.gameserver.model.skills.L2Skill;
import com.l2jserver.gameserver.model.zone.type.L2BossZone;
import com.l2jserver.gameserver.network.serverpackets.Earthquake;
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
import com.l2jserver.gameserver.network.serverpackets.PlaySound;
import com.l2jserver.gameserver.network.serverpackets.SpecialCamera;


/**
 * Antharas' AI.
 * @author L2J_JP SANDMAN
 */
public class Antharas extends AbstractNpcAI
{
// config
private static final int FWA_ACTIVITYTIMEOFANTHARAS = 120;
// private static final int FWA_APPTIMEOFANTHARAS = 1800000;
private static final int FWA_INACTIVITYTIME = 900000;
private static final boolean FWA_OLDANTHARAS = false;
private static final boolean FWA_MOVEATRANDOM = true;
private static final boolean FWA_DOSERVEREARTHQUAKE = true;
private static final int FWA_LIMITOFWEAK = 45;
private static final int FWA_LIMITOFNORMAL = 63;
private static final int FWA_MAXMOBS = 10; // this includes Antharas itself
private static final int FWA_INTERVALOFMOBSWEAK = 180000;
private static final int FWA_INTERVALOFMOBSNORMAL = 150000;
private static final int FWA_INTERVALOFMOBSSTRONG = 120000;
private static final int FWA_PERCENTOFBEHEMOTH = 60;
private static final int FWA_SELFDESTRUCTTIME = 15000;
// Location of teleport cube.
private final int _teleportCubeId = 31859;
private final int _teleportCubeLocation[][] =
{
{
177615,
114941,
-7709,
0
}
};


protected List<L2Spawn> _teleportCubeSpawn = new FastList<>();
protected List<L2Npc> _teleportCube = new FastList<>();
// Spawn data of monsters.
protected Map<Integer, L2Spawn> _monsterSpawn = new FastMap<>();
// Instance of monsters.
protected List<L2Npc> _monsters = new FastList<>();
protected L2GrandBossInstance _antharas = null;
// Antharas Ids
private static final int ANTHARAS_OLD_ID = 29019;
private static final int ANTHARAS_WEAK_ID = 29066;
private static final int ANTHARAS_NORMAL_ID = 29067;
private static final int ANTHARAS_STRONG_ID = 29068;
// Tasks.
protected ScheduledFuture<?> _cubeSpawnTask = null;
protected ScheduledFuture<?> _monsterSpawnTask = null;
protected ScheduledFuture<?> _activityCheckTask = null;
protected ScheduledFuture<?> _socialTask = null;
protected ScheduledFuture<?> _mobiliseTask = null;
protected ScheduledFuture<?> _mobsSpawnTask = null;
protected ScheduledFuture<?> _selfDestructionTask = null;
protected ScheduledFuture<?> _moveAtRandomTask = null;
protected ScheduledFuture<?> _movieTask = null;
// Antharas Status Tracking :
private static final byte DORMANT = 0; // Antharas is spawned and no one has entered yet. Entry is unlocked
private static final byte WAITING = 1; // Antharas is spawend and someone has entered, triggering a 30 minute window for additional people to enter
// before he unleashes his attack. Entry is unlocked
private static final byte FIGHTING = 2; // Antharas is engaged in battle, annihilating his foes. Entry is locked
private static final byte DEAD = 3; // Antharas has been killed. Entry is locked


protected static long _LastAction = 0;


protected static L2BossZone _Zone;


private Antharas(String name, String descr)
{
super(name, descr);
registerMobs(ANTHARAS_OLD_ID, ANTHARAS_WEAK_ID, ANTHARAS_NORMAL_ID, ANTHARAS_STRONG_ID, 29069, 29070, 29071, 29072, 29073, 29074, 29075, 29076);
init();
}


// Initialize
private void init()
{
// Setting spawn data of monsters.
try
{
_Zone = GrandBossManager.getInstance().getZone(179700, 113800, -7709);
L2NpcTemplate template1;
L2Spawn tempSpawn;


// Old Antharas
template1 = NpcTable.getInstance().getTemplate(ANTHARAS_OLD_ID);
tempSpawn = new L2Spawn(template1);
tempSpawn.setLocx(181323);
tempSpawn.setLocy(114850);
tempSpawn.setLocz(-7623);
tempSpawn.setHeading(32542);
tempSpawn.setAmount(1);
tempSpawn.setRespawnDelay(FWA_ACTIVITYTIMEOFANTHARAS * 2);
SpawnTable.getInstance().addNewSpawn(tempSpawn, false);
_monsterSpawn.put(29019, tempSpawn);


// Weak Antharas
template1 = NpcTable.getInstance().getTemplate(ANTHARAS_WEAK_ID);
tempSpawn = new L2Spawn(template1);
tempSpawn.setLocx(181323);
tempSpawn.setLocy(114850);
tempSpawn.setLocz(-7623);
tempSpawn.setHeading(32542);
tempSpawn.setAmount(1);
tempSpawn.setRespawnDelay(FWA_ACTIVITYTIMEOFANTHARAS * 2);
SpawnTable.getInstance().addNewSpawn(tempSpawn, false);
_monsterSpawn.put(29066, tempSpawn);


// Normal Antharas
template1 = NpcTable.getInstance().getTemplate(ANTHARAS_NORMAL_ID);
tempSpawn = new L2Spawn(template1);
tempSpawn.setLocx(181323);
tempSpawn.setLocy(114850);
tempSpawn.setLocz(-7623);
tempSpawn.setHeading(32542);
tempSpawn.setAmount(1);
tempSpawn.setRespawnDelay(FWA_ACTIVITYTIMEOFANTHARAS * 2);
SpawnTable.getInstance().addNewSpawn(tempSpawn, false);
_monsterSpawn.put(29067, tempSpawn);


// Strong Antharas
template1 = NpcTable.getInstance().getTemplate(ANTHARAS_STRONG_ID);
tempSpawn = new L2Spawn(template1);
tempSpawn.setLocx(181323);
tempSpawn.setLocy(114850);
tempSpawn.setLocz(-7623);
tempSpawn.setHeading(32542);
tempSpawn.setAmount(1);
tempSpawn.setRespawnDelay(FWA_ACTIVITYTIMEOFANTHARAS * 2);
SpawnTable.getInstance().addNewSpawn(tempSpawn, false);
_monsterSpawn.put(29068, tempSpawn);
}
catch (Exception e)
{
_log.warning(e.getMessage());
}


// Setting spawn data of teleport cube.
try
{
L2NpcTemplate Cube = NpcTable.getInstance().getTemplate(_teleportCubeId);
L2Spawn spawnDat;
for (int[] element : _teleportCubeLocation)
{
spawnDat = new L2Spawn(Cube);
spawnDat.setAmount(1);
spawnDat.setLocx(element[0]);
spawnDat.setLocy(element[1]);
spawnDat.setLocz(element[2]);
spawnDat.setHeading(element[3]);
spawnDat.setRespawnDelay(60);
spawnDat.setLocation(0);
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
_teleportCubeSpawn.add(spawnDat);
}
}
catch (Exception e)
{
_log.warning(e.getMessage());
}
int status = GrandBossManager.getInstance().getBossStatus(ANTHARAS_OLD_ID);
if (FWA_OLDANTHARAS || (status == WAITING))
{
StatsSet info = GrandBossManager.getInstance().getStatsSet(ANTHARAS_OLD_ID);
Long respawnTime = info.getLong("respawn_time");
if ((status == DEAD) && (respawnTime <= System.currentTimeMillis()))
{
// the time has already expired while the server was offline. Immediately spawn antharas in his cave.
// also, the status needs to be changed to DORMANT
GrandBossManager.getInstance().setBossStatus(ANTHARAS_OLD_ID, DORMANT);
status = DORMANT;
}
else if (status == FIGHTING)
{
int loc_x = info.getInteger("loc_x");
int loc_y = info.getInteger("loc_y");
int loc_z = info.getInteger("loc_z");
int heading = info.getInteger("heading");
int hp = info.getInteger("currentHP");
int mp = info.getInteger("currentMP");
_antharas = (L2GrandBossInstance) addSpawn(ANTHARAS_OLD_ID, loc_x, loc_y, loc_z, heading, false, 0);
GrandBossManager.getInstance().addBoss(_antharas);
_antharas.setCurrentHpMp(hp, mp);
_LastAction = System.currentTimeMillis();
// Start repeating timer to check for inactivity
_activityCheckTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new CheckActivity(), 60000, 60000);
}
else if (status == DEAD)
{
ThreadPoolManager.getInstance().scheduleGeneral(new UnlockAntharas(ANTHARAS_OLD_ID), respawnTime - System.currentTimeMillis());
}
else
{
setAntharasSpawnTask();
}
}
else
{
int statusWeak = GrandBossManager.getInstance().getBossStatus(ANTHARAS_WEAK_ID);
int statusNormal = GrandBossManager.getInstance().getBossStatus(ANTHARAS_NORMAL_ID);
int statusStrong = GrandBossManager.getInstance().getBossStatus(ANTHARAS_STRONG_ID);
int antharasId = 0;
if ((statusWeak == FIGHTING) || (statusWeak == DEAD))
{
antharasId = ANTHARAS_WEAK_ID;
status = statusWeak;
}
else if ((statusNormal == FIGHTING) || (statusNormal == DEAD))
{
antharasId = ANTHARAS_NORMAL_ID;
status = statusNormal;
}
else if ((statusStrong == FIGHTING) || (statusStrong == DEAD))
{
antharasId = ANTHARAS_STRONG_ID;
status = statusStrong;
}
if ((antharasId != 0) && (status == FIGHTING))
{
StatsSet info = GrandBossManager.getInstance().getStatsSet(antharasId);
int loc_x = info.getInteger("loc_x");
int loc_y = info.getInteger("loc_y");
int loc_z = info.getInteger("loc_z");
int heading = info.getInteger("heading");
int hp = info.getInteger("currentHP");
int mp = info.getInteger("currentMP");
_antharas = (L2GrandBossInstance) addSpawn(antharasId, loc_x, loc_y, loc_z, heading, false, 0);
GrandBossManager.getInstance().addBoss(_antharas);
_antharas.setCurrentHpMp(hp, mp);
_LastAction = System.currentTimeMillis();
// Start repeating timer to check for inactivity
_activityCheckTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new CheckActivity(), 60000, 60000);
}
else if ((antharasId != 0) && (status == DEAD))
{
StatsSet info = GrandBossManager.getInstance().getStatsSet(antharasId);
Long respawnTime = info.getLong("respawn_time");
if (respawnTime <= System.currentTimeMillis())
{
// the time has already expired while the server was offline. Immediately spawn antharas in his cave.
// also, the status needs to be changed to DORMANT
GrandBossManager.getInstance().setBossStatus(antharasId, DORMANT);
status = DORMANT;
}
else
{
ThreadPoolManager.getInstance().scheduleGeneral(new UnlockAntharas(antharasId), respawnTime - System.currentTimeMillis());
}
}
}
}


// Do spawn teleport cube.
public void spawnCube()
{
if (_mobsSpawnTask != null)
{
_mobsSpawnTask.cancel(true);
_mobsSpawnTask = null;
}
if (_selfDestructionTask != null)
{
_selfDestructionTask.cancel(true);
_selfDestructionTask = null;
}
if (_activityCheckTask != null)
{
_activityCheckTask.cancel(false);
_activityCheckTask = null;
}


for (L2Spawn spawnDat : _teleportCubeSpawn)
{
_teleportCube.add(spawnDat.doSpawn());
}
}


// Setting Antharas spawn task.
public void setAntharasSpawnTask()
{
if (_monsterSpawnTask == null)
{
synchronized (this)
{
if (_monsterSpawnTask == null)
{
GrandBossManager.getInstance().setBossStatus(ANTHARAS_OLD_ID, WAITING);
_monsterSpawnTask = ThreadPoolManager.getInstance().scheduleGeneral(new AntharasSpawn(1), (Config.ANTHARAS_WAIT_TIME * 60000));
}
}
}
}


@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
if (event.equalsIgnoreCase("waiting"))
{
setAntharasSpawnTask();
}


return super.onAdvEvent(event, npc, player);
}


protected void startMinionSpawns(int antharasId)
{
int intervalOfMobs;


// Interval of minions is decided by the type of Antharas
// that invaded the lair.
switch (antharasId)
{
case ANTHARAS_WEAK_ID:
intervalOfMobs = FWA_INTERVALOFMOBSWEAK;
break;
case ANTHARAS_NORMAL_ID:
intervalOfMobs = FWA_INTERVALOFMOBSNORMAL;
break;
default:
intervalOfMobs = FWA_INTERVALOFMOBSSTRONG;
break;
}


// Spawn mobs.
_mobsSpawnTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new MobsSpawn(), intervalOfMobs, intervalOfMobs);
}


// Do spawn Antharas.
private class AntharasSpawn implements Runnable
{
private int _taskId = 0;
private final Collection<L2Character> _players = _Zone.getCharactersInside();


public AntharasSpawn(int taskId)
{
_taskId = taskId;
}


@Override
public void run()
{
int npcId;
L2Spawn antharasSpawn = null;


switch (_taskId)
{
case 1: // Spawn.
// Strength of Antharas is decided by the number of players that
// invaded the lair.
_monsterSpawnTask.cancel(false);
_monsterSpawnTask = null;
if (FWA_OLDANTHARAS)
{
npcId = 29019; // old
}
else if (_players.size() <= FWA_LIMITOFWEAK)
{
npcId = 29066; // weak
}
else if (_players.size() > FWA_LIMITOFNORMAL)
{
npcId = 29068; // strong
}
else
{
npcId = 29067; // normal
}


// Do spawn.
antharasSpawn = _monsterSpawn.get(npcId);
_antharas = (L2GrandBossInstance) antharasSpawn.doSpawn();
GrandBossManager.getInstance().addBoss(_antharas);


_monsters.add(_antharas);
_antharas.setIsImmobilized(true);


GrandBossManager.getInstance().setBossStatus(ANTHARAS_OLD_ID, DORMANT);
GrandBossManager.getInstance().setBossStatus(npcId, FIGHTING);
_LastAction = System.currentTimeMillis();
// Start repeating timer to check for inactivity
_activityCheckTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new CheckActivity(), 60000, 60000);


// Setting 1st time of minions spawn task.
if (!FWA_OLDANTHARAS)
{
startMinionSpawns(npcId);
}


// Set next task.
if (_socialTask != null)
{
_socialTask.cancel(true);
_socialTask = null;
}
_socialTask = ThreadPoolManager.getInstance().scheduleGeneral(new AntharasSpawn(2), 16);
break;
case 2:
// Set camera.
broadcastPacket(new SpecialCamera(_antharas.getObjectId(), 700, 13, -19, 0, 20000, 0, 0, 1, 0));


// Set next task.
if (_socialTask != null)
{
_socialTask.cancel(true);
_socialTask = null;
}
_socialTask = ThreadPoolManager.getInstance().scheduleGeneral(new AntharasSpawn(3), 3000);
break;


case 3:
// Do social.
broadcastPacket(new SpecialCamera(_antharas.getObjectId(), 700, 13, 0, 6000, 20000, 0, 0, 1, 0));
// Set next task.
if (_socialTask != null)
{
_socialTask.cancel(true);
_socialTask = null;
}
_socialTask = ThreadPoolManager.getInstance().scheduleGeneral(new AntharasSpawn(4), 10000);
break;
case 4:
broadcastPacket(new SpecialCamera(_antharas.getObjectId(), 3700, 0, -3, 0, 10000, 0, 0, 1, 0));
// Set next task.
if (_socialTask != null)
{
_socialTask.cancel(true);
_socialTask = null;
}
_socialTask = ThreadPoolManager.getInstance().scheduleGeneral(new AntharasSpawn(5), 200);
break;


case 5:
// Do social.
broadcastPacket(new SpecialCamera(_antharas.getObjectId(), 1100, 0, -3, 22000, 30000, 0, 0, 1, 0));
// Set next task.
if (_socialTask != null)
{
_socialTask.cancel(true);
_socialTask = null;
}
_socialTask = ThreadPoolManager.getInstance().scheduleGeneral(new AntharasSpawn(6), 10800);
break;


case 6:
// Set camera.
broadcastPacket(new SpecialCamera(_antharas.getObjectId(), 1100, 0, -3, 300, 7000, 0, 0, 1, 0));
// Set next task.
if (_socialTask != null)
{
_socialTask.cancel(true);
_socialTask = null;
}
_socialTask = ThreadPoolManager.getInstance().scheduleGeneral(new AntharasSpawn(7), 1900);
break;


case 7:
_antharas.abortCast();


_mobiliseTask = ThreadPoolManager.getInstance().scheduleGeneral(new SetMobilised(_antharas), 16);


// Move at random.
if (FWA_MOVEATRANDOM)
{
L2CharPosition pos = new L2CharPosition(getRandom(175000, 178500), getRandom(112400, 116000), -7707, 0);
_moveAtRandomTask = ThreadPoolManager.getInstance().scheduleGeneral(new MoveAtRandom(_antharas, pos), 500);
}


if (_socialTask != null)
{
_socialTask.cancel(true);
_socialTask = null;
}
break;
}
}
}


protected void broadcastPacket(L2GameServerPacket mov)
{
if (_Zone != null)
{
for (L2Character characters : _Zone.getCharactersInside())
{
if (characters.isPlayer())
{
characters.sendPacket(mov);
}
}
}
}


// Do spawn Behemoth or Bomber.
private class MobsSpawn implements Runnable
{
public MobsSpawn()
{
}


@Override
public void run()
{
L2NpcTemplate template1;
L2Spawn tempSpawn;
boolean isBehemoth = getRandom(100) < FWA_PERCENTOFBEHEMOTH;
try
{
int mobNumber = (isBehemoth ? 2 : 3);
// Set spawn.
for (int i = 0; i < mobNumber; i++)
{
if (_monsters.size() >= FWA_MAXMOBS)
{
break;
}
int npcId;
if (isBehemoth)
{
npcId = 29069;
}
else
{
npcId = getRandom(29070, 29076);
}
template1 = NpcTable.getInstance().getTemplate(npcId);
tempSpawn = new L2Spawn(template1);
// allocates it at random in the lair of Antharas.
int tried = 0;
boolean notFound = true;
int x = 175000;
int y = 112400;
int dt = ((_antharas.getX() - x) * (_antharas.getX() - x)) + ((_antharas.getY() - y) * (_antharas.getY() - y));
while ((tried++ < 25) && notFound)
{
int rx = getRandom(175000, 179900);
int ry = getRandom(112400, 116000);
int rdt = ((_antharas.getX() - rx) * (_antharas.getX() - rx)) + ((_antharas.getY() - ry) * (_antharas.getY() - ry));
if (GeoData.getInstance().canSeeTarget(_antharas.getX(), _antharas.getY(), -7704, rx, ry, -7704))
{
if (rdt < dt)
{
x = rx;
y = ry;
dt = rdt;
if (rdt <= 900000)
{
notFound = false;
}
}
}
}
tempSpawn.setLocx(x);
tempSpawn.setLocy(y);
tempSpawn.setLocz(-7704);
tempSpawn.setHeading(0);
tempSpawn.setAmount(1);
tempSpawn.setRespawnDelay(FWA_ACTIVITYTIMEOFANTHARAS * 2);
SpawnTable.getInstance().addNewSpawn(tempSpawn, false);
// Do spawn.
_monsters.add(tempSpawn.doSpawn());
}
}
catch (Exception e)
{
_log.warning(e.getMessage());
}
}
}


@Override
public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon)
{
switch (npc.getNpcId())
{
case 29070:
case 29071:
case 29072:
case 29073:
case 29074:
case 29075:
case 29076:
if ((_selfDestructionTask == null) && !npc.isDead())
{
_selfDestructionTask = ThreadPoolManager.getInstance().scheduleGeneral(new SelfDestructionOfBomber(npc), FWA_SELFDESTRUCTTIME);
}
break;
}
return super.onAggroRangeEnter(npc, player, isSummon);
}


// Do self destruction.
private class SelfDestructionOfBomber implements Runnable
{
private final L2Npc _bomber;


public SelfDestructionOfBomber(L2Npc bomber)
{
_bomber = bomber;
}


@Override
public void run()
{
L2Skill skill = null;
switch (_bomber.getNpcId())
{
case 29070:
case 29071:
case 29072:
case 29073:
case 29074:
case 29075:
skill = SkillTable.getInstance().getInfo(5097, 1);
break;
case 29076:
skill = SkillTable.getInstance().getInfo(5094, 1);
break;
}


_bomber.doCast(skill);
if (_selfDestructionTask != null)
{
_selfDestructionTask.cancel(false);
_selfDestructionTask = null;
}
}
}


@Override
public String onSpellFinished(L2Npc npc, L2PcInstance player, L2Skill skill)
{
if (npc.isInvul())
{
return null;
}
else if ((skill != null) && ((skill.getId() == 5097) || (skill.getId() == 5094)))
{
switch (npc.getNpcId())
{
case 29070:
case 29071:
case 29072:
case 29073:
case 29074:
case 29075:
case 29076:
npc.doDie(npc);
break;
}
}
return super.onSpellFinished(npc, player, skill);
}


// At end of activity time.
protected class CheckActivity implements Runnable
{
@Override
public void run()
{
Long temp = (System.currentTimeMillis() - _LastAction);
if (temp > FWA_INACTIVITYTIME)
{
GrandBossManager.getInstance().setBossStatus(_antharas.getNpcId(), DORMANT);
setUnspawn();
}
}
}


// Clean Antharas's lair.
public void setUnspawn()
{
// Eliminate players.
_Zone.oustAllPlayers();


// Not executed tasks is canceled.
if (_cubeSpawnTask != null)
{
_cubeSpawnTask.cancel(true);
_cubeSpawnTask = null;
}
if (_monsterSpawnTask != null)
{
_monsterSpawnTask.cancel(true);
_monsterSpawnTask = null;
}
if (_activityCheckTask != null)
{
_activityCheckTask.cancel(false);
_activityCheckTask = null;
}
if (_socialTask != null)
{
_socialTask.cancel(true);
_socialTask = null;
}
if (_mobiliseTask != null)
{
_mobiliseTask.cancel(true);
_mobiliseTask = null;
}
if (_mobsSpawnTask != null)
{
_mobsSpawnTask.cancel(true);
_mobsSpawnTask = null;
}
if (_selfDestructionTask != null)
{
_selfDestructionTask.cancel(true);
_selfDestructionTask = null;
}
if (_moveAtRandomTask != null)
{
_moveAtRandomTask.cancel(true);
_moveAtRandomTask = null;
}


// Delete monsters.
for (L2Npc mob : _monsters)
{
mob.getSpawn().stopRespawn();
mob.deleteMe();
}
_monsters.clear();


// Delete teleport cube.
for (L2Npc cube : _teleportCube)
{
cube.getSpawn().stopRespawn();
cube.deleteMe();
}
_teleportCube.clear();
}


// Do spawn teleport cube.
private class CubeSpawn implements Runnable
{
private final int _type;


public CubeSpawn(int type)
{
_type = type;
}


@Override
public void run()
{
if (_type == 0)
{
spawnCube();
_cubeSpawnTask = ThreadPoolManager.getInstance().scheduleGeneral(new CubeSpawn(1), 1800000);
}
else
{
setUnspawn();
}
}
}


// UnLock Antharas.
private static class UnlockAntharas implements Runnable
{
private final int _bossId;


public UnlockAntharas(int bossId)
{
_bossId = bossId;
}


@Override
public void run()
{
GrandBossManager.getInstance().setBossStatus(_bossId, DORMANT);
if (FWA_DOSERVEREARTHQUAKE)
{
for (L2PcInstance p : L2World.getInstance().getAllPlayersArray())
{
p.broadcastPacket(new Earthquake(185708, 114298, -8221, 20, 10));
}
}
}
}


// Action is enabled the boss.
private class SetMobilised implements Runnable
{
private final L2GrandBossInstance _boss;


public SetMobilised(L2GrandBossInstance boss)
{
_boss = boss;
}


@Override
public void run()
{
_boss.setIsImmobilized(false);


// When it is possible to act, a social action is canceled.
if (_socialTask != null)
{
_socialTask.cancel(true);
_socialTask = null;
}
}
}


// Move at random on after Antharas appears.
private static class MoveAtRandom implements Runnable
{
private final L2Npc _npc;
private final L2CharPosition _pos;


public MoveAtRandom(L2Npc npc, L2CharPosition pos)
{
_npc = npc;
_pos = pos;
}


@Override
public void run()
{
_npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, _pos);
}
}


@Override
public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon)
{
if ((npc.getNpcId() == 29019) || (npc.getNpcId() == 29066) || (npc.getNpcId() == 29067) || (npc.getNpcId() == 29068))
{
_LastAction = System.currentTimeMillis();
if (GrandBossManager.getInstance().getBossStatus(_antharas.getNpcId()) != FIGHTING)
{
_Zone.oustAllPlayers();
}
else if (!FWA_OLDANTHARAS && (_mobsSpawnTask == null))
{
startMinionSpawns(npc.getNpcId());
}
}
else if ((npc.getNpcId() > 29069) && (npc.getNpcId() < 29077) && (npc.getCurrentHp() <= damage))
{
L2Skill skill = null;
switch (npc.getNpcId())
{
case 29070:
case 29071:
case 29072:
case 29073:
case 29074:
case 29075:
skill = SkillTable.getInstance().getInfo(5097, 1);
break;
case 29076:
skill = SkillTable.getInstance().getInfo(5094, 1);
break;
}


npc.doCast(skill);
}
return super.onAttack(npc, attacker, damage, isSummon);
}


@Override
public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
{
if ((npc.getNpcId() == 29019) || (npc.getNpcId() == 29066) || (npc.getNpcId() == 29067) || (npc.getNpcId() == 29068))
{
broadcastPacket(new SpecialCamera(_antharas.getObjectId(), 1200, 20, -10, 0, 13000, 0, 0, 1, 0));
npc.broadcastPacket(new PlaySound(1, "BS01_D", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
_cubeSpawnTask = ThreadPoolManager.getInstance().scheduleGeneral(new CubeSpawn(0), 10000);
GrandBossManager.getInstance().setBossStatus(npc.getNpcId(), DEAD);
// Calculate Min and Max respawn times randomly.
long respawnTime = Config.ANTHARAS_SPAWN_INTERVAL + getRandom(-Config.ANTHARAS_SPAWN_RANDOM, Config.ANTHARAS_SPAWN_RANDOM);
respawnTime *= 3600000;


ThreadPoolManager.getInstance().scheduleGeneral(new UnlockAntharas(npc.getNpcId()), respawnTime);
// also save the respawn time so that the info is maintained past reboots
StatsSet info = GrandBossManager.getInstance().getStatsSet(npc.getNpcId());
info.set("respawn_time", (System.currentTimeMillis() + respawnTime));
GrandBossManager.getInstance().setStatsSet(npc.getNpcId(), info);
}
else if (npc.getNpcId() == 29069)
{
int countHPHerb = getRandom(6, 18);
int countMPHerb = getRandom(6, 18);
for (int i = 0; i < countHPHerb; i++)
{
((L2MonsterInstance) npc).dropItem(killer, 8602, 1);
}
for (int i = 0; i < countMPHerb; i++)
{
((L2MonsterInstance) npc).dropItem(killer, 8605, 1);
}
}
if (_monsters.contains(npc))
{
_monsters.remove(npc);
}
return super.onKill(npc, killer, isSummon);
}


public static void main(String[] args)
{
new Antharas(Antharas.class.getSimpleName(), "ai");
}
}

else if (_players.size() <= FWA_LIMITOFWEAK)

 

else if (_players.size() > FWA_LIMITOFNORMAL)

 

private static final int FWA_LIMITOFWEAK = 45;

private static final int FWA_LIMITOFNORMAL = 63;

  • 0
Posted

It works ty.

But at Valkas there is no line with "players.size" what value is it at valakas?

i dont know what method have in valakas for find the requiement players search in code maybe you find somthing about that..search for private static final int

etc

  • 0
Posted
/*
 * Copyright (C) 2004-2013 L2J DataPack
 * 
 * This file is part of L2J DataPack.
 * 
 * L2J DataPack 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.
 * 
 * L2J DataPack 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.individual;


import java.util.ArrayList;
import java.util.List;


import ai.npc.AbstractNpcAI;


import com.l2jserver.Config;
import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.datatables.SkillTable;
import com.l2jserver.gameserver.instancemanager.GrandBossManager;
import com.l2jserver.gameserver.model.L2CharPosition;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.L2Playable;
import com.l2jserver.gameserver.model.actor.instance.L2GrandBossInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.effects.L2Effect;
import com.l2jserver.gameserver.model.holders.SkillHolder;
import com.l2jserver.gameserver.model.skills.L2Skill;
import com.l2jserver.gameserver.model.zone.type.L2BossZone;
import com.l2jserver.gameserver.network.serverpackets.PlaySound;
import com.l2jserver.gameserver.network.serverpackets.SocialAction;
import com.l2jserver.gameserver.network.serverpackets.SpecialCamera;
import com.l2jserver.gameserver.util.Util;


/**
 * Valakas' AI.
 * @author Tryskell
 */
public class Valakas extends AbstractNpcAI
{
// NPC
private static final int VALAKAS = 29028;
// Skills
private static final SkillHolder VALAKAS_LAVA_SKIN = new SkillHolder(4680, 1);
private static final SkillHolder[] VALAKAS_REGULAR_SKILLS =
{
new SkillHolder(4681, 1), // Valakas Trample
new SkillHolder(4682, 1), // Valakas Trample
new SkillHolder(4683, 1), // Valakas Dragon Breath
new SkillHolder(4689, 1), // Valakas Fear TODO: has two levels only level one is used.
};
private static final SkillHolder[] VALAKAS_LOWHP_SKILLS =
{
new SkillHolder(4681, 1), // Valakas Trample
new SkillHolder(4682, 1), // Valakas Trample
new SkillHolder(4683, 1), // Valakas Dragon Breath
new SkillHolder(4689, 1), // Valakas Fear TODO: has two levels only level one is used.
new SkillHolder(4690, 1), // Valakas Meteor Storm
};
private static final SkillHolder[] VALAKAS_AOE_SKILLS =
{
new SkillHolder(4683, 1), // Valakas Dragon Breath
new SkillHolder(4684, 1), // Valakas Dragon Breath
new SkillHolder(4685, 1), // Valakas Tail Stomp
new SkillHolder(4686, 1), // Valakas Tail Stomp
new SkillHolder(4688, 1), // Valakas Stun
new SkillHolder(4689, 1), // Valakas Fear TODO: has two levels only level one is used.
new SkillHolder(4690, 1), // Valakas Meteor Storm
};
// Locations
private static final Location TELEPORT_CUBE_LOCATIONS[] =
{
new Location(214880, -116144, -1644),
new Location(213696, -116592, -1644),
new Location(212112, -116688, -1644),
new Location(211184, -115472, -1664),
new Location(210336, -114592, -1644),
new Location(211360, -113904, -1644),
new Location(213152, -112352, -1644),
new Location(214032, -113232, -1644),
new Location(214752, -114592, -1644),
new Location(209824, -115568, -1421),
new Location(210528, -112192, -1403),
new Location(213120, -111136, -1408),
new Location(215184, -111504, -1392),
new Location(215456, -117328, -1392),
new Location(213200, -118160, -1424)
};
// Valakas status.
private static final byte DORMANT = 0; // Valakas is spawned and no one has entered yet. Entry is unlocked.
private static final byte WAITING = 1; // Valakas is spawned and someone has entered, triggering a 30 minute window for additional people to enter. Entry is unlocked.
private static final byte FIGHTING = 2; // Valakas is engaged in battle, annihilating his foes. Entry is locked.
private static final byte DEAD = 3; // Valakas has been killed. Entry is locked.
// Misc
private long _timeTracker = 0; // Time tracker for last attack on Valakas.
private L2Playable _actualVictim; // Actual target of Valakas.
private static L2BossZone ZONE;


private Valakas(String name, String descr)
{
super(name, descr);
registerMobs(VALAKAS);


ZONE = GrandBossManager.getInstance().getZone(212852, -114842, -1632);


final StatsSet info = GrandBossManager.getInstance().getStatsSet(VALAKAS);
final int status = GrandBossManager.getInstance().getBossStatus(VALAKAS);


if (status == DEAD)
{
// load the unlock date and time for valakas from DB
long temp = (info.getLong("respawn_time") - System.currentTimeMillis());
if (temp > 0)
{
// The time has not yet expired. Mark Valakas as currently locked (dead).
startQuestTimer("valakas_unlock", temp, null, null);
}
else
{
// The time has expired while the server was offline. Spawn valakas in his cave as DORMANT.
final L2Npc valakas = addSpawn(VALAKAS, -105200, -253104, -15264, 0, false, 0);
GrandBossManager.getInstance().setBossStatus(VALAKAS, DORMANT);
GrandBossManager.getInstance().addBoss((L2GrandBossInstance) valakas);


valakas.setIsInvul(true);
valakas.setRunning();


valakas.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
}
}
else
{
final int loc_x = info.getInteger("loc_x");
final int loc_y = info.getInteger("loc_y");
final int loc_z = info.getInteger("loc_z");
final int heading = info.getInteger("heading");
final int hp = info.getInteger("currentHP");
final int mp = info.getInteger("currentMP");


final L2Npc valakas = addSpawn(VALAKAS, loc_x, loc_y, loc_z, heading, false, 0);
GrandBossManager.getInstance().addBoss((L2GrandBossInstance) valakas);


valakas.setCurrentHpMp(hp, mp);
valakas.setRunning();


// Start timers.
if (status == FIGHTING)
{
// stores current time for inactivity task.
_timeTracker = System.currentTimeMillis();


startQuestTimer("regen_task", 60000, valakas, null, true);
startQuestTimer("skill_task", 2000, valakas, null, true);
}
else
{
valakas.setIsInvul(true);
valakas.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);


// Start timer to lock entry after 30 minutes
if (status == WAITING)
{
startQuestTimer("beginning", (Config.VALAKAS_WAIT_TIME * 60000), valakas, null);
}
}
}
}


@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
if (npc != null)
{
if (event.equalsIgnoreCase("beginning"))
{
// Stores current time
_timeTracker = System.currentTimeMillis();


// Teleport Valakas to his lair.
npc.teleToLocation(212852, -114842, -1632);


// Sound + socialAction.
for (L2PcInstance plyr : ZONE.getPlayersInside())
{
plyr.sendPacket(new PlaySound(1, "B03_A", 0, 0, 0, 0, 0));
plyr.sendPacket(new SocialAction(npc.getObjectId(), 3));
}


// Launch the cinematic, and tasks (regen + skill).
startQuestTimer("spawn_1", 1700, npc, null); // 1700
startQuestTimer("spawn_2", 3200, npc, null); // 1500
startQuestTimer("spawn_3", 6500, npc, null); // 3300
startQuestTimer("spawn_4", 9400, npc, null); // 2900
startQuestTimer("spawn_5", 12100, npc, null); // 2700
startQuestTimer("spawn_6", 12430, npc, null); // 330
startQuestTimer("spawn_7", 15430, npc, null); // 3000
startQuestTimer("spawn_8", 16830, npc, null); // 1400
startQuestTimer("spawn_9", 23530, npc, null); // 6700 - end of cinematic
startQuestTimer("spawn_10", 26000, npc, null); // 2500 - AI + unlock
}
// Regeneration && inactivity task
else if (event.equalsIgnoreCase("regen_task"))
{
// Inactivity task - 15min
if (GrandBossManager.getInstance().getBossStatus(VALAKAS) == FIGHTING)
{
if ((_timeTracker + 900000) < System.currentTimeMillis())
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
npc.teleToLocation(-105200, -253104, -15264);


GrandBossManager.getInstance().setBossStatus(VALAKAS, DORMANT);
npc.setCurrentHpMp(npc.getMaxHp(), npc.getMaxMp());


// Drop all players from the zone.
ZONE.oustAllPlayers();


// Cancel skill_task and regen_task.
cancelQuestTimer("regen_task", npc, null);
cancelQuestTimer("skill_task", npc, null);
return null;
}
}


int lvl = 0;


// Verify if "Valakas Regeneration" skill is active.
final L2Effect[] effects = npc.getAllEffects();
if ((effects != null) && (effects.length != 0))
{
for (L2Effect e : effects)
{
if (e.getSkill().getId() == 4629)
{
lvl = e.getSkill().getLevel();
break;
}
}
}


// Current HPs are inferior to 25% ; apply lvl 4 of regen skill.
if ((npc.getCurrentHp() < (npc.getMaxHp() / 4)) && (lvl != 4))
{
npc.setTarget(npc);
npc.doCast(SkillTable.getInstance().getInfo(4691, 4));
}
// Current HPs are inferior to 50% ; apply lvl 3 of regen skill.
else if ((npc.getCurrentHp() < ((npc.getMaxHp() * 2) / 4.0)) && (lvl != 3))
{
npc.setTarget(npc);
npc.doCast(SkillTable.getInstance().getInfo(4691, 3));
}
// Current HPs are inferior to 75% ; apply lvl 2 of regen skill.
else if ((npc.getCurrentHp() < ((npc.getMaxHp() * 3) / 4.0)) && (lvl != 2))
{
npc.setTarget(npc);
npc.doCast(SkillTable.getInstance().getInfo(4691, 2));
}
// Apply lvl 1.
else if (lvl != 1)
{
npc.setTarget(npc);
npc.doCast(SkillTable.getInstance().getInfo(4691, 1));
}
}
// Spawn cinematic, regen_task and choose of skill.
else if (event.equalsIgnoreCase("spawn_1"))
{
ZONE.broadcastPacket(new SpecialCamera(npc.getObjectId(), 1800, 180, -1, 1500, 10000, 0, 0, 1, 0));
}
else if (event.equalsIgnoreCase("spawn_2"))
{
ZONE.broadcastPacket(new SpecialCamera(npc.getObjectId(), 1300, 180, -5, 3000, 10000, 0, -5, 1, 0));
}
else if (event.equalsIgnoreCase("spawn_3"))
{
ZONE.broadcastPacket(new SpecialCamera(npc.getObjectId(), 500, 180, -8, 600, 10000, 0, 60, 1, 0));
}
else if (event.equalsIgnoreCase("spawn_4"))
{
ZONE.broadcastPacket(new SpecialCamera(npc.getObjectId(), 800, 180, -8, 2700, 10000, 0, 30, 1, 0));
}
else if (event.equalsIgnoreCase("spawn_5"))
{
ZONE.broadcastPacket(new SpecialCamera(npc.getObjectId(), 200, 250, 70, 0, 10000, 30, 80, 1, 0));
}
else if (event.equalsIgnoreCase("spawn_6"))
{
ZONE.broadcastPacket(new SpecialCamera(npc.getObjectId(), 1100, 250, 70, 2500, 10000, 30, 80, 1, 0));
}
else if (event.equalsIgnoreCase("spawn_7"))
{
ZONE.broadcastPacket(new SpecialCamera(npc.getObjectId(), 700, 150, 30, 0, 10000, -10, 60, 1, 0));
}
else if (event.equalsIgnoreCase("spawn_8"))
{
ZONE.broadcastPacket(new SpecialCamera(npc.getObjectId(), 1200, 150, 20, 2900, 10000, -10, 30, 1, 0));
}
else if (event.equalsIgnoreCase("spawn_9"))
{
ZONE.broadcastPacket(new SpecialCamera(npc.getObjectId(), 750, 170, -10, 3400, 4000, 10, -15, 1, 0));
}
else if (event.equalsIgnoreCase("spawn_10"))
{
GrandBossManager.getInstance().setBossStatus(VALAKAS, FIGHTING);
npc.setIsInvul(false);


startQuestTimer("regen_task", 60000, npc, null, true);
startQuestTimer("skill_task", 2000, npc, null, true);
}
// Death cinematic, spawn of Teleport Cubes.
else if (event.equalsIgnoreCase("die_1"))
{
ZONE.broadcastPacket(new SpecialCamera(npc.getObjectId(), 2000, 130, -1, 0, 10000, 0, 0, 1, 1));
}
else if (event.equalsIgnoreCase("die_2"))
{
ZONE.broadcastPacket(new SpecialCamera(npc.getObjectId(), 1100, 210, -5, 3000, 10000, -13, 0, 1, 1));
}
else if (event.equalsIgnoreCase("die_3"))
{
ZONE.broadcastPacket(new SpecialCamera(npc.getObjectId(), 1300, 200, -8, 3000, 10000, 0, 15, 1, 1));
}
else if (event.equalsIgnoreCase("die_4"))
{
ZONE.broadcastPacket(new SpecialCamera(npc.getObjectId(), 1000, 190, 0, 500, 10000, 0, 10, 1, 1));
}
else if (event.equalsIgnoreCase("die_5"))
{
ZONE.broadcastPacket(new SpecialCamera(npc.getObjectId(), 1700, 120, 0, 2500, 10000, 12, 40, 1, 1));
}
else if (event.equalsIgnoreCase("die_6"))
{
ZONE.broadcastPacket(new SpecialCamera(npc.getObjectId(), 1700, 20, 0, 700, 10000, 10, 10, 1, 1));
}
else if (event.equalsIgnoreCase("die_7"))
{
ZONE.broadcastPacket(new SpecialCamera(npc.getObjectId(), 1700, 10, 0, 1000, 10000, 20, 70, 1, 1));
}
else if (event.equalsIgnoreCase("die_8"))
{
ZONE.broadcastPacket(new SpecialCamera(npc.getObjectId(), 1700, 10, 0, 300, 250, 20, -20, 1, 1));


for (Location loc : TELEPORT_CUBE_LOCATIONS)
{
addSpawn(31759, loc, false, 900000);
}


startQuestTimer("remove_players", 900000, null, null);
}
else if (event.equalsIgnoreCase("skill_task"))
{
callSkillAI(npc);
}
}
else
{
if (event.equalsIgnoreCase("valakas_unlock"))
{
final L2Npc valakas = addSpawn(VALAKAS, -105200, -253104, -15264, 32768, false, 0);
GrandBossManager.getInstance().addBoss((L2GrandBossInstance) valakas);
GrandBossManager.getInstance().setBossStatus(VALAKAS, DORMANT);
}
else if (event.equalsIgnoreCase("remove_players"))
{
ZONE.oustAllPlayers();
}
}
return super.onAdvEvent(event, npc, player);
}


@Override
public String onSpawn(L2Npc npc)
{
npc.disableCoreAI(true);
return super.onSpawn(npc);
}


@Override
public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon)
{
if (!ZONE.isInsideZone(attacker))
{
attacker.doDie(attacker);
return null;
}


if (npc.isInvul())
{
return null;
}


if (GrandBossManager.getInstance().getBossStatus(VALAKAS) != FIGHTING)
{
attacker.teleToLocation(150037, -57255, -2976);
return null;
}


// Debuff strider-mounted players.
if (attacker.getMountType() == 1)
{
final L2Skill skill = SkillTable.getInstance().getInfo(4258, 1);
if (attacker.getFirstEffect(skill) == null)
{
npc.setTarget(attacker);
npc.doCast(skill);
}
}
_timeTracker = System.currentTimeMillis();


return super.onAttack(npc, attacker, damage, isSummon);
}


@Override
public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
{
// Cancel skill_task and regen_task.
cancelQuestTimer("regen_task", npc, null);
cancelQuestTimer("skill_task", npc, null);


// Launch death animation.
ZONE.broadcastPacket(new PlaySound(1, "B03_D", 0, 0, 0, 0, 0));
ZONE.broadcastPacket(new SpecialCamera(npc.getObjectId(), 1200, 20, -10, 0, 13000, 0, 0, 1, 0));


startQuestTimer("die_1", 300, npc, null); // 300
startQuestTimer("die_2", 600, npc, null); // 300
startQuestTimer("die_3", 3800, npc, null); // 3200
startQuestTimer("die_4", 8200, npc, null); // 4400
startQuestTimer("die_5", 8700, npc, null); // 500
startQuestTimer("die_6", 13300, npc, null); // 4600
startQuestTimer("die_7", 14000, npc, null); // 700
startQuestTimer("die_8", 16500, npc, null); // 2500


GrandBossManager.getInstance().setBossStatus(VALAKAS, DEAD);
// Calculate Min and Max respawn times randomly.
long respawnTime = Config.VALAKAS_SPAWN_INTERVAL + getRandom(-Config.VALAKAS_SPAWN_RANDOM, Config.VALAKAS_SPAWN_RANDOM);
respawnTime *= 3600000;


startQuestTimer("valakas_unlock", respawnTime, null, null);
// also save the respawn time so that the info is maintained past reboots
StatsSet info = GrandBossManager.getInstance().getStatsSet(VALAKAS);
info.set("respawn_time", (System.currentTimeMillis() + respawnTime));
GrandBossManager.getInstance().setStatsSet(VALAKAS, info);


return super.onKill(npc, killer, isSummon);
}


@Override
public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon)
{
return null;
}


private void callSkillAI(L2Npc npc)
{
if (npc.isInvul() || npc.isCastingNow())
{
return;
}


// Pickup a target if no or dead victim. 10% luck he decides to reconsiders his target.
if ((_actualVictim == null) || _actualVictim.isDead() || !(npc.getKnownList().knowsObject(_actualVictim)) || (getRandom(10) == 0))
{
_actualVictim = getRandomTarget(npc);
}


// If result is still null, Valakas will roam. Don't go deeper in skill AI.
if (_actualVictim == null)
{
if (getRandom(10) == 0)
{
int x = npc.getX();
int y = npc.getY();
int z = npc.getZ();


int posX = x + getRandom(-1400, 1400);
int posY = y + getRandom(-1400, 1400);


if (GeoData.getInstance().canMoveFromToTarget(x, y, z, posX, posY, z, npc.getInstanceId()))
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, new L2CharPosition(posX, posY, z, 0));
}
}
return;
}


final L2Skill skill = getRandomSkill(npc).getSkill();


// Cast the skill or follow the target.
if (Util.checkIfInRange((skill.getCastRange() < 600) ? 600 : skill.getCastRange(), npc, _actualVictim, true))
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
npc.setIsCastingNow(true);
npc.setTarget(_actualVictim);
npc.doCast(skill);
}
else
{
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, _actualVictim, null);
npc.setIsCastingNow(false);
}
}


/**
* Pick a random skill.<br>
* Valakas will mostly use utility skills. If Valakas feels surrounded, he will use AoE skills.<br>
* Lower than 50% HPs, he will begin to use Meteor skill.
* @param npc valakas
* @return a skill holder
*/
private SkillHolder getRandomSkill(L2Npc npc)
{
final int hpRatio = (int) ((npc.getCurrentHp() / npc.getMaxHp()) * 100);


// Valakas Lava Skin has priority.
if ((hpRatio < 75) && (getRandom(150) == 0) && (npc.getFirstEffect(VALAKAS_LAVA_SKIN.getSkillId()) == null))
{
return VALAKAS_LAVA_SKIN;
}


// Valakas will use mass spells if he feels surrounded.
if (Util.getPlayersCountInRadius(1200, npc, false, false) >= 20)
{
return VALAKAS_AOE_SKILLS[getRandom(VALAKAS_AOE_SKILLS.length)];
}


if (hpRatio > 50)
{
return VALAKAS_REGULAR_SKILLS[getRandom(VALAKAS_REGULAR_SKILLS.length)];
}


return VALAKAS_LOWHP_SKILLS[getRandom(VALAKAS_LOWHP_SKILLS.length)];
}


/**
* Pickup a random L2Playable from the zone, deads targets aren't included.
* @param npc
* @return a random L2Playable.
*/
private L2Playable getRandomTarget(L2Npc npc)
{
List<L2Playable> result = new ArrayList<>();


for (L2Character obj : npc.getKnownList().getKnownCharacters())
{
if ((obj == null) || obj.isPet())
{
continue;
}
else if (!obj.isDead() && obj.isPlayable())
{
result.add((L2Playable) obj);
}
}


return (result.isEmpty()) ? null : result.get(getRandom(result.size()));
}


public static void main(String[] args)
{
new Valakas(Valakas.class.getSimpleName(), "ai");
}
}

none of both :/

  • 0
Posted (edited)

Someone knows how to change zaken or valakas?

For zaken, in my revision I have an option into config/GrandBoss.properties. Dunno if this is the case for you.

# ---------------------------------------------------------------------------
# Zaken
# ---------------------------------------------------------------------------
# Day time minimum players
MinDaytimeZakenPlayers = 9
 
# Night time minimum players
MinNightimeZakenPlayers = 72
 
# Top Day time minimum players
MinTopDaytimeZakenPlayers = 9
Edited by marciox25
  • 0
Posted

I dont remember Valakas and Antharas having an minimum. Weren't their spawnings triggered when someone enters via the crystal, then after X amount minutes it just starts?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...