Sfoglia il codice sorgente

BETA: Continuing with AI review:
* Do not use SkillTable.getInstance().getInfo(id, level) instead use SkillHolder DTO.
* Is possible to change the underlying implementation without reworking every single script.
* Avoids some problems during reloading.
* Static final variables should be upper case.
* Minimize the use of @formatter:off
* Use arrays of Location instead of arrays of arrays of int.
* Don't use literal values in the middle of the code, use static final variables for Ids, levels and other values.
* Document the code when something is not finished/retail like.
* When you work in open source is important to note that you knew it wasn't finished and let others know it as well.

Zoey76 12 anni fa
parent
commit
3f37dba696

+ 15 - 7
L2J_DataPack_BETA/dist/game/data/scripts/ai/individual/Baium.java

@@ -48,13 +48,21 @@ import com.l2jserver.gameserver.network.serverpackets.PlaySound;
 import com.l2jserver.gameserver.util.Util;
 
 /**
- * Baium AI Note1: if the server gets rebooted while players are still fighting Baium, there is no lock, but players also lose their ability to wake baium up. However, should another person enter the room and wake him up, the players who had stayed inside may join the raid. This can be helpful for
- * players who became victims of a reboot (they only need 1 new player to enter and wake up baium) and is not too exploitable since any player wishing to exploit it would have to suffer 5 days of being parked in an empty room. Note2: Neither version of Baium should be a permanent spawn. This script
- * is fully capable of spawning the statue-version when the lock expires and switching it to the mob version promptly. Additional notes ( source http://aleenaresron.blogspot.com/2006_08_01_archive.html ): * Baium only first respawns five days after his last death. And from those five days he will
- * respawn within 1-8 hours of his last death. So, you have to know his last time of death. * If by some freak chance you are the only one in Baium's chamber and NO ONE comes in [ha, ha] you or someone else will have to wake Baium. There is a good chance that Baium will automatically kill whoever
- * wakes him. There are some people that have been able to wake him and not die, however if you've already gone through the trouble of getting the bloody fabric and camped him out and researched his spawn time, are you willing to take that chance that you'll wake him and not be able to finish your
- * quest? Doubtful. [ this powerful attack vs the player who wakes him up is NOT yet implemented here] * once someone starts attacking Baium no one else can port into the chamber where he is. Unlike with the other raid bosses, you can just show up at any time as long as you are there when they die.
- * Not true with Baium. Once he gets attacked, the port to Baium closes. byebye, see you in 5 days. If nobody attacks baium for 30 minutes, he auto-despawns and unlocks the vortex
+ * Baium's AI.<br>
+ * Note1: if the server gets rebooted while players are still fighting Baium, there is no lock, but players also lose their ability to wake Baium up.<br>
+ * However, should another person enter the room and wake him up, the players who had stayed inside may join the raid.<br>
+ * This can be helpful for players who became victims of a reboot (they only need 1 new player to enter and wake up Baium) and is not too exploitable since any player wishing to exploit it would have to suffer 5 days of being parked in an empty room.<br>
+ * Note2: Neither version of Baium should be a permanent spawn.<br>
+ * This script is fully capable of spawning the statue-version when the lock expires and switching it to the mob version promptly.<br>
+ * Additional notes ( source http://aleenaresron.blogspot.com/2006_08_01_archive.html ):
+ * <ul>
+ * <li>Baium only first respawns five days after his last death. And from those five days he will respawn within 1-8 hours of his last death. So, you have to know his last time of death.</li>
+ * <li>If by some freak chance you are the only one in Baium's chamber and NO ONE comes in [ha, ha] you or someone else will have to wake Baium.<br>
+ * There is a good chance that Baium will automatically kill whoever wakes him.<br>
+ * There are some people that have been able to wake him and not die, however if you've already gone through the trouble of getting the bloody fabric and camped him out and researched his spawn time,<br>
+ * are you willing to take that chance that you'll wake him and not be able to finish your quest? Doubtful. [ this powerful attack vs the player who wakes him up is NOT yet implemented here]</li>
+ * <li>Once someone starts attacking Baium no one else can port into the chamber where he is. Unlike with the other raid bosses, you can just show up at any time as long as you are there when they die.<br>
+ * Not true with Baium. Once he gets attacked, the port to Baium closes. byebye, see you in 5 days. If nobody attacks Baium for 30 minutes, he auto-despawns and unlocks the vortex.</li>
  * @author Fulminus version 0.1
  */
 public class Baium extends AbstractNpcAI

+ 18 - 18
L2J_DataPack_BETA/dist/game/data/scripts/ai/individual/Beleth.java

@@ -25,7 +25,6 @@ import com.l2jserver.gameserver.ai.CtrlIntention;
 import com.l2jserver.gameserver.cache.HtmCache;
 import com.l2jserver.gameserver.datatables.DoorTable;
 import com.l2jserver.gameserver.datatables.NpcTable;
-import com.l2jserver.gameserver.datatables.SkillTable;
 import com.l2jserver.gameserver.instancemanager.GrandBossManager;
 import com.l2jserver.gameserver.instancemanager.ZoneManager;
 import com.l2jserver.gameserver.model.L2Object;
@@ -38,6 +37,7 @@ import com.l2jserver.gameserver.model.actor.L2Npc;
 import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
+import com.l2jserver.gameserver.model.holders.SkillHolder;
 import com.l2jserver.gameserver.model.skills.L2Skill;
 import com.l2jserver.gameserver.model.skills.L2SkillType;
 import com.l2jserver.gameserver.model.zone.L2ZoneType;
@@ -70,10 +70,10 @@ public class Beleth extends AbstractNpcAI
 	private static int KILLED = 0;
 	protected static ScheduledFuture<?> SPAWN_TIMER = null;
 	protected static ArrayList<L2Npc> MINIONS = new ArrayList<>();
-	private static L2Skill BLEED = SkillTable.getInstance().getInfo(5495, 1);
-	private static L2Skill FIREBALL = SkillTable.getInstance().getInfo(5496, 1);
-	private static L2Skill HORN_OF_RISING = SkillTable.getInstance().getInfo(5497, 1);
-	private static L2Skill LIGHTENING = SkillTable.getInstance().getInfo(5499, 1);
+	private static SkillHolder BLEED = new SkillHolder(5495, 1);
+	private static SkillHolder FIREBALL = new SkillHolder(5496, 1);
+	private static SkillHolder HORN_OF_RISING = new SkillHolder(5497, 1);
+	private static SkillHolder LIGHTENING = new SkillHolder(5499, 1);
 	
 	private Beleth(String name, String descr)
 	{
@@ -142,10 +142,10 @@ public class Beleth extends AbstractNpcAI
 	
 	private static class Cast implements Runnable
 	{
-		L2Skill _skill;
+		SkillHolder _skill;
 		L2Npc _npc;
 		
-		public Cast(L2Skill skill, L2Npc npc)
+		public Cast(SkillHolder skill, L2Npc npc)
 		{
 			_skill = skill;
 			_npc = npc;
@@ -157,7 +157,7 @@ public class Beleth extends AbstractNpcAI
 			if ((_npc != null) && !_npc.isDead() && !_npc.isCastingNow())
 			{
 				_npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
-				_npc.doCast(_skill);
+				_npc.doCast(_skill.getSkill());
 			}
 		}
 	}
@@ -462,7 +462,7 @@ public class Beleth extends AbstractNpcAI
 		if ((npc != null) && !npc.isDead() && ((npc.getNpcId() == 29118) || (npc.getNpcId() == 29119)) && !npc.isCastingNow() && (skill.getSkillType() == L2SkillType.HEAL) && (getRandom(100) < 80))
 		{
 			npc.setTarget(player);
-			npc.doCast(HORN_OF_RISING);
+			npc.doCast(HORN_OF_RISING.getSkill());
 		}
 		return null;
 	}
@@ -499,20 +499,20 @@ public class Beleth extends AbstractNpcAI
 					if ((beleth != null) && !beleth.isDead() && Util.checkIfInRange(900, beleth, attacker, false) && !beleth.isCastingNow())
 					{
 						beleth.setTarget(attacker);
-						beleth.doCast(FIREBALL);
+						beleth.doCast(FIREBALL.getSkill());
 					}
 				}
 				if ((BELETH != null) && !BELETH.isDead() && Util.checkIfInRange(900, BELETH, attacker, false) && !BELETH.isCastingNow())
 				{
 					BELETH.setTarget(attacker);
-					BELETH.doCast(FIREBALL);
+					BELETH.doCast(FIREBALL.getSkill());
 				}
 			}
 			else if (!npc.isDead() && !npc.isCastingNow())
 			{
 				if (!npc.getKnownList().getKnownPlayersInRadius(200).isEmpty())
 				{
-					npc.doCast(LIGHTENING);
+					npc.doCast(LIGHTENING.getSkill());
 					return null;
 				}
 				((L2Attackable) npc).clearAggroList();
@@ -541,7 +541,7 @@ public class Beleth extends AbstractNpcAI
 				else if (distance2 < 890)
 				{
 					npc.setTarget(player);
-					npc.doCast(FIREBALL);
+					npc.doCast(FIREBALL.getSkill());
 				}
 				return null;
 			}
@@ -549,14 +549,14 @@ public class Beleth extends AbstractNpcAI
 			{
 				if (!npc.getKnownList().getKnownPlayersInRadius(200).isEmpty())
 				{
-					npc.doCast(LIGHTENING);
+					npc.doCast(LIGHTENING.getSkill());
 					return null;
 				}
 			}
 			for (L2PcInstance plr : npc.getKnownList().getKnownPlayersInRadius(950))
 			{
 				npc.setTarget(plr);
-				npc.doCast(FIREBALL);
+				npc.doCast(FIREBALL.getSkill());
 				return null;
 			}
 			((L2Attackable) npc).clearAggroList();
@@ -573,12 +573,12 @@ public class Beleth extends AbstractNpcAI
 			{
 				if (!npc.getKnownList().getKnownPlayersInRadius(200).isEmpty())
 				{
-					npc.doCast(BLEED);
+					npc.doCast(BLEED.getSkill());
 					return null;
 				}
 			}
 			npc.setTarget(player);
-			npc.doCast(FIREBALL);
+			npc.doCast(FIREBALL.getSkill());
 		}
 		return null;
 	}
@@ -591,7 +591,7 @@ public class Beleth extends AbstractNpcAI
 			npc.setRunning();
 			if (!MOVIE && !npc.getKnownList().getKnownPlayersInRadius(300).isEmpty() && (getRandom(100) < 60))
 			{
-				npc.doCast(BLEED);
+				npc.doCast(BLEED.getSkill());
 			}
 			if (npc.getNpcId() == 29118)
 			{

+ 5 - 2
L2J_DataPack_BETA/dist/game/data/scripts/ai/individual/DarkWaterDragon.java

@@ -17,7 +17,6 @@ package ai.individual;
 import java.util.Map;
 import java.util.Set;
 
-import javolution.util.FastMap;
 import javolution.util.FastSet;
 import ai.npc.AbstractNpcAI;
 
@@ -27,7 +26,11 @@ import com.l2jserver.gameserver.model.actor.L2Attackable;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.L2Npc;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.util.L2FastMap;
 
+/**
+ * Dark Water Dragon's AI.
+ */
 public class DarkWaterDragon extends AbstractNpcAI
 {
 	private static final int DRAGON = 22267;
@@ -38,7 +41,7 @@ public class DarkWaterDragon extends AbstractNpcAI
 	private static final int DETRACTOR2 = 22271;
 	private static Set<Integer> SECOND_SPAWN = new FastSet<>(); // Used to track if second Shades were already spawned
 	private static Set<Integer> MY_TRACKING_SET = new FastSet<>(); // Used to track instances of npcs
-	private static Map<Integer, L2PcInstance> ID_MAP = new FastMap<Integer, L2PcInstance>().shared(); // Used to track instances of npcs
+	private static Map<Integer, L2PcInstance> ID_MAP = new L2FastMap<>(true); // Used to track instances of npcs
 	
 	private DarkWaterDragon(String name, String descr)
 	{

+ 7 - 6
L2J_DataPack_BETA/dist/game/data/scripts/ai/individual/DemonPrince.java

@@ -25,6 +25,7 @@ import com.l2jserver.gameserver.model.holders.SkillHolder;
 import com.l2jserver.gameserver.model.skills.L2Skill;
 
 /**
+ * Demon Prince's AI.
  * @author GKR
  */
 public class DemonPrince extends AbstractNpcAI
@@ -40,7 +41,7 @@ public class DemonPrince extends AbstractNpcAI
 		new SkillHolder(5376, 6)
 	};
 	
-	private static final Map<Integer, Boolean> _attackState = new FastMap<>();
+	private static final Map<Integer, Boolean> ATTACK_STATE = new FastMap<>();
 	
 	private DemonPrince(String name, String descr)
 	{
@@ -65,17 +66,17 @@ public class DemonPrince extends AbstractNpcAI
 	{
 		if (!npc.isDead())
 		{
-			if (!_attackState.containsKey(npc.getObjectId()) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.5)))
+			if (!ATTACK_STATE.containsKey(npc.getObjectId()) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.5)))
 			{
 				npc.doCast(UD.getSkill());
 				spawnMinions(npc);
-				_attackState.put(npc.getObjectId(), false);
+				ATTACK_STATE.put(npc.getObjectId(), false);
 			}
-			else if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.1)) && _attackState.containsKey(npc.getObjectId()) && (_attackState.get(npc.getObjectId()) == false))
+			else if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.1)) && ATTACK_STATE.containsKey(npc.getObjectId()) && (ATTACK_STATE.get(npc.getObjectId()) == false))
 			{
 				npc.doCast(UD.getSkill());
 				spawnMinions(npc);
-				_attackState.put(npc.getObjectId(), true);
+				ATTACK_STATE.put(npc.getObjectId(), true);
 			}
 			
 			if (getRandom(1000) < 10)
@@ -89,7 +90,7 @@ public class DemonPrince extends AbstractNpcAI
 	@Override
 	public String onKill(L2Npc npc, L2PcInstance killer, boolean isPet)
 	{
-		_attackState.remove(npc.getObjectId());
+		ATTACK_STATE.remove(npc.getObjectId());
 		return super.onKill(npc, killer, isPet);
 	}
 	

+ 1 - 2
L2J_DataPack_BETA/dist/game/data/scripts/ai/individual/DrChaos.java

@@ -25,12 +25,11 @@ import com.l2jserver.gameserver.network.serverpackets.PlaySound;
 import com.l2jserver.gameserver.network.serverpackets.SpecialCamera;
 
 /**
- * DrChaos AI
+ * DrChaos' AI
  * @author Kerberos
  */
 public class DrChaos extends Quest
 {
-	
 	private static final int DOCTER_CHAOS = 32033;
 	private static final int STRANGE_MACHINE = 32032;
 	private static final int CHAOS_GOLEM = 25703;

+ 2 - 1
L2J_DataPack_BETA/dist/game/data/scripts/ai/individual/NaiaLock.java

@@ -21,7 +21,8 @@ import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 
 /**
- * Removes minions after master's death
+ * Naia Lock AI.<br>
+ * Removes minions after master's death.
  * @author GKR
  */
 public class NaiaLock extends AbstractNpcAI

+ 5 - 7
L2J_DataPack_BETA/dist/game/data/scripts/ai/individual/Orfen.java

@@ -40,28 +40,26 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay;
 import com.l2jserver.gameserver.network.serverpackets.PlaySound;
 
 /**
- * Orfen AI
+ * Orfen's AI
  * @author Emperorc
  */
 public class Orfen extends AbstractNpcAI
 {
-	//@formatter:off
 	private static final Location[] POS =
 	{
-		new Location(43728, 17220, -4342), 
+		new Location(43728, 17220, -4342),
 		new Location(55024, 17368, -5412),
-		new Location(53504, 21248, -5486), 
+		new Location(53504, 21248, -5486),
 		new Location(53248, 24576, -5262)
 	};
 	
 	private static final NpcStringId[] TEXT =
 	{
 		NpcStringId.S1_STOP_KIDDING_YOURSELF_ABOUT_YOUR_OWN_POWERLESSNESS,
-		NpcStringId.S1_ILL_MAKE_YOU_FEEL_WHAT_TRUE_FEAR_IS, 
-		NpcStringId.YOURE_REALLY_STUPID_TO_HAVE_CHALLENGED_ME_S1_GET_READY, 
+		NpcStringId.S1_ILL_MAKE_YOU_FEEL_WHAT_TRUE_FEAR_IS,
+		NpcStringId.YOURE_REALLY_STUPID_TO_HAVE_CHALLENGED_ME_S1_GET_READY,
 		NpcStringId.S1_DO_YOU_THINK_THATS_GOING_TO_WORK
 	};
-	//@formatter:on
 	
 	private static final int ORFEN = 29014;
 	// private static final int RAIKEL = 29015;

+ 1 - 0
L2J_DataPack_BETA/dist/game/data/scripts/ai/individual/OutpostCaptain.java

@@ -23,6 +23,7 @@ import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 
 /**
+ * Outpost Captain's AI.
  * @author DS
  */
 public class OutpostCaptain extends AbstractNpcAI

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/ai/individual/QueenAnt.java

@@ -38,7 +38,7 @@ import com.l2jserver.gameserver.network.serverpackets.PlaySound;
 import com.l2jserver.util.Rnd;
 
 /**
- * Queen Ant AI
+ * Queen Ant's AI
  * @author Emperorc
  */
 public class QueenAnt extends AbstractNpcAI

+ 1 - 1
L2J_DataPack_BETA/dist/game/data/scripts/ai/individual/SinWardens.java

@@ -27,7 +27,7 @@ import com.l2jserver.gameserver.network.clientpackets.Say2;
 import com.l2jserver.gameserver.network.serverpackets.NpcSay;
 
 /**
- * Manages Sin Wardens disappearing and chat
+ * Manages Sin Wardens disappearing and chat.
  * @author GKR
  */
 public class SinWardens extends AbstractNpcAI

+ 1 - 0
L2J_DataPack_BETA/dist/game/data/scripts/ai/individual/Typhoon.java

@@ -23,6 +23,7 @@ import com.l2jserver.gameserver.model.actor.instance.L2RaidBossInstance;
 import com.l2jserver.gameserver.model.holders.SkillHolder;
 
 /**
+ * Typhoon's AI.
  * @author GKR
  */
 public class Typhoon extends AbstractNpcAI

+ 58 - 118
L2J_DataPack_BETA/dist/game/data/scripts/ai/individual/Valakas.java

@@ -25,6 +25,7 @@ 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;
@@ -32,6 +33,7 @@ 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;
@@ -40,129 +42,67 @@ import com.l2jserver.gameserver.network.serverpackets.SpecialCamera;
 import com.l2jserver.gameserver.util.Util;
 
 /**
- * Valakas AI
+ * Valakas' AI.
  * @author Tryskell
  */
 public class Valakas extends AbstractNpcAI
 {
-	private long _timeTracker = 0; // Time tracker for last attack on Valakas.
-	private L2Playable _actualVictim; // Actual target of Valakas.
-	
+	// NPCs
 	private static final int VALAKAS = 29028;
-	
-	// 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.
-	
-	private static final int[] VALAKAS_REGULAR_SKILLS =
+	// Skills
+	private static final SkillHolder VALAKAS_LAVA_SKIN = new SkillHolder(4680, 1);
+	private static final SkillHolder[] VALAKAS_REGULAR_SKILLS =
 	{
-		4681,
-		4682,
-		4683,
-		4689
+		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 int[] VALAKAS_LOWHP_SKILLS =
+	private static final SkillHolder[] VALAKAS_LOWHP_SKILLS =
 	{
-		4681,
-		4682,
-		4683,
-		4689,
-		4690
+		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 int[] VALAKAS_AOE_SKILLS =
+	private static final SkillHolder[] VALAKAS_AOE_SKILLS =
 	{
-		4683,
-		4684,
-		4685,
-		4686,
-		4688,
-		4689,
-		4690
+		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
 	};
-	
-	private static final int _teleportCubeLocation[][] =
+	// Locations
+	private static final Location TELEPORT_CUBE_LOCATIONS[] =
 	{
-		{
-			214880,
-			-116144,
-			-1644
-		},
-		{
-			213696,
-			-116592,
-			-1644
-		},
-		{
-			212112,
-			-116688,
-			-1644
-		},
-		{
-			211184,
-			-115472,
-			-1664
-		},
-		{
-			210336,
-			-114592,
-			-1644
-		},
-		{
-			211360,
-			-113904,
-			-1644
-		},
-		{
-			213152,
-			-112352,
-			-1644
-		},
-		{
-			214032,
-			-113232,
-			-1644
-		},
-		{
-			214752,
-			-114592,
-			-1644
-		},
-		{
-			209824,
-			-115568,
-			-1421
-		},
-		{
-			210528,
-			-112192,
-			-1403
-		},
-		{
-			213120,
-			-111136,
-			-1408
-		},
-		{
-			215184,
-			-111504,
-			-1392
-		},
-		{
-			215456,
-			-117328,
-			-1392
-		},
-		{
-			213200,
-			-118160,
-			-1424
-		}
+		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)
@@ -410,9 +350,9 @@ public class Valakas extends AbstractNpcAI
 			{
 				ZONE.broadcastPacket(new SpecialCamera(npc.getObjectId(), 1700, 10, 0, 300, 250, 20, -20, 1, 1));
 				
-				for (int[] element : _teleportCubeLocation)
+				for (Location loc : TELEPORT_CUBE_LOCATIONS)
 				{
-					addSpawn(31759, element[0], element[1], element[2], 0, false, 900000);
+					addSpawn(31759, loc, false, 900000);
 				}
 				
 				startQuestTimer("remove_players", 900000, null, null);
@@ -551,7 +491,7 @@ public class Valakas extends AbstractNpcAI
 			return;
 		}
 		
-		final L2Skill skill = SkillTable.getInstance().getInfo(getRandomSkill(npc), 1);
+		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))
@@ -573,16 +513,16 @@ public class Valakas extends AbstractNpcAI
 	 * 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 usable skillId
+	 * @return a skill holder
 	 */
-	private int getRandomSkill(L2Npc npc)
+	private SkillHolder getRandomSkill(L2Npc npc)
 	{
 		final int hpRatio = (int) ((npc.getCurrentHp() / npc.getMaxHp()) * 100);
 		
-		// Valakas Lava Skin is prioritary.
-		if ((hpRatio < 75) && (getRandom(150) == 0) && (npc.getFirstEffect(4680) == null))
+		// Valakas Lava Skin has priority.
+		if ((hpRatio < 75) && (getRandom(150) == 0) && (npc.getFirstEffect(VALAKAS_LAVA_SKIN.getSkillId()) == null))
 		{
-			return 4680;
+			return VALAKAS_LAVA_SKIN;
 		}
 		
 		// Valakas will use mass spells if he feels surrounded.

+ 4 - 8
L2J_DataPack_BETA/dist/game/data/scripts/ai/individual/Zaken.java

@@ -14,8 +14,6 @@
  */
 package ai.individual;
 
-import java.util.logging.Logger;
-
 import ai.npc.AbstractNpcAI;
 
 import com.l2jserver.Config;
@@ -42,8 +40,6 @@ import com.l2jserver.gameserver.network.serverpackets.PlaySound;
  */
 public class Zaken extends AbstractNpcAI
 {
-	protected static final Logger log = Logger.getLogger(Zaken.class.getName());
-	
 	private int _1001 = 0; // used for first cancel of QuestTimer "1001"
 	private int _ai0 = 0; // used for zaken coords updater
 	private int _ai1 = 0; // used for X coord tracking for non-random teleporting in zaken's self teleport skill
@@ -152,7 +148,7 @@ public class Zaken extends AbstractNpcAI
 								}
 								catch (Throwable e)
 								{
-									log.warning("Cannot close door ID: 21240006 " + e);
+									_log.warning("Cannot close door ID: 21240006 " + e);
 								}
 							}
 						}, 300000L);
@@ -160,7 +156,7 @@ public class Zaken extends AbstractNpcAI
 				}
 				catch (Throwable e)
 				{
-					log.warning("Cannot open door ID: 21240006 " + e);
+					_log.warning("Cannot open door ID: 21240006 " + e);
 				}
 			}
 		}, 2000L, 600000L);
@@ -215,7 +211,7 @@ public class Zaken extends AbstractNpcAI
 	{
 		if (npc == null)
 		{
-			log.warning("Zaken AI failed to load, missing Zaken in grandboss_data.sql");
+			_log.warning("Zaken AI failed to load, missing Zaken in grandboss_data.sql");
 			return;
 		}
 		GrandBossManager.getInstance().addBoss(npc);
@@ -230,7 +226,7 @@ public class Zaken extends AbstractNpcAI
 		_quest2 = 3;
 		if (_Zone == null)
 		{
-			log.warning("Zaken AI failed to load, missing zone for Zaken");
+			_log.warning("Zaken AI failed to load, missing zone for Zaken");
 			return;
 		}
 		if (_Zone.isInsideZone(npc))