From c9b1abc8af6bd8d4fe5cd977b38b49bda5201333 Mon Sep 17 00:00:00 2001
From: St3eT <St3eT@users.noreply.github.com>
Date: Sat, 17 May 2014 12:28:03 +0000
Subject: [PATCH] BETA: Reworked '''Zaken''' to instance. * Reviewed by:
 Adry_85, !UnAfraid, Zoey76, Nos, malyelfik

---
 .../dist/game/data/html/default/32713-2.htm   |    2 +-
 .../dist/game/data/html/default/32713-3.htm   |    6 +
 .../dist/game/data/html/default/32713.htm     |    3 +-
 .../CavernOfThePirateCaptainWorldDay60.xml    |    7 +
 .../CavernOfThePirateCaptainWorldDay83.xml    |    7 +
 L2J_DataPack_BETA/dist/game/data/scripts.cfg  |    2 +-
 .../data/scripts/ai/individual/Zaken.java     | 1032 -----------------
 .../CavernOfThePirateCaptain.java             |  592 ++++++++++
 .../dist/game/data/xsd/instance.xsd           |    2 +
 .../dist/game/data/zones/custom_boss.xml      |    8 -
 .../dist/sql/game/grandboss_data.sql          |    2 +-
 .../dist/sql/game/updates/20140517update.sql  |    1 +
 12 files changed, 620 insertions(+), 1044 deletions(-)
 create mode 100644 L2J_DataPack_BETA/dist/game/data/html/default/32713-3.htm
 create mode 100644 L2J_DataPack_BETA/dist/game/data/instances/CavernOfThePirateCaptainWorldDay60.xml
 create mode 100644 L2J_DataPack_BETA/dist/game/data/instances/CavernOfThePirateCaptainWorldDay83.xml
 delete mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/ai/individual/Zaken.java
 create mode 100644 L2J_DataPack_BETA/dist/game/data/scripts/instances/CavernOfThePirateCaptain/CavernOfThePirateCaptain.java
 create mode 100644 L2J_DataPack_BETA/dist/sql/game/updates/20140517update.sql

diff --git a/L2J_DataPack_BETA/dist/game/data/html/default/32713-2.htm b/L2J_DataPack_BETA/dist/game/data/html/default/32713-2.htm
index 969e3bbfd4..af6d1acd43 100644
--- a/L2J_DataPack_BETA/dist/game/data/html/default/32713-2.htm
+++ b/L2J_DataPack_BETA/dist/game/data/html/default/32713-2.htm
@@ -4,5 +4,5 @@ Unlike his nighttime counterpart, he hides himself because he knows he is weak..
 But there is a way to find him. Light a <font color="LEVEL">candle on a barrel</font> and it will show you the way.<br>
 But be careful! The candlelight may also alert his subordinates to your location.<br>
 Compared to Nighttime Zaken, Daytime Zaken is not that strong -- you should be able to attack him with a combined force of <font color="LEVEL">1 to 3 parties</font>.<br>
-<a action="bypass -h npc_%objectId%_Quest">Challenge Daytime Zaken.</a>
+<a action="bypass -h Quest CavernOfThePirateCaptain enter60">Challenge Daytime Zaken.</a>
 </body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/html/default/32713-3.htm b/L2J_DataPack_BETA/dist/game/data/html/default/32713-3.htm
new file mode 100644
index 0000000000..1a93a67b43
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/html/default/32713-3.htm
@@ -0,0 +1,6 @@
+<html><body>Pathfinder Worker:<br>
+We have found out that Zaken has a way to manifest his Daytime presence to be even stronger than before.<br>
+Our reports indicate that you can face him just like the regular Daytime Zaken, but it won't be easy.<br>
+(Only level 78-85 can enter.)<br>
+<a action="bypass -h Quest CavernOfThePirateCaptain enter83">Challenge Daytime Zaken (Difficult).</a>
+</body></html>
diff --git a/L2J_DataPack_BETA/dist/game/data/html/default/32713.htm b/L2J_DataPack_BETA/dist/game/data/html/default/32713.htm
index b0803b5454..503b0206fb 100644
--- a/L2J_DataPack_BETA/dist/game/data/html/default/32713.htm
+++ b/L2J_DataPack_BETA/dist/game/data/html/default/32713.htm
@@ -3,5 +3,6 @@ Pirate King Zaken once lived here. But it's been said that he may have allied hi
 We believe that he has now created a giant Dream Dimension by drawing on the power of night.<br>
 Because of that, Zaken was separated into two individuals, one corporeal during the day and the other at night. He is more powerful now than ever, and he has been attacking the real world from the Dream Dimension.<br>
 <a action="bypass -h npc_%objectId%_Chat 1">Ask how to fight Nighttime Zaken.</a><br>
-<a action="bypass -h npc_%objectId%_Chat 2">Ask how to fight Daytime Zaken.</a>
+<a action="bypass -h npc_%objectId%_Chat 2">Ask how to fight Daytime Zaken.</a><br>
+<a action="bypass -h npc_%objectId%_Chat 3">Ask how to fight Daytime Zaken (Difficult).</a>
 </body></html>
\ No newline at end of file
diff --git a/L2J_DataPack_BETA/dist/game/data/instances/CavernOfThePirateCaptainWorldDay60.xml b/L2J_DataPack_BETA/dist/game/data/instances/CavernOfThePirateCaptainWorldDay60.xml
new file mode 100644
index 0000000000..0bfa972c4b
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/instances/CavernOfThePirateCaptainWorldDay60.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<instance name="Cavern of the Pirate Captain (Daydream-61)" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/instance.xsd">
+	<activityTime val="60"/>
+	<allowSummon val="false"/>
+	<showTimer val="true" increase="true" text="Elapsed Time :" />
+	<spawnPoint spawnX="52212" spawnY="218998" spawnZ="-3208" />
+</instance>
diff --git a/L2J_DataPack_BETA/dist/game/data/instances/CavernOfThePirateCaptainWorldDay83.xml b/L2J_DataPack_BETA/dist/game/data/instances/CavernOfThePirateCaptainWorldDay83.xml
new file mode 100644
index 0000000000..0694c48d15
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/instances/CavernOfThePirateCaptainWorldDay83.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<instance name="Cavern of the Pirate Captain (Daydream-83)" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/instance.xsd">
+	<activityTime val="60"/>
+	<allowSummon val="false"/>
+	<showTimer val="true" increase="true" text="Elapsed Time :" />
+	<spawnPoint spawnX="52212" spawnY="218998" spawnZ="-3208" />
+</instance>
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts.cfg b/L2J_DataPack_BETA/dist/game/data/scripts.cfg
index e8ea13d5ad..c09d89ff0a 100644
--- a/L2J_DataPack_BETA/dist/game/data/scripts.cfg
+++ b/L2J_DataPack_BETA/dist/game/data/scripts.cfg
@@ -157,7 +157,6 @@ ai/individual/QueenAnt.java
 ai/individual/QueenShyeed.java
 ai/individual/SinWardens.java
 ai/individual/Valakas.java
-ai/individual/Zaken.java
 
 # Village Master
 village_master/Clan/Clan.java
@@ -176,6 +175,7 @@ village_master/orc_occupation_change_1/__init__.py
 village_master/orc_occupation_change_2/__init__.py
 
 # Instance Dungeons Section
+instances/CavernOfThePirateCaptain/CavernOfThePirateCaptain.java
 instances/ChambersOfDelusion/ChamberOfDelusionEast.java
 instances/ChambersOfDelusion/ChamberOfDelusionNorth.java
 instances/ChambersOfDelusion/ChamberOfDelusionSouth.java
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/ai/individual/Zaken.java b/L2J_DataPack_BETA/dist/game/data/scripts/ai/individual/Zaken.java
deleted file mode 100644
index a62e9a6724..0000000000
--- a/L2J_DataPack_BETA/dist/game/data/scripts/ai/individual/Zaken.java
+++ /dev/null
@@ -1,1032 +0,0 @@
-/*
- * Copyright (C) 2004-2014 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 ai.npc.AbstractNpcAI;
-
-import com.l2jserver.Config;
-import com.l2jserver.gameserver.GameTimeController;
-import com.l2jserver.gameserver.ThreadPoolManager;
-import com.l2jserver.gameserver.ai.CtrlIntention;
-import com.l2jserver.gameserver.datatables.DoorTable;
-import com.l2jserver.gameserver.datatables.SkillData;
-import com.l2jserver.gameserver.enums.MountType;
-import com.l2jserver.gameserver.instancemanager.GrandBossManager;
-import com.l2jserver.gameserver.model.L2Object;
-import com.l2jserver.gameserver.model.Location;
-import com.l2jserver.gameserver.model.StatsSet;
-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.L2GrandBossInstance;
-import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
-import com.l2jserver.gameserver.model.skills.Skill;
-import com.l2jserver.gameserver.model.zone.type.L2BossZone;
-import com.l2jserver.gameserver.network.serverpackets.PlaySound;
-
-/**
- * Zaken AI
- */
-public final class Zaken extends AbstractNpcAI
-{
-	private int _1001 = 0; // used for first cancel of QuestTimer "1001"
-	private int _ai0 = 0; // used for zaken coords updater
-	private final Location _loc = new Location(0, 0, 0);
-	private int _ai4 = 0; // used for spawning minions cycles
-	private int _quest0 = 0; // used for teleporting progress
-	private int _quest1 = 0; // used for most hated players progress
-	private int _quest2 = 0; // used for zaken HP check for teleport
-	private L2PcInstance c_quest0 = null; // 1st player used for area teleport
-	private L2PcInstance c_quest1 = null; // 2nd player used for area teleport
-	private L2PcInstance c_quest2 = null; // 3rd player used for area teleport
-	private L2PcInstance c_quest3 = null; // 4th player used for area teleport
-	private L2PcInstance c_quest4 = null; // 5th player used for area teleport
-	private static final int ZAKEN = 29022;
-	private static final int doll_blader_b = 29023;
-	private static final int vale_master_b = 29024;
-	private static final int pirates_zombie_captain_b = 29026;
-	private static final int pirates_zombie_b = 29027;
-	private static final int[] Xcoords =
-	{
-		53950,
-		55980,
-		54950,
-		55970,
-		53930,
-		55970,
-		55980,
-		54960,
-		53950,
-		53930,
-		55970,
-		55980,
-		54960,
-		53950,
-		53930
-	};
-	
-	private static final int[] Ycoords =
-	{
-		219860,
-		219820,
-		218790,
-		217770,
-		217760,
-		217770,
-		219920,
-		218790,
-		219860,
-		217760,
-		217770,
-		219920,
-		218790,
-		219860,
-		217760
-	};
-	
-	private static final int[] Zcoords =
-	{
-		-3488,
-		-3488,
-		-3488,
-		-3488,
-		-3488,
-		-3216,
-		-3216,
-		-3216,
-		-3216,
-		-3216,
-		-2944,
-		-2944,
-		-2944,
-		-2944,
-		-2944
-	};
-	
-	// ZAKEN Status Tracking :
-	private static final byte ALIVE = 0; // Zaken is spawned.
-	private static final byte DEAD = 1; // Zaken has been killed.
-	
-	private static L2BossZone _Zone;
-	
-	private Zaken()
-	{
-		super(Zaken.class.getSimpleName(), "ai/individual");
-		
-		// Zaken doors handling
-		ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable()
-		{
-			@Override
-			public void run()
-			{
-				try
-				{
-					if (getTimeHour() == 0)
-					{
-						DoorTable.getInstance().getDoor(21240006).openMe();
-						ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
-						{
-							@Override
-							public void run()
-							{
-								try
-								{
-									DoorTable.getInstance().getDoor(21240006).closeMe();
-								}
-								catch (Throwable e)
-								{
-									_log.warning("Cannot close door ID: 21240006 " + e);
-								}
-							}
-						}, 300000L);
-					}
-				}
-				catch (Throwable e)
-				{
-					_log.warning("Cannot open door ID: 21240006 " + e);
-				}
-			}
-		}, 2000L, 600000L);
-		
-		int[] mobs =
-		{
-			ZAKEN,
-			doll_blader_b,
-			vale_master_b,
-			pirates_zombie_captain_b,
-			pirates_zombie_b
-		};
-		
-		registerMobs(mobs);
-		_Zone = GrandBossManager.getInstance().getZone(55312, 219168, -3223);
-		
-		StatsSet info = GrandBossManager.getInstance().getStatsSet(ZAKEN);
-		int status = GrandBossManager.getInstance().getBossStatus(ZAKEN);
-		if (status == DEAD)
-		{
-			// load the unlock date and time for zaken from DB
-			long temp = info.getLong("respawn_time") - System.currentTimeMillis();
-			// if zaken is locked until a certain time, mark it so and start the unlock timer
-			// the unlock time has not yet expired.
-			if (temp > 0)
-			{
-				startQuestTimer("zaken_unlock", temp, null, null);
-			}
-			else
-			{
-				// the time has already expired while the server was offline. Immediately spawn zaken.
-				L2GrandBossInstance zaken = (L2GrandBossInstance) addSpawn(ZAKEN, 55312, 219168, -3223, 0, false, 0);
-				GrandBossManager.getInstance().setBossStatus(ZAKEN, ALIVE);
-				spawnBoss(zaken);
-			}
-		}
-		else
-		{
-			int loc_x = info.getInt("loc_x");
-			int loc_y = info.getInt("loc_y");
-			int loc_z = info.getInt("loc_z");
-			int heading = info.getInt("heading");
-			int hp = info.getInt("currentHP");
-			int mp = info.getInt("currentMP");
-			L2GrandBossInstance zaken = (L2GrandBossInstance) addSpawn(ZAKEN, loc_x, loc_y, loc_z, heading, false, 0);
-			zaken.setCurrentHpMp(hp, mp);
-			spawnBoss(zaken);
-		}
-	}
-	
-	public void spawnBoss(L2GrandBossInstance npc)
-	{
-		if (npc == null)
-		{
-			_log.warning("Zaken AI failed to load, missing Zaken in grandboss_data.sql");
-			return;
-		}
-		GrandBossManager.getInstance().addBoss(npc);
-		
-		npc.broadcastPacket(new PlaySound(1, "BS01_A", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
-		_ai0 = 0;
-		_loc.setLocation(npc.getLocation());
-		_quest0 = 0;
-		_quest1 = 0;
-		_quest2 = 3;
-		if (_Zone == null)
-		{
-			_log.warning("Zaken AI failed to load, missing zone for Zaken");
-			return;
-		}
-		if (_Zone.isInsideZone(npc))
-		{
-			_ai4 = 1;
-			startQuestTimer("1003", 1700, null, null, true);
-		}
-		_1001 = 1;
-		startQuestTimer("1001", 1000, npc, null, true); // buffs,random teleports
-	}
-	
-	@Override
-	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
-	{
-		int status = GrandBossManager.getInstance().getBossStatus(ZAKEN);
-		if ((status == DEAD) && !event.equalsIgnoreCase("zaken_unlock"))
-		{
-			return super.onAdvEvent(event, npc, player);
-		}
-		
-		if (event.equalsIgnoreCase("1001"))
-		{
-			if (_1001 == 1)
-			{
-				_1001 = 0;
-				cancelQuestTimer("1001", npc, null);
-			}
-			
-			boolean sk_4223 = npc.isAffectedBySkill(4223);
-			boolean sk_4227 = npc.isAffectedBySkill(4227);
-			if (getTimeHour() < 5)
-			{
-				if (sk_4223) // use night face if zaken have day face
-				{
-					npc.setTarget(npc);
-					npc.doCast(SkillData.getInstance().getSkill(4224, 1));
-					_loc.setLocation(npc.getLocation());
-				}
-				if (!sk_4227) // use zaken regeneration
-				{
-					npc.setTarget(npc);
-					npc.doCast(SkillData.getInstance().getSkill(4227, 1));
-				}
-				if ((npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_ATTACK) && (_ai0 == 0))
-				{
-					int i0 = 0;
-					int i1 = 1;
-					if (((L2Attackable) npc).getMostHated() != null)
-					{
-						if ((((((L2Attackable) npc).getMostHated().getX() - _loc.getX()) * (((L2Attackable) npc).getMostHated().getX() - _loc.getX())) + ((((L2Attackable) npc).getMostHated().getY() - _loc.getY()) * (((L2Attackable) npc).getMostHated().getY() - _loc.getY()))) > (1500 * 1500))
-						{
-							i0 = 1;
-						}
-						else
-						{
-							i0 = 0;
-						}
-						if (i0 == 0)
-						{
-							i1 = 0;
-						}
-						if (_quest0 > 0)
-						{
-							if (c_quest0 == null)
-							{
-								i0 = 0;
-							}
-							else if ((((c_quest0.getX() - _loc.getX()) * (c_quest0.getX() - _loc.getX())) + ((c_quest0.getY() - _loc.getY()) * (c_quest0.getY() - _loc.getY()))) > (1500 * 1500))
-							{
-								i0 = 1;
-							}
-							else
-							{
-								i0 = 0;
-							}
-							if (i0 == 0)
-							{
-								i1 = 0;
-							}
-						}
-						if (_quest0 > 1)
-						{
-							if (c_quest1 == null)
-							{
-								i0 = 0;
-							}
-							else if ((((c_quest1.getX() - _loc.getX()) * (c_quest1.getX() - _loc.getX())) + ((c_quest1.getY() - _loc.getY()) * (c_quest1.getY() - _loc.getY()))) > (1500 * 1500))
-							{
-								i0 = 1;
-							}
-							else
-							{
-								i0 = 0;
-							}
-							if (i0 == 0)
-							{
-								i1 = 0;
-							}
-						}
-						if (_quest0 > 2)
-						{
-							if (c_quest2 == null)
-							{
-								i0 = 0;
-							}
-							else if ((((c_quest2.getX() - _loc.getX()) * (c_quest2.getX() - _loc.getX())) + ((c_quest2.getY() - _loc.getY()) * (c_quest2.getY() - _loc.getY()))) > (1500 * 1500))
-							{
-								i0 = 1;
-							}
-							else
-							{
-								i0 = 0;
-							}
-							if (i0 == 0)
-							{
-								i1 = 0;
-							}
-						}
-						if (_quest0 > 3)
-						{
-							if (c_quest3 == null)
-							{
-								i0 = 0;
-							}
-							else if ((((c_quest3.getX() - _loc.getX()) * (c_quest3.getX() - _loc.getX())) + ((c_quest3.getY() - _loc.getY()) * (c_quest3.getY() - _loc.getY()))) > (1500 * 1500))
-							{
-								i0 = 1;
-							}
-							else
-							{
-								i0 = 0;
-							}
-							if (i0 == 0)
-							{
-								i1 = 0;
-							}
-						}
-						if (_quest0 > 4)
-						{
-							if (c_quest4 == null)
-							{
-								i0 = 0;
-							}
-							else if ((((c_quest4.getX() - _loc.getX()) * (c_quest4.getX() - _loc.getX())) + ((c_quest4.getY() - _loc.getY()) * (c_quest4.getY() - _loc.getY()))) > (1500 * 1500))
-							{
-								i0 = 1;
-							}
-							else
-							{
-								i0 = 0;
-							}
-							if (i0 == 0)
-							{
-								i1 = 0;
-							}
-						}
-						if (i1 == 1)
-						{
-							_quest0 = 0;
-							int i2 = getRandom(15);
-							_loc.setX(Xcoords[i2] + getRandom(650));
-							_loc.setY(Ycoords[i2] + getRandom(650));
-							_loc.setZ(Zcoords[i2]);
-							npc.setTarget(npc);
-							npc.doCast(SkillData.getInstance().getSkill(4222, 1));
-						}
-					}
-				}
-				if ((getRandom(20) < 1) && (_ai0 == 0))
-				{
-					_loc.setLocation(npc.getLocation());
-				}
-				L2Character c_ai0 = null;
-				if ((npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_ATTACK) && (_quest1 == 0))
-				{
-					if (((L2Attackable) npc).getMostHated() != null)
-					{
-						c_ai0 = ((L2Attackable) npc).getMostHated();
-						_quest1 = 1;
-					}
-				}
-				else if ((npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_ATTACK) && (_quest1 != 0))
-				{
-					if (((L2Attackable) npc).getMostHated() != null)
-					{
-						if (c_ai0 == ((L2Attackable) npc).getMostHated())
-						{
-							_quest1 = (_quest1 + 1);
-						}
-						else
-						{
-							_quest1 = 1;
-							c_ai0 = ((L2Attackable) npc).getMostHated();
-						}
-					}
-				}
-				if (npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_IDLE)
-				{
-					_quest1 = 0;
-				}
-				if (_quest1 > 5)
-				{
-					((L2Attackable) npc).stopHating(c_ai0);
-					L2Character nextTarget = ((L2Attackable) npc).getMostHated();
-					if (nextTarget != null)
-					{
-						npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, nextTarget);
-					}
-					_quest1 = 0;
-				}
-			}
-			else if (!sk_4223) // use day face if not night time
-			{
-				npc.setTarget(npc);
-				npc.doCast(SkillData.getInstance().getSkill(4223, 1));
-				_quest2 = 3;
-			}
-			
-			if (sk_4227) // when switching to day time, cancel zaken night regen
-			{
-				npc.setTarget(npc);
-				npc.doCast(SkillData.getInstance().getSkill(4242, 1));
-			}
-			
-			if (getRandom(40) < 1)
-			{
-				int i2 = getRandom(15);
-				_loc.setX(Xcoords[i2] + getRandom(650));
-				_loc.setY(Ycoords[i2] + getRandom(650));
-				_loc.setZ(Zcoords[i2]);
-				npc.setTarget(npc);
-				npc.doCast(SkillData.getInstance().getSkill(4222, 1));
-			}
-			startQuestTimer("1001", 30000, npc, null, true);
-		}
-		if (event.equalsIgnoreCase("1002"))
-		{
-			_quest0 = 0;
-			npc.doCast(SkillData.getInstance().getSkill(4222, 1));
-			_ai0 = 0;
-		}
-		if (event.equalsIgnoreCase("1003"))
-		{
-			if (_ai4 == 1)
-			{
-				int rr = getRandom(15);
-				((L2Attackable) addSpawn(pirates_zombie_captain_b, Xcoords[rr] + getRandom(650), Ycoords[rr] + getRandom(650), Zcoords[rr], getRandom(65536), false, 0)).setIsRaidMinion(true);
-				_ai4 = 2;
-			}
-			else if (_ai4 == 2)
-			{
-				int rr = getRandom(15);
-				((L2Attackable) addSpawn(doll_blader_b, Xcoords[rr] + getRandom(650), Ycoords[rr] + getRandom(650), Zcoords[rr], getRandom(65536), false, 0)).setIsRaidMinion(true);
-				_ai4 = 3;
-			}
-			else if (_ai4 == 3)
-			{
-				((L2Attackable) addSpawn(vale_master_b, Xcoords[getRandom(15)] + getRandom(650), Ycoords[getRandom(15)] + getRandom(650), Zcoords[getRandom(15)], getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(vale_master_b, Xcoords[getRandom(15)] + getRandom(650), Ycoords[getRandom(15)] + getRandom(650), Zcoords[getRandom(15)], getRandom(65536), false, 0)).setIsRaidMinion(true);
-				_ai4 = 4;
-			}
-			else if (_ai4 == 4)
-			{
-				((L2Attackable) addSpawn(pirates_zombie_b, Xcoords[getRandom(15)] + getRandom(650), Ycoords[getRandom(15)] + getRandom(650), Zcoords[getRandom(15)], getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, Xcoords[getRandom(15)] + getRandom(650), Ycoords[getRandom(15)] + getRandom(650), Zcoords[getRandom(15)], getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, Xcoords[getRandom(15)] + getRandom(650), Ycoords[getRandom(15)] + getRandom(650), Zcoords[getRandom(15)], getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, Xcoords[getRandom(15)] + getRandom(650), Ycoords[getRandom(15)] + getRandom(650), Zcoords[getRandom(15)], getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, Xcoords[getRandom(15)] + getRandom(650), Ycoords[getRandom(15)] + getRandom(650), Zcoords[getRandom(15)], getRandom(65536), false, 0)).setIsRaidMinion(true);
-				_ai4 = 5;
-			}
-			else if (_ai4 == 5)
-			{
-				((L2Attackable) addSpawn(doll_blader_b, 52675, 219371, -3290, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(doll_blader_b, 52687, 219596, -3368, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(doll_blader_b, 52672, 219740, -3418, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, 52857, 219992, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_captain_b, 52959, 219997, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(vale_master_b, 53381, 220151, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_captain_b, 54236, 220948, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, 54885, 220144, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, 55264, 219860, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_captain_b, 55399, 220263, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, 55679, 220129, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(vale_master_b, 56276, 220783, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(vale_master_b, 57173, 220234, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, 56267, 218826, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(doll_blader_b, 56294, 219482, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_captain_b, 56094, 219113, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(doll_blader_b, 56364, 218967, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, 57113, 218079, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(doll_blader_b, 56186, 217153, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, 55440, 218081, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_captain_b, 55202, 217940, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, 55225, 218236, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, 54973, 218075, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_captain_b, 53412, 218077, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(vale_master_b, 54226, 218797, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(vale_master_b, 54394, 219067, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, 54139, 219253, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(doll_blader_b, 54262, 219480, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				_ai4 = 6;
-			}
-			else if (_ai4 == 6)
-			{
-				((L2Attackable) addSpawn(pirates_zombie_b, 53412, 218077, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(vale_master_b, 54413, 217132, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(doll_blader_b, 54841, 217132, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(doll_blader_b, 55372, 217128, -3343, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(doll_blader_b, 55893, 217122, -3488, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_captain_b, 56282, 217237, -3216, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(vale_master_b, 56963, 218080, -3216, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, 56267, 218826, -3216, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(doll_blader_b, 56294, 219482, -3216, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_captain_b, 56094, 219113, -3216, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(doll_blader_b, 56364, 218967, -3216, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(vale_master_b, 56276, 220783, -3216, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(vale_master_b, 57173, 220234, -3216, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, 54885, 220144, -3216, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, 55264, 219860, -3216, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_captain_b, 55399, 220263, -3216, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, 55679, 220129, -3216, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_captain_b, 54236, 220948, -3216, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_captain_b, 54464, 219095, -3216, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(vale_master_b, 54226, 218797, -3216, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(vale_master_b, 54394, 219067, -3216, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, 54139, 219253, -3216, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(doll_blader_b, 54262, 219480, -3216, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_captain_b, 53412, 218077, -3216, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, 55440, 218081, -3216, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_captain_b, 55202, 217940, -3216, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, 55225, 218236, -3216, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, 54973, 218075, -3216, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				_ai4 = 7;
-			}
-			else if (_ai4 == 7)
-			{
-				((L2Attackable) addSpawn(pirates_zombie_b, 54228, 217504, -3216, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(vale_master_b, 54181, 217168, -3216, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(doll_blader_b, 54714, 217123, -3168, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(doll_blader_b, 55298, 217127, -3073, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(doll_blader_b, 55787, 217130, -2993, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_captain_b, 56284, 217216, -2944, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(vale_master_b, 56963, 218080, -2944, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, 56267, 218826, -2944, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(doll_blader_b, 56294, 219482, -2944, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_captain_b, 56094, 219113, -2944, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(doll_blader_b, 56364, 218967, -2944, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(vale_master_b, 56276, 220783, -2944, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(vale_master_b, 57173, 220234, -2944, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, 54885, 220144, -2944, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, 55264, 219860, -2944, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_captain_b, 55399, 220263, -2944, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, 55679, 220129, -2944, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_captain_b, 54236, 220948, -2944, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_captain_b, 54464, 219095, -2944, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(vale_master_b, 54226, 218797, -2944, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(vale_master_b, 54394, 219067, -2944, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, 54139, 219253, -2944, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(doll_blader_b, 54262, 219480, -2944, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_captain_b, 53412, 218077, -2944, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_captain_b, 54280, 217200, -2944, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, 55440, 218081, -2944, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_captain_b, 55202, 217940, -2944, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, 55225, 218236, -2944, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				((L2Attackable) addSpawn(pirates_zombie_b, 54973, 218075, -2944, getRandom(65536), false, 0)).setIsRaidMinion(true);
-				_ai4 = 8;
-				cancelQuestTimer("1003", null, null);
-			}
-		}
-		
-		else if (event.equalsIgnoreCase("zaken_unlock"))
-		{
-			L2GrandBossInstance zaken = (L2GrandBossInstance) addSpawn(ZAKEN, 55312, 219168, -3223, 0, false, 0);
-			GrandBossManager.getInstance().setBossStatus(ZAKEN, ALIVE);
-			spawnBoss(zaken);
-		}
-		else if (event.equalsIgnoreCase("CreateOnePrivateEx"))
-		{
-			((L2Attackable) addSpawn(npc.getId(), npc.getX(), npc.getY(), npc.getZ(), 0, false, 0)).setIsRaidMinion(true);
-		}
-		return super.onAdvEvent(event, npc, player);
-	}
-	
-	@Override
-	public String onFactionCall(L2Npc npc, L2Npc caller, L2PcInstance attacker, boolean isSummon)
-	{
-		if ((caller == null) || (npc == null))
-		{
-			return super.onFactionCall(npc, caller, attacker, isSummon);
-		}
-		int npcId = npc.getId();
-		int callerId = caller.getId();
-		
-		if ((getTimeHour() < 5) && (callerId != ZAKEN) && (npcId == ZAKEN))
-		{
-			int damage = 0; // well damage required :x
-			if ((npc.getAI().getIntention() == CtrlIntention.AI_INTENTION_IDLE) && (_ai0 == 0) && (damage < 10) && (getRandom((30 * 15)) < 1))// todo - damage missing
-			{
-				_ai0 = 1;
-				_loc.setLocation(caller.getLocation());
-				startQuestTimer("1002", 300, caller, null);
-			}
-		}
-		return super.onFactionCall(npc, caller, attacker, isSummon);
-	}
-	
-	@Override
-	public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill)
-	{
-		if (npc.getId() == ZAKEN)
-		{
-			int skillId = skill.getId();
-			if (skillId == 4222)
-			{
-				npc.teleToLocation(_loc);
-				npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
-			}
-			else if (skillId == 4216)
-			{
-				int i1 = getRandom(15);
-				player.teleToLocation(new Location(Xcoords[i1] + getRandom(650), Ycoords[i1] + getRandom(650), Zcoords[i1]));
-				((L2Attackable) npc).stopHating(player);
-				L2Character nextTarget = ((L2Attackable) npc).getMostHated();
-				if (nextTarget != null)
-				{
-					npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, nextTarget);
-				}
-				
-			}
-			else if (skillId == 4217)
-			{
-				int i0 = 0;
-				int i1 = getRandom(15);
-				player.teleToLocation(new Location(Xcoords[i1] + getRandom(650), Ycoords[i1] + getRandom(650), Zcoords[i1]));
-				((L2Attackable) npc).stopHating(player);
-				
-				if ((c_quest0 != null) && (_quest0 > 0) && (c_quest0 != player) && (c_quest0.getZ() > (player.getZ() - 100)) && (c_quest0.getZ() < (player.getZ() + 100)))
-				{
-					if ((((c_quest0.getX() - player.getX()) * (c_quest0.getX() - player.getX())) + ((c_quest0.getY() - player.getY()) * (c_quest0.getY() - player.getY()))) > (250 * 250))
-					{
-						i0 = 1;
-					}
-					else
-					{
-						i0 = 0;
-					}
-					if (i0 == 0)
-					{
-						i1 = getRandom(15);
-						c_quest0.teleToLocation(new Location(Xcoords[i1] + getRandom(650), Ycoords[i1] + getRandom(650), Zcoords[i1]));
-						((L2Attackable) npc).stopHating(c_quest0);
-					}
-				}
-				if ((c_quest1 != null) && (_quest0 > 1) && (c_quest1 != player) && (c_quest1.getZ() > (player.getZ() - 100)) && (c_quest1.getZ() < (player.getZ() + 100)))
-				{
-					if ((((c_quest1.getX() - player.getX()) * (c_quest1.getX() - player.getX())) + ((c_quest1.getY() - player.getY()) * (c_quest1.getY() - player.getY()))) > (250 * 250))
-					{
-						i0 = 1;
-					}
-					else
-					{
-						i0 = 0;
-					}
-					if (i0 == 0)
-					{
-						i1 = getRandom(15);
-						c_quest1.teleToLocation(new Location(Xcoords[i1] + getRandom(650), Ycoords[i1] + getRandom(650), Zcoords[i1]));
-						((L2Attackable) npc).stopHating(c_quest1);
-					}
-				}
-				if ((c_quest2 != null) && (_quest0 > 2) && (c_quest2 != player) && (c_quest2.getZ() > (player.getZ() - 100)) && (c_quest2.getZ() < (player.getZ() + 100)))
-				{
-					if ((((c_quest2.getX() - player.getX()) * (c_quest2.getX() - player.getX())) + ((c_quest2.getY() - player.getY()) * (c_quest2.getY() - player.getY()))) > (250 * 250))
-					{
-						i0 = 1;
-					}
-					else
-					{
-						i0 = 0;
-					}
-					if (i0 == 0)
-					{
-						i1 = getRandom(15);
-						c_quest2.teleToLocation(new Location(Xcoords[i1] + getRandom(650), Ycoords[i1] + getRandom(650), Zcoords[i1]));
-						((L2Attackable) npc).stopHating(c_quest2);
-					}
-				}
-				if ((c_quest3 != null) && (_quest0 > 3) && (c_quest3 != player) && (c_quest3.getZ() > (player.getZ() - 100)) && (c_quest3.getZ() < (player.getZ() + 100)))
-				{
-					if ((((c_quest3.getX() - player.getX()) * (c_quest3.getX() - player.getX())) + ((c_quest3.getY() - player.getY()) * (c_quest3.getY() - player.getY()))) > (250 * 250))
-					{
-						i0 = 1;
-					}
-					else
-					{
-						i0 = 0;
-					}
-					if (i0 == 0)
-					{
-						i1 = getRandom(15);
-						c_quest3.teleToLocation(new Location(Xcoords[i1] + getRandom(650), Ycoords[i1] + getRandom(650), Zcoords[i1]));
-						((L2Attackable) npc).stopHating(c_quest3);
-					}
-				}
-				if ((c_quest4 != null) && (_quest0 > 4) && (c_quest4 != player) && (c_quest4.getZ() > (player.getZ() - 100)) && (c_quest4.getZ() < (player.getZ() + 100)))
-				{
-					if ((((c_quest4.getX() - player.getX()) * (c_quest4.getX() - player.getX())) + ((c_quest4.getY() - player.getY()) * (c_quest4.getY() - player.getY()))) > (250 * 250))
-					{
-						i0 = 1;
-					}
-					else
-					{
-						i0 = 0;
-					}
-					if (i0 == 0)
-					{
-						i1 = getRandom(15);
-						c_quest4.teleToLocation(new Location(Xcoords[i1] + getRandom(650), Ycoords[i1] + getRandom(650), Zcoords[i1]));
-						((L2Attackable) npc).stopHating(c_quest4);
-					}
-				}
-				L2Character nextTarget = ((L2Attackable) npc).getMostHated();
-				if (nextTarget != null)
-				{
-					npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, nextTarget);
-				}
-			}
-		}
-		return super.onSpellFinished(npc, player, skill);
-	}
-	
-	@Override
-	public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon)
-	{
-		int npcId = npc.getId();
-		if (npcId == ZAKEN)
-		{
-			if (attacker.getMountType() == MountType.STRIDER)
-			{
-				boolean sk_4258 = attacker.isAffectedBySkill(4258);
-				if (!sk_4258)
-				{
-					npc.setTarget(attacker);
-					npc.doCast(SkillData.getInstance().getSkill(4258, 1));
-				}
-			}
-			L2Character originalAttacker = isSummon ? attacker.getSummon() : attacker;
-			int hate = (int) (((damage / npc.getMaxHp()) / 0.05) * 20000);
-			((L2Attackable) npc).addDamageHate(originalAttacker, 0, hate);
-			if (getRandom(10) < 1)
-			{
-				int i0 = getRandom((15 * 15));
-				if (i0 < 1)
-				{
-					npc.setTarget(attacker);
-					npc.doCast(SkillData.getInstance().getSkill(4216, 1));
-				}
-				else if (i0 < 2)
-				{
-					npc.setTarget(attacker);
-					npc.doCast(SkillData.getInstance().getSkill(4217, 1));
-				}
-				else if (i0 < 4)
-				{
-					npc.setTarget(attacker);
-					npc.doCast(SkillData.getInstance().getSkill(4219, 1));
-				}
-				else if (i0 < 8)
-				{
-					npc.setTarget(attacker);
-					npc.doCast(SkillData.getInstance().getSkill(4218, 1));
-				}
-				else if (i0 < 15)
-				{
-					for (L2Character character : npc.getKnownList().getKnownCharactersInRadius(100))
-					{
-						if (character != attacker)
-						{
-							continue;
-						}
-						if (attacker != ((L2Attackable) npc).getMostHated())
-						{
-							npc.setTarget(attacker);
-							npc.doCast(SkillData.getInstance().getSkill(4221, 1));
-						}
-					}
-				}
-				if (getRandom(2) < 1)
-				{
-					if (attacker == ((L2Attackable) npc).getMostHated())
-					{
-						npc.setTarget(attacker);
-						npc.doCast(SkillData.getInstance().getSkill(4220, 1));
-					}
-				}
-			}
-			if (getTimeHour() < 5)
-			{
-			}
-			else if (npc.getCurrentHp() < ((npc.getMaxHp() * _quest2) / 4.0))
-			{
-				_quest2 = (_quest2 - 1);
-				int i2 = getRandom(15);
-				_loc.setX(Xcoords[i2] + getRandom(650));
-				_loc.setY(Ycoords[i2] + getRandom(650));
-				_loc.setZ(Zcoords[i2]);
-				npc.setTarget(npc);
-				npc.doCast(SkillData.getInstance().getSkill(4222, 1));
-			}
-		}
-		return super.onAttack(npc, attacker, damage, isSummon);
-	}
-	
-	@Override
-	public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
-	{
-		int npcId = npc.getId();
-		if (npcId == ZAKEN)
-		{
-			npc.broadcastPacket(new PlaySound(1, "BS02_D", 1, npc.getObjectId(), npc.getX(), npc.getY(), npc.getZ()));
-			GrandBossManager.getInstance().setBossStatus(ZAKEN, DEAD);
-			// Calculate Min and Max respawn times randomly.
-			long respawnTime = Config.ZAKEN_SPAWN_INTERVAL + getRandom(-Config.ZAKEN_SPAWN_RANDOM, Config.ZAKEN_SPAWN_RANDOM);
-			respawnTime *= 3600000;
-			startQuestTimer("zaken_unlock", respawnTime, null, null);
-			cancelQuestTimer("1001", npc, null);
-			cancelQuestTimer("1003", npc, null);
-			// also save the respawn time so that the info is maintained past reboots
-			StatsSet info = GrandBossManager.getInstance().getStatsSet(ZAKEN);
-			info.set("respawn_time", System.currentTimeMillis() + respawnTime);
-			GrandBossManager.getInstance().setStatsSet(ZAKEN, info);
-		}
-		else if (GrandBossManager.getInstance().getBossStatus(ZAKEN) == ALIVE)
-		{
-			if (npcId != ZAKEN)
-			{
-				startQuestTimer("CreateOnePrivateEx", ((30 + getRandom(60)) * 1000), npc, null);
-			}
-		}
-		return super.onKill(npc, killer, isSummon);
-	}
-	
-	@Override
-	public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon)
-	{
-		int npcId = npc.getId();
-		if (npcId == ZAKEN)
-		{
-			if (skill.getEffectPoint() > 0)
-			{
-				((L2Attackable) npc).addDamageHate(caster, 0, (((skill.getEffectPoint() / npc.getMaxHp()) * 10) * 150));
-			}
-			if (getRandom(12) < 1)
-			{
-				int i0 = getRandom((15 * 15));
-				if (i0 < 1)
-				{
-					npc.setTarget(caster);
-					npc.doCast(SkillData.getInstance().getSkill(4216, 1));
-				}
-				else if (i0 < 2)
-				{
-					npc.setTarget(caster);
-					npc.doCast(SkillData.getInstance().getSkill(4217, 1));
-				}
-				else if (i0 < 4)
-				{
-					npc.setTarget(caster);
-					npc.doCast(SkillData.getInstance().getSkill(4219, 1));
-				}
-				else if (i0 < 8)
-				{
-					npc.setTarget(caster);
-					npc.doCast(SkillData.getInstance().getSkill(4218, 1));
-				}
-				else if (i0 < 15)
-				{
-					for (L2Character character : npc.getKnownList().getKnownCharactersInRadius(100))
-					{
-						if (character != caster)
-						{
-							continue;
-						}
-						if (caster != ((L2Attackable) npc).getMostHated())
-						{
-							npc.setTarget(caster);
-							npc.doCast(SkillData.getInstance().getSkill(4221, 1));
-						}
-					}
-				}
-				if (getRandom(2) < 1)
-				{
-					if (caster == ((L2Attackable) npc).getMostHated())
-					{
-						npc.setTarget(caster);
-						npc.doCast(SkillData.getInstance().getSkill(4220, 1));
-					}
-				}
-			}
-		}
-		return super.onSkillSee(npc, caster, skill, targets, isSummon);
-	}
-	
-	@Override
-	public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon)
-	{
-		int npcId = npc.getId();
-		if (npcId == ZAKEN)
-		{
-			if (_Zone.isInsideZone(npc))
-			{
-				L2Character target = isSummon ? player.getSummon() : player;
-				((L2Attackable) npc).addDamageHate(target, 1, 200);
-			}
-			if ((player.getZ() > (npc.getZ() - 100)) && (player.getZ() < (npc.getZ() + 100)))
-			{
-				if ((_quest0 < 5) && (getRandom(3) < 1))
-				{
-					if (_quest0 == 0)
-					{
-						c_quest0 = player;
-					}
-					else if (_quest0 == 1)
-					{
-						c_quest1 = player;
-					}
-					else if (_quest0 == 2)
-					{
-						c_quest2 = player;
-					}
-					else if (_quest0 == 3)
-					{
-						c_quest3 = player;
-					}
-					else if (_quest0 == 4)
-					{
-						c_quest4 = player;
-					}
-					_quest0++;
-				}
-				if (getRandom(15) < 1)
-				{
-					int i0 = getRandom((15 * 15));
-					if (i0 < 1)
-					{
-						npc.setTarget(player);
-						npc.doCast(SkillData.getInstance().getSkill(4216, 1));
-					}
-					else if (i0 < 2)
-					{
-						npc.setTarget(player);
-						npc.doCast(SkillData.getInstance().getSkill(4217, 1));
-					}
-					else if (i0 < 4)
-					{
-						npc.setTarget(player);
-						npc.doCast(SkillData.getInstance().getSkill(4219, 1));
-					}
-					else if (i0 < 8)
-					{
-						npc.setTarget(player);
-						npc.doCast(SkillData.getInstance().getSkill(4218, 1));
-					}
-					else if (i0 < 15)
-					{
-						for (L2Character character : npc.getKnownList().getKnownCharactersInRadius(100))
-						{
-							if (character != player)
-							{
-								continue;
-							}
-							if (player != ((L2Attackable) npc).getMostHated())
-							{
-								npc.setTarget(player);
-								npc.doCast(SkillData.getInstance().getSkill(4221, 1));
-							}
-						}
-					}
-					if (getRandom(2) < 1)
-					{
-						if (player == ((L2Attackable) npc).getMostHated())
-						{
-							npc.setTarget(player);
-							npc.doCast(SkillData.getInstance().getSkill(4220, 1));
-						}
-					}
-				}
-			}
-		}
-		return super.onAggroRangeEnter(npc, player, isSummon);
-	}
-	
-	public int getTimeHour()
-	{
-		return (GameTimeController.getInstance().getGameTime() / 60) % 24;
-	}
-	
-	public static void main(String[] args)
-	{
-		new Zaken();
-	}
-}
diff --git a/L2J_DataPack_BETA/dist/game/data/scripts/instances/CavernOfThePirateCaptain/CavernOfThePirateCaptain.java b/L2J_DataPack_BETA/dist/game/data/scripts/instances/CavernOfThePirateCaptain/CavernOfThePirateCaptain.java
new file mode 100644
index 0000000000..9ba24c9638
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/game/data/scripts/instances/CavernOfThePirateCaptain/CavernOfThePirateCaptain.java
@@ -0,0 +1,592 @@
+/*
+ * Copyright (C) 2004-2014 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 instances.CavernOfThePirateCaptain;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+
+import ai.npc.AbstractNpcAI;
+
+import com.l2jserver.gameserver.instancemanager.InstanceManager;
+import com.l2jserver.gameserver.model.L2Party;
+import com.l2jserver.gameserver.model.L2World;
+import com.l2jserver.gameserver.model.Location;
+import com.l2jserver.gameserver.model.PcCondOverride;
+import com.l2jserver.gameserver.model.actor.L2Attackable;
+import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.Instance;
+import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
+import com.l2jserver.gameserver.network.NpcStringId;
+import com.l2jserver.gameserver.network.SystemMessageId;
+import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
+
+/**
+ * Cavern Of The Pirate Captain (Day Dream) instance Zone.
+ * @author St3eT
+ */
+public class CavernOfThePirateCaptain extends AbstractNpcAI
+{
+	protected class CavernOfThePirateCaptainWorld extends InstanceWorld
+	{
+		ArrayList<L2PcInstance> playersInside = new ArrayList<>();
+		L2Attackable _zaken;
+		long storeTime = 0;
+		boolean _is83;
+		int _zakenRoom;
+		int _blueFounded;
+	}
+	
+	// NPCs
+	private static final int PATHFINDER = 32713; // Pathfinder Worker
+	private static final int ZAKEN_60 = 29176; // Zaken
+	private static final int ZAKEN_83 = 29181; // Zaken
+	private static final int CANDLE = 32705; // Zaken's Candle
+	private static final int DOLL_BLADER_60 = 29023; // Doll Blader
+	private static final int DOLL_BLADER_83 = 29182; // Doll Blader
+	private static final int VALE_MASTER_60 = 29024; // Veil Master
+	private static final int VALE_MASTER_83 = 29183; // Veil Master
+	private static final int PIRATES_ZOMBIE_60 = 29027; // Pirate Zombie
+	private static final int PIRATES_ZOMBIE_83 = 29185; // Pirate Zombie
+	private static final int PIRATES_ZOMBIE_CAPTAIN_60 = 29026; // Pirate Zombie Captain
+	private static final int PIRATES_ZOMBIE_CAPTAIN_83 = 29184; // Pirate Zombie Captain
+	// Items
+	private static final int VORPAL_RING = 15763; // Sealed Vorpal Ring
+	private static final int VORPAL_EARRING = 15764; // Sealed Vorpal Earring
+	private static final int FIRE = 15280; // Transparent 1HS (for NPC)
+	private static final int RED = 15281; // Transparent 1HS (for NPC)
+	private static final int BLUE = 15302; // Transparent Bow (for NPC)
+	// Locations
+	private static final Location[] ENTER_LOC =
+	{
+		new Location(52684, 219989, -3496),
+		new Location(52669, 219120, -3224),
+		new Location(52672, 219439, -3312),
+	};
+	private static final Location[] CANDLE_LOC =
+	{
+		// Floor 1
+		new Location(53313, 220133, -3498),
+		new Location(53313, 218079, -3498),
+		new Location(54240, 221045, -3498),
+		new Location(54325, 219095, -3498),
+		new Location(54240, 217155, -3498),
+		new Location(55257, 220028, -3498),
+		new Location(55257, 218172, -3498),
+		new Location(56280, 221045, -3498),
+		new Location(56195, 219095, -3498),
+		new Location(56280, 217155, -3498),
+		new Location(57215, 220133, -3498),
+		new Location(57215, 218079, -3498),
+		// Floor 2
+		new Location(53313, 220133, -3226),
+		new Location(53313, 218079, -3226),
+		new Location(54240, 221045, -3226),
+		new Location(54325, 219095, -3226),
+		new Location(54240, 217155, -3226),
+		new Location(55257, 220028, -3226),
+		new Location(55257, 218172, -3226),
+		new Location(56280, 221045, -3226),
+		new Location(56195, 219095, -3226),
+		new Location(56280, 217155, -3226),
+		new Location(57215, 220133, -3226),
+		new Location(57215, 218079, -3226),
+		// Floor 3
+		new Location(53313, 220133, -2954),
+		new Location(53313, 218079, -2954),
+		new Location(54240, 221045, -2954),
+		new Location(54325, 219095, -2954),
+		new Location(54240, 217155, -2954),
+		new Location(55257, 220028, -2954),
+		new Location(55257, 218172, -2954),
+		new Location(56280, 221045, -2954),
+		new Location(56195, 219095, -2954),
+		new Location(56280, 217155, -2954),
+		new Location(57215, 220133, -2954),
+		new Location(57215, 218079, -2954),
+	};
+	// Misc
+	private static final int MIN_LV_60 = 55;
+	private static final int MIN_LV_83 = 78;
+	private static final int PLAYERS_60_MIN = 9;
+	private static final int PLAYERS_60_MAX = 27;
+	private static final int PLAYERS_83_MIN = 9;
+	private static final int PLAYERS_83_MAX = 27;
+	private static final int INSTANCE_ID_60 = 133;
+	private static final int INSTANCE_ID_83 = 135;
+	private static final int HOURS = 6;
+	private static final int MINUTES = 30;
+	private static final int DAY_A = Calendar.MONDAY;
+	private static final int DAY_B = Calendar.WEDNESDAY;
+	private static final int DAY_C = Calendar.FRIDAY;
+	//@formatter:off
+	private static final int[][] ROOM_DATA =
+	{
+		// Floor 1
+		{54240, 220133, -3498, 1, 3, 4, 6},
+		{54240, 218073, -3498, 2, 5, 4, 7},
+		{55265, 219095, -3498, 4, 9, 6, 7},
+		{56289, 220133, -3498, 8, 11, 6, 9},
+		{56289, 218073, -3498, 10, 12, 7, 9},
+		// Floor 2
+		{54240, 220133, -3226, 13, 15, 16, 18},
+		{54240, 218073, -3226, 14, 17, 16, 19},
+		{55265, 219095, -3226, 21, 16, 19, 18},
+		{56289, 220133, -3226, 20, 23, 21, 18},
+		{56289, 218073, -3226, 22, 24, 19, 21},
+		// Floor 3
+		{54240, 220133, -2954, 25, 27, 28, 30},
+		{54240, 218073, -2954, 26, 29, 28, 31},
+		{55265, 219095, -2954, 33, 28, 31, 30},
+		{56289, 220133, -2954, 32, 35, 30, 33},
+		{56289, 218073, -2954, 34, 36, 31, 33}
+	};
+	//@formatter:on
+	
+	private CavernOfThePirateCaptain()
+	{
+		super(CavernOfThePirateCaptain.class.getSimpleName(), "instances");
+		addStartNpc(PATHFINDER);
+		addTalkId(PATHFINDER);
+		addKillId(ZAKEN_60, ZAKEN_83);
+		addFirstTalkId(CANDLE);
+	}
+	
+	private void enterInstance(L2PcInstance player, String template, boolean is83)
+	{
+		InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
+		
+		if (world != null)
+		{
+			if (world instanceof CavernOfThePirateCaptainWorld)
+			{
+				teleportPlayer(player, ENTER_LOC[getRandom(ENTER_LOC.length)], world.getInstanceId(), false);
+				return;
+			}
+			player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER);
+			return;
+		}
+		
+		if (checkConditions(player, is83))
+		{
+			world = new CavernOfThePirateCaptainWorld();
+			world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
+			world.setTemplateId(is83 ? INSTANCE_ID_83 : INSTANCE_ID_83);
+			world.setStatus(0);
+			InstanceManager.getInstance().addWorld(world);
+			final CavernOfThePirateCaptainWorld curworld = (CavernOfThePirateCaptainWorld) world;
+			curworld._is83 = is83;
+			curworld.storeTime = System.currentTimeMillis();
+			
+			if (!player.isInParty())
+			{
+				managePlayerEnter(player, curworld);
+			}
+			else if (player.getParty().isInCommandChannel())
+			{
+				for (L2PcInstance players : player.getParty().getCommandChannel().getMembers())
+				{
+					managePlayerEnter(players, curworld);
+				}
+			}
+			else
+			{
+				for (L2PcInstance players : player.getParty().getMembers())
+				{
+					managePlayerEnter(players, curworld);
+				}
+			}
+			manageNpcSpawn(curworld);
+		}
+	}
+	
+	private void managePlayerEnter(L2PcInstance player, CavernOfThePirateCaptainWorld world)
+	{
+		if (!world._is83)
+		{
+			player.stopAllEffectsExceptThoseThatLastThroughDeath();
+			if (player.hasSummon())
+			{
+				player.getSummon().stopAllEffectsExceptThoseThatLastThroughDeath();
+			}
+		}
+		world.playersInside.add(player);
+		world.addAllowed(player.getObjectId());
+		teleportPlayer(player, ENTER_LOC[getRandom(ENTER_LOC.length)], world.getInstanceId(), false);
+	}
+	
+	private boolean checkConditions(L2PcInstance player, boolean is83)
+	{
+		if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS))
+		{
+			return true;
+		}
+		
+		if (!player.isInParty())
+		{
+			broadcastSystemMessage(player, null, SystemMessageId.NOT_IN_PARTY_CANT_ENTER, false);
+			return false;
+		}
+		
+		final L2Party party = player.getParty();
+		final boolean isInCC = party.isInCommandChannel();
+		final List<L2PcInstance> members = (isInCC) ? party.getCommandChannel().getMembers() : party.getMembers();
+		final boolean isPartyLeader = (isInCC) ? party.getCommandChannel().isLeader(player) : party.isLeader(player);
+		
+		if (!isPartyLeader)
+		{
+			broadcastSystemMessage(player, null, SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER, false);
+			return false;
+		}
+		
+		if ((members.size() < (is83 ? PLAYERS_83_MIN : PLAYERS_60_MIN)) || (members.size() > (is83 ? PLAYERS_83_MAX : PLAYERS_60_MAX)))
+		{
+			broadcastSystemMessage(player, null, SystemMessageId.PARTY_EXCEEDED_THE_LIMIT_CANT_ENTER, false);
+			return false;
+		}
+		
+		for (L2PcInstance groupMembers : members)
+		{
+			if (groupMembers.getLevel() < (is83 ? MIN_LV_83 : MIN_LV_60))
+			{
+				broadcastSystemMessage(player, groupMembers, SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT, true);
+				return false;
+			}
+			
+			if (!player.isInsideRadius(groupMembers, 1000, true, true))
+			{
+				broadcastSystemMessage(player, groupMembers, SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED, true);
+				return false;
+			}
+			
+			final Long reentertime = InstanceManager.getInstance().getInstanceTime(groupMembers.getObjectId(), (is83 ? INSTANCE_ID_83 : INSTANCE_ID_60));
+			if (System.currentTimeMillis() < reentertime)
+			{
+				broadcastSystemMessage(player, groupMembers, SystemMessageId.C1_MAY_NOT_REENTER_YET, true);
+				return false;
+			}
+		}
+		return true;
+	}
+	
+	private void broadcastSystemMessage(L2PcInstance player, L2PcInstance member, SystemMessageId msgId, boolean toGroup)
+	{
+		final SystemMessage sm = SystemMessage.getSystemMessage(msgId);
+		
+		if (toGroup)
+		{
+			sm.addPcName(member);
+			
+			if (player.getParty().isInCommandChannel())
+			{
+				player.getParty().getCommandChannel().broadcastPacket(sm);
+			}
+			else
+			{
+				player.getParty().broadcastPacket(sm);
+			}
+		}
+		else
+		{
+			player.broadcastPacket(sm);
+		}
+	}
+	
+	@Override
+	public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+	{
+		if (event.equals("enter60"))
+		{
+			enterInstance(player, "CavernOfThePirateCaptainWorldDay60.xml", false);
+		}
+		else if (event.equals("enter83"))
+		{
+			enterInstance(player, "CavernOfThePirateCaptainWorldDay83.xml", true);
+		}
+		else
+		{
+			final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
+			
+			if ((tmpworld != null) && (tmpworld instanceof CavernOfThePirateCaptainWorld))
+			{
+				final CavernOfThePirateCaptainWorld world = (CavernOfThePirateCaptainWorld) tmpworld;
+				
+				switch (event)
+				{
+					case "BURN_BLUE":
+					{
+						if (npc.getRightHandItem() == 0)
+						{
+							npc.setRHandId(FIRE);
+							startQuestTimer("BURN_BLUE2", 3000, npc, player);
+							if (world._blueFounded == 4)
+							{
+								startQuestTimer("SHOW_ZAKEN", 5000, npc, player);
+							}
+						}
+						break;
+					}
+					case "BURN_BLUE2":
+					{
+						if (npc.getRightHandItem() == FIRE)
+						{
+							npc.setRHandId(BLUE);
+						}
+						break;
+					}
+					case "BURN_RED":
+					{
+						if (npc.getRightHandItem() == 0)
+						{
+							npc.setRHandId(FIRE);
+							startQuestTimer("BURN_RED2", 3000, npc, player);
+						}
+						break;
+					}
+					case "BURN_RED2":
+					{
+						if (npc.getRightHandItem() == FIRE)
+						{
+							final int room = getRoomByCandle(npc);
+							npc.setRHandId(RED);
+							manageScreenMsg(world, NpcStringId.THE_CANDLES_CAN_LEAD_YOU_TO_ZAKEN_DESTROY_HIM);
+							spawnNpc(world._is83 ? DOLL_BLADER_83 : DOLL_BLADER_60, room, player, world);
+							spawnNpc(world._is83 ? VALE_MASTER_83 : VALE_MASTER_60, room, player, world);
+							spawnNpc(world._is83 ? PIRATES_ZOMBIE_83 : PIRATES_ZOMBIE_60, room, player, world);
+							spawnNpc(world._is83 ? PIRATES_ZOMBIE_CAPTAIN_83 : PIRATES_ZOMBIE_CAPTAIN_60, room, player, world);
+						}
+						break;
+					}
+					case "SHOW_ZAKEN":
+					{
+						if (world._is83)
+						{
+							manageScreenMsg(world, NpcStringId.WHO_DARES_AWKAWEN_THE_MIGHTY_ZAKEN);
+						}
+						world._zaken.setInvisible(false);
+						world._zaken.setIsParalyzed(false);
+						spawnNpc(world._is83 ? DOLL_BLADER_83 : DOLL_BLADER_60, world._zakenRoom, player, world);
+						spawnNpc(world._is83 ? PIRATES_ZOMBIE_83 : PIRATES_ZOMBIE_60, world._zakenRoom, player, world);
+						spawnNpc(world._is83 ? PIRATES_ZOMBIE_CAPTAIN_83 : PIRATES_ZOMBIE_CAPTAIN_60, world._zakenRoom, player, world);
+						break;
+					}
+				}
+			}
+		}
+		return super.onAdvEvent(event, npc, player);
+	}
+	
+	@Override
+	public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
+	{
+		final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
+		
+		if ((tmpworld != null) && (tmpworld instanceof CavernOfThePirateCaptainWorld))
+		{
+			final CavernOfThePirateCaptainWorld world = (CavernOfThePirateCaptainWorld) tmpworld;
+			final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
+			
+			if (npc.getId() == ZAKEN_83)
+			{
+				for (L2PcInstance playersInside : world.playersInside)
+				{
+					if ((playersInside != null) && ((playersInside.getInstanceId() == world.getInstanceId()) && playersInside.isInsideRadius(npc, 1500, true, true)))
+					{
+						final long time = System.currentTimeMillis() - world.storeTime;
+						if (time <= 300000) // 5 minutes
+						{
+							if (getRandomBoolean())
+							{
+								giveItems(playersInside, VORPAL_RING, 1);
+							}
+						}
+						else if (time <= 600000) // 10 minutes
+						{
+							if (getRandom(100) < 30)
+							{
+								giveItems(playersInside, VORPAL_EARRING, 1);
+							}
+						}
+						else if (time <= 900000) // 15 minutes
+						{
+							if (getRandom(100) < 25)
+							{
+								giveItems(playersInside, VORPAL_RING, 1);
+							}
+						}
+					}
+				}
+			}
+			saveReenterForPlayers(world);
+			inst.setDuration(300000);
+			inst.setEmptyDestroyTime(0);
+		}
+		return super.onKill(npc, killer, isSummon);
+	}
+	
+	@Override
+	public String onFirstTalk(L2Npc npc, L2PcInstance player)
+	{
+		final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
+		
+		if ((tmpworld != null) && (tmpworld instanceof CavernOfThePirateCaptainWorld))
+		{
+			final CavernOfThePirateCaptainWorld world = (CavernOfThePirateCaptainWorld) tmpworld;
+			final boolean isBlue = npc.getVariables().getInt("isBlue", 0) == 1;
+			
+			if (npc.isScriptValue(0))
+			{
+				if (isBlue)
+				{
+					world._blueFounded++;
+					startQuestTimer("BURN_BLUE", 500, npc, player);
+				}
+				else
+				{
+					startQuestTimer("BURN_RED", 500, npc, player);
+				}
+				npc.setScriptValue(1);
+			}
+		}
+		return null;
+	}
+	
+	private int getRoomByCandle(L2Npc npc)
+	{
+		final int candleId = npc.getVariables().getInt("candleId", 0);
+		
+		for (int i = 0; i < 15; i++)
+		{
+			if ((ROOM_DATA[i][3] == candleId) || (ROOM_DATA[i][4] == candleId))
+			{
+				return i + 1;
+			}
+		}
+		
+		if ((candleId == 6) || (candleId == 7))
+		{
+			return 3;
+		}
+		else if ((candleId == 18) || (candleId == 19))
+		{
+			return 8;
+		}
+		else if ((candleId == 30) || (candleId == 31))
+		{
+			return 13;
+		}
+		return 0;
+	}
+	
+	private void manageScreenMsg(CavernOfThePirateCaptainWorld world, NpcStringId stringId)
+	{
+		for (L2PcInstance players : world.playersInside)
+		{
+			if ((players != null) && (players.getInstanceId() == world.getInstanceId()))
+			{
+				showOnScreenMsg(players, stringId, 2, 6000);
+			}
+		}
+	}
+	
+	private L2Attackable spawnNpc(int npcId, int roomId, L2PcInstance player, CavernOfThePirateCaptainWorld world)
+	{
+		if ((player != null) && (npcId != ZAKEN_60) && (npcId != ZAKEN_83))
+		{
+			final L2Attackable mob = (L2Attackable) addSpawn(npcId, ROOM_DATA[roomId - 1][0] + getRandom(350), ROOM_DATA[roomId - 1][1] + getRandom(350), ROOM_DATA[roomId - 1][2], 0, false, 0, false, world.getInstanceId());
+			attackPlayer(mob, player);
+			return mob;
+		}
+		return (L2Attackable) addSpawn(npcId, ROOM_DATA[roomId - 1][0], ROOM_DATA[roomId - 1][1], ROOM_DATA[roomId - 1][2], 0, false, 0, false, world.getInstanceId());
+	}
+	
+	private void manageNpcSpawn(CavernOfThePirateCaptainWorld world)
+	{
+		final List<L2Npc> candles = new ArrayList<>();
+		world._zakenRoom = getRandom(1, 15);
+		
+		for (int i = 0; i < 36; i++)
+		{
+			final L2Npc candle = addSpawn(CANDLE, CANDLE_LOC[i], false, 0, false, world.getInstanceId());
+			candle.getVariables().set("candleId", i + 1);
+			candles.add(candle);
+		}
+		
+		for (int i = 3; i < 7; i++)
+		{
+			candles.get(ROOM_DATA[world._zakenRoom - 1][i] - 1).getVariables().set("isBlue", 1);
+		}
+		world._zaken = spawnNpc(world._is83 ? ZAKEN_83 : ZAKEN_60, world._zakenRoom, null, world);
+		world._zaken.setInvisible(true);
+		world._zaken.setIsParalyzed(true);
+	}
+	
+	private void saveReenterForPlayers(InstanceWorld world)
+	{
+		final Calendar reenter = Calendar.getInstance();
+		reenter.set(Calendar.MINUTE, MINUTES);
+		reenter.set(Calendar.HOUR_OF_DAY, HOURS);
+		
+		if (reenter.getTimeInMillis() <= System.currentTimeMillis())
+		{
+			reenter.add(Calendar.DAY_OF_MONTH, 1);
+		}
+		
+		if ((reenter.get(Calendar.DAY_OF_WEEK) <= DAY_A) || (reenter.get(Calendar.DAY_OF_WEEK) > DAY_C))
+		{
+			while (reenter.get(Calendar.DAY_OF_WEEK) != DAY_A)
+			{
+				reenter.add(Calendar.DAY_OF_MONTH, 1);
+			}
+		}
+		else if (reenter.get(Calendar.DAY_OF_WEEK) <= DAY_B)
+		{
+			while (reenter.get(Calendar.DAY_OF_WEEK) != DAY_B)
+			{
+				reenter.add(Calendar.DAY_OF_MONTH, 1);
+			}
+		}
+		else
+		{
+			while (reenter.get(Calendar.DAY_OF_WEEK) != DAY_C)
+			{
+				reenter.add(Calendar.DAY_OF_MONTH, 1);
+			}
+		}
+		
+		final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_S1_RESTRICTED);
+		sm.addString(InstanceManager.getInstance().getInstanceIdName(world.getTemplateId()));
+		
+		for (int objectId : world.getAllowed())
+		{
+			final L2PcInstance player = L2World.getInstance().getPlayer(objectId);
+			InstanceManager.getInstance().setInstanceTime(objectId, world.getTemplateId(), reenter.getTimeInMillis());
+			if ((player != null) && player.isOnline())
+			{
+				player.sendPacket(sm);
+			}
+		}
+	}
+	
+	public static void main(String[] args)
+	{
+		new CavernOfThePirateCaptain();
+	}
+}
diff --git a/L2J_DataPack_BETA/dist/game/data/xsd/instance.xsd b/L2J_DataPack_BETA/dist/game/data/xsd/instance.xsd
index 5fbecd0525..e6550d6ff2 100644
--- a/L2J_DataPack_BETA/dist/game/data/xsd/instance.xsd
+++ b/L2J_DataPack_BETA/dist/game/data/xsd/instance.xsd
@@ -26,6 +26,8 @@
 				<xs:element name="showTimer" minOccurs="0" maxOccurs="1">
 					<xs:complexType>
 						<xs:attribute name="val" type="xs:boolean" use="required" />
+						<xs:attribute name="increase" type="xs:boolean" use="optional" />
+						<xs:attribute name="text" type="xs:normalizedString" use="optional" />
 					</xs:complexType>
 				</xs:element>
 				<xs:element name="spawnPoint" minOccurs="0" maxOccurs="1">
diff --git a/L2J_DataPack_BETA/dist/game/data/zones/custom_boss.xml b/L2J_DataPack_BETA/dist/game/data/zones/custom_boss.xml
index e3f185f420..2b4d86020f 100644
--- a/L2J_DataPack_BETA/dist/game/data/zones/custom_boss.xml
+++ b/L2J_DataPack_BETA/dist/game/data/zones/custom_boss.xml
@@ -1,14 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <list enabled="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/zones.xsd">
 	<!-- Boss Zones -->
-	<zone name="Zaken Boss" id="12000" type="BossZone" shape="NPoly" minZ="-4815" maxZ="-315">
-		<stat name="default_enabled" val="false" />
-		<stat name="InvadeTime" val="1800000" />
-		<node X="50797" Y="213515" />
-		<node X="57617" Y="213510" />
-		<node X="57669" Y="221683" />
-		<node X="50773" Y="221632" />
-	</zone>
 	<zone name="Anakim and Lilith Boss" id="12003" type="BossZone" shape="NPoly" minZ="-5504" maxZ="-5104">
 		<stat name="default_enabled" val="false" />
 		<stat name="InvadeTime" val="1800000" />
diff --git a/L2J_DataPack_BETA/dist/sql/game/grandboss_data.sql b/L2J_DataPack_BETA/dist/sql/game/grandboss_data.sql
index ebd683410e..05bd7585af 100644
--- a/L2J_DataPack_BETA/dist/sql/game/grandboss_data.sql
+++ b/L2J_DataPack_BETA/dist/sql/game/grandboss_data.sql
@@ -17,7 +17,7 @@ INSERT IGNORE INTO `grandboss_data` (`boss_id`,`loc_x`,`loc_y`,`loc_z`,`heading`
 (29014, 55024, 17368, -5412, 10126, 622493.58388, 3793.536), -- Orfen (50)
 -- (29019, 185708, 114298, -8221, 32768, 17850000, 39960), -- Antharas (79)
 (29020, 116033, 17447, 10107, -25348, 4068372, 39960), -- Baium (75)
-(29022, 55312, 219168, -3223, 0, 858518.36, 399600), -- Zaken (60)
+-- (29022, 55312, 219168, -3223, 0, 858518.36, 399600), -- Zaken (60)
 -- (29025, 0, 0, 0, 0, 0, 0), -- Baium (Stone) (75)
 (29028, -105200, -253104, -15264, 0, 62041918, 2248572), -- Valakas (85)
 -- (29066, 185708, 114298, -8221,32768, 14518000, 3996000), -- Antharas Weak (79)
diff --git a/L2J_DataPack_BETA/dist/sql/game/updates/20140517update.sql b/L2J_DataPack_BETA/dist/sql/game/updates/20140517update.sql
new file mode 100644
index 0000000000..558b762658
--- /dev/null
+++ b/L2J_DataPack_BETA/dist/sql/game/updates/20140517update.sql
@@ -0,0 +1 @@
+DELETE FROM grandboss_data WHERE boss_id = '29022';
\ No newline at end of file
-- 
GitLab