Sfoglia il codice sorgente

Continuing Gracia Update - tnx goes to all who worked on that

nBd 16 anni fa
parent
commit
1bef527ced
100 ha cambiato i file con 3954 aggiunte e 1231 eliminazioni
  1. 4 4
      L2_GameServer/.classpath
  2. 1 0
      L2_GameServer/build.xml
  3. 14 0
      L2_GameServer/java/config/General.properties
  4. 22 2
      L2_GameServer/java/net/sf/l2j/Config.java
  5. 59 19
      L2_GameServer/java/net/sf/l2j/gameserver/GameServer.java
  6. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/Olympiad.java
  7. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/ThreadPoolManager.java
  8. 1 2
      L2_GameServer/java/net/sf/l2j/gameserver/Universe.java
  9. 5 23
      L2_GameServer/java/net/sf/l2j/gameserver/ai/L2AttackableAI.java
  10. 3 8
      L2_GameServer/java/net/sf/l2j/gameserver/ai/L2CharacterAI.java
  11. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/ai/L2ControllableMobAI.java
  12. 0 14
      L2_GameServer/java/net/sf/l2j/gameserver/ai/L2DoorAI.java
  13. 0 1
      L2_GameServer/java/net/sf/l2j/gameserver/cache/FastMRUCache.java
  14. 2 2
      L2_GameServer/java/net/sf/l2j/gameserver/communitybbs/BB/Topic.java
  15. 8 7
      L2_GameServer/java/net/sf/l2j/gameserver/datatables/AccessLevels.java
  16. 6 4
      L2_GameServer/java/net/sf/l2j/gameserver/datatables/AdminCommandAccessRight.java
  17. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/datatables/CharTemplateTable.java
  18. 0 39
      L2_GameServer/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminEditNpc.java
  19. 0 1
      L2_GameServer/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminGeodata.java
  20. 3 3
      L2_GameServer/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminZone.java
  21. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/handler/itemhandlers/ChristmasTree.java
  22. 15 3
      L2_GameServer/java/net/sf/l2j/gameserver/handler/itemhandlers/Potions.java
  23. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/handler/itemhandlers/SevenSignsRecord.java
  24. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/handler/itemhandlers/SummonItems.java
  25. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/BeastFeed.java
  26. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/CombatPointHeal.java
  27. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/Craft.java
  28. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/DeluxeKey.java
  29. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/DrainSoul.java
  30. 2 4
      L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/Fishing.java
  31. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/FishingSkill.java
  32. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/GiveSp.java
  33. 2 1
      L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/Harvest.java
  34. 7 1
      L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/Heal.java
  35. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/ManaHeal.java
  36. 85 85
      L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/Manadam.java
  37. 21 1
      L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/Mdam.java
  38. 21 0
      L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/Pdam.java
  39. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/Recall.java
  40. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/SiegeFlag.java
  41. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/Soul.java
  42. 2 1
      L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/Sow.java
  43. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/StrSiegeAssault.java
  44. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/SummonFriend.java
  45. 1 2
      L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/SummonTreasureKey.java
  46. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/Sweep.java
  47. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/TakeCastle.java
  48. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/TakeFort.java
  49. 1 2
      L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/Unlock.java
  50. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/handler/usercommandhandlers/Escape.java
  51. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/handler/usercommandhandlers/Loc.java
  52. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Wedding.java
  53. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/idfactory/CompactionIDFactory.java
  54. 1861 0
      L2_GameServer/java/net/sf/l2j/gameserver/instancemanager/FourSepulchersManager.java
  55. 13 3
      L2_GameServer/java/net/sf/l2j/gameserver/instancemanager/GrandBossManager.java
  56. 270 0
      L2_GameServer/java/net/sf/l2j/gameserver/instancemanager/RaidBossPointsManager.java
  57. 115 83
      L2_GameServer/java/net/sf/l2j/gameserver/instancemanager/ZoneManager.java
  58. 2 2
      L2_GameServer/java/net/sf/l2j/gameserver/model/ClanWarehouse.java
  59. 0 2
      L2_GameServer/java/net/sf/l2j/gameserver/model/Inventory.java
  60. 12 10
      L2_GameServer/java/net/sf/l2j/gameserver/model/L2AccessLevel.java
  61. 10 8
      L2_GameServer/java/net/sf/l2j/gameserver/model/L2AdminCommandAccessRights.java
  62. 30 35
      L2_GameServer/java/net/sf/l2j/gameserver/model/L2Attackable.java
  63. 27 44
      L2_GameServer/java/net/sf/l2j/gameserver/model/L2Character.java
  64. 10 10
      L2_GameServer/java/net/sf/l2j/gameserver/model/L2Clan.java
  65. 0 1
      L2_GameServer/java/net/sf/l2j/gameserver/model/L2EnchantSkillLearn.java
  66. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/model/L2ItemInstance.java
  67. 8 2
      L2_GameServer/java/net/sf/l2j/gameserver/model/L2Skill.java
  68. 9 4
      L2_GameServer/java/net/sf/l2j/gameserver/model/L2Spawn.java
  69. 1 18
      L2_GameServer/java/net/sf/l2j/gameserver/model/L2Summon.java
  70. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/model/L2World.java
  71. 72 87
      L2_GameServer/java/net/sf/l2j/gameserver/model/L2WorldRegion.java
  72. 21 0
      L2_GameServer/java/net/sf/l2j/gameserver/model/PcInventory.java
  73. 2 2
      L2_GameServer/java/net/sf/l2j/gameserver/model/PcWarehouse.java
  74. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/model/TradeList.java
  75. 0 1
      L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2ArtefactInstance.java
  76. 0 542
      L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2BoxInstance.java
  77. 0 2
      L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2CastleTeleporterInstance.java
  78. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2ClassMasterInstance.java
  79. 0 5
      L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2DoorInstance.java
  80. 34 0
      L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2GrandBossInstance.java
  81. 0 1
      L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2MonsterInstance.java
  82. 12 4
      L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2NpcInstance.java
  83. 11 36
      L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
  84. 33 16
      L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2RaidBossInstance.java
  85. 480 0
      L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2SepulcherMonsterInstance.java
  86. 459 0
      L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2SepulcherNpcInstance.java
  87. 0 1
      L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2StaticObjectInstance.java
  88. 1 1
      L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2SymbolMakerInstance.java
  89. 5 0
      L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2TeleporterInstance.java
  90. 18 6
      L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java
  91. 1 2
      L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2XmassTreeInstance.java
  92. 0 1
      L2_GameServer/java/net/sf/l2j/gameserver/model/actor/knownlist/PcKnownList.java
  93. 2 2
      L2_GameServer/java/net/sf/l2j/gameserver/model/entity/Auction.java
  94. 2 2
      L2_GameServer/java/net/sf/l2j/gameserver/model/entity/FortSiege.java
  95. 2 2
      L2_GameServer/java/net/sf/l2j/gameserver/model/entity/Siege.java
  96. 96 29
      L2_GameServer/java/net/sf/l2j/gameserver/model/quest/Quest.java
  97. 10 1
      L2_GameServer/java/net/sf/l2j/gameserver/model/quest/QuestState.java
  98. 1 2
      L2_GameServer/java/net/sf/l2j/gameserver/model/waypoint/WayPointNode.java
  99. 6 2
      L2_GameServer/java/net/sf/l2j/gameserver/model/zone/L2ZoneType.java
  100. 2 2
      L2_GameServer/java/net/sf/l2j/gameserver/model/zone/type/L2ArenaZone.java

+ 4 - 4
L2_GameServer/.classpath

@@ -4,15 +4,15 @@
 	<classpathentry excluding="**/.svn/*|.svn" kind="src" path="javaTest"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="lib" path="lib/jython.jar"/>
-	<classpathentry kind="lib" path="lib/bsh-2.0b4.jar"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
 	<classpathentry kind="lib" path="lib/c3p0-0.9.1.2.jar"/>
 	<classpathentry kind="lib" path="lib/mysql-connector-java-5.1.5-bin.jar"/>
-	<classpathentry kind="lib" path="lib/jython-engine.jar"/>
-	<classpathentry kind="lib" path="lib/bsh-engine.jar"/>
 	<classpathentry kind="lib" path="lib/ecj.jar"/>
-	<classpathentry kind="lib" path="lib/java-engine.jar"/>
 	<classpathentry kind="lib" path="lib/mmocore.jar"/>
 	<classpathentry kind="lib" path="lib/javolution.jar"/>
+	<classpathentry kind="lib" path="lib/bsh-engine.jar"/>
+	<classpathentry kind="lib" path="lib/java-engine.jar"/>
+	<classpathentry kind="lib" path="lib/jython-engine.jar"/>
+	<classpathentry kind="lib" path="lib/bsh-2.0b5.jar"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>

+ 1 - 0
L2_GameServer/build.xml

@@ -35,6 +35,7 @@
         <fileset dir="${lib}">
             <include name="c3p0-0.9.1.2.jar"/>
         	<include name="jython.jar"/>
+        	<include name="jython-engine.jar"/>
         	<include name="javolution.jar"/>
         	<include name="mysql-connector-java-5.1.5-bin.jar"/>
         	<include name="mmocore.jar"/>

+ 14 - 0
L2_GameServer/java/config/General.properties

@@ -469,6 +469,20 @@ CaptainCost = 27
 CommanderCost = 30
 HeroCost = 33
 
+#===========================================================#
+#                      Four Sepulchers                      #
+#===========================================================#
+
+TimeOfAttack = 50
+
+TimeOfCoolDown = 5
+
+TimeOfEntry = 3
+
+TimeOfWarmUp = 2
+
+NumberOfNecessaryPartyMembers = 4
+
 #============================================================#
 #                        Punishment                          #
 #============================================================#

+ 22 - 2
L2_GameServer/java/net/sf/l2j/Config.java

@@ -430,6 +430,11 @@ public final class Config
     public static float		ALT_LOTTERY_4_NUMBER_RATE;
     public static float		ALT_LOTTERY_3_NUMBER_RATE;
     public static int		ALT_LOTTERY_2_AND_1_NUMBER_PRIZE;
+	public static int		FS_TIME_ATTACK;
+	public static int		FS_TIME_COOLDOWN;
+	public static int		FS_TIME_ENTRY;
+	public static int		FS_TIME_WARMUP;
+	public static int		FS_PARTY_MEMBER_COUNT;
     public static int		RIFT_MIN_PARTY_SIZE;
     public static int		RIFT_SPAWN_DELAY;
     public static int		RIFT_MAX_JUMPS;
@@ -914,8 +919,8 @@ public final class Config
                 MAX_CHARACTERS_NUMBER_PER_ACCOUNT = Integer.parseInt(serverSettings.getProperty("CharMaxNumber", "0"));
                 MAXIMUM_ONLINE_USERS        = Integer.parseInt(serverSettings.getProperty("MaximumOnlineUsers", "100"));
 
-                MIN_PROTOCOL_REVISION   = Integer.parseInt(serverSettings.getProperty("MinProtocolRevision", "851"));
-                MAX_PROTOCOL_REVISION   = Integer.parseInt(serverSettings.getProperty("MaxProtocolRevision", "851"));
+                MIN_PROTOCOL_REVISION   = Integer.parseInt(serverSettings.getProperty("MinProtocolRevision", "660"));
+                MAX_PROTOCOL_REVISION   = Integer.parseInt(serverSettings.getProperty("MaxProtocolRevision", "665"));
 
                 if (MIN_PROTOCOL_REVISION > MAX_PROTOCOL_REVISION)
                 {
@@ -1439,6 +1444,21 @@ public final class Config
                 ALT_LOTTERY_4_NUMBER_RATE					= Float.parseFloat(General.getProperty("AltLottery4NumberRate","0.2"));
                 ALT_LOTTERY_3_NUMBER_RATE					= Float.parseFloat(General.getProperty("AltLottery3NumberRate","0.2"));
                 ALT_LOTTERY_2_AND_1_NUMBER_PRIZE			= Integer.parseInt(General.getProperty("AltLottery2and1NumberPrize","200"));
+    			FS_TIME_ATTACK								= Integer.parseInt(General.getProperty("TimeOfAttack", "50"));
+    			FS_TIME_COOLDOWN 							= Integer.parseInt(General.getProperty("TimeOfCoolDown", "5"));
+    			FS_TIME_ENTRY 								= Integer.parseInt(General.getProperty("TimeOfEntry", "3"));
+    			FS_TIME_WARMUP 								= Integer.parseInt(General.getProperty("TimeOfWarmUp", "2"));
+    			FS_PARTY_MEMBER_COUNT 						= Integer.parseInt(General.getProperty("NumberOfNecessaryPartyMembers", "4"));
+    			if (FS_TIME_ATTACK <= 0)
+    				FS_TIME_ATTACK = 50;
+    			if (FS_TIME_COOLDOWN <= 0)
+    				FS_TIME_COOLDOWN = 5;
+    			if (FS_TIME_ENTRY <= 0)
+    				FS_TIME_ENTRY = 3;
+    			if (FS_TIME_ENTRY <= 0)
+    				FS_TIME_ENTRY = 3;
+    			if (FS_TIME_ENTRY <= 0)
+    				FS_TIME_ENTRY = 3;
                 RIFT_MIN_PARTY_SIZE							= Integer.parseInt(General.getProperty("RiftMinPartySize", "5"));
                 RIFT_MAX_JUMPS								= Integer.parseInt(General.getProperty("MaxRiftJumps", "4"));
                 RIFT_SPAWN_DELAY							= Integer.parseInt(General.getProperty("RiftSpawnDelay", "10000"));

+ 59 - 19
L2_GameServer/java/net/sf/l2j/gameserver/GameServer.java

@@ -33,7 +33,6 @@ import net.sf.l2j.gameserver.cache.CrestCache;
 import net.sf.l2j.gameserver.cache.HtmCache;
 import net.sf.l2j.gameserver.communitybbs.Manager.ForumsBBSManager;
 import net.sf.l2j.gameserver.datatables.AccessLevels;
-import net.sf.l2j.gameserver.datatables.AdminCommandAccessRights;
 import net.sf.l2j.gameserver.datatables.ArmorSetsTable;
 import net.sf.l2j.gameserver.datatables.AugmentationData;
 import net.sf.l2j.gameserver.datatables.CharNameTable;
@@ -62,7 +61,6 @@ import net.sf.l2j.gameserver.datatables.SpawnTable;
 import net.sf.l2j.gameserver.datatables.StaticObjects;
 import net.sf.l2j.gameserver.datatables.SummonItemsData;
 import net.sf.l2j.gameserver.datatables.TeleportLocationTable;
-import net.sf.l2j.gameserver.datatables.ZoneData;
 import net.sf.l2j.gameserver.geoeditorcon.GeoEditorListener;
 import net.sf.l2j.gameserver.handler.AdminCommandHandler;
 import net.sf.l2j.gameserver.handler.ChatHandler;
@@ -82,16 +80,20 @@ import net.sf.l2j.gameserver.instancemanager.DayNightSpawnManager;
 import net.sf.l2j.gameserver.instancemanager.DimensionalRiftManager;
 import net.sf.l2j.gameserver.instancemanager.FortManager;
 import net.sf.l2j.gameserver.instancemanager.FortSiegeManager;
+import net.sf.l2j.gameserver.instancemanager.FourSepulchersManager;
 import net.sf.l2j.gameserver.instancemanager.GrandBossManager;
 import net.sf.l2j.gameserver.instancemanager.ItemsOnGroundManager;
 import net.sf.l2j.gameserver.instancemanager.MercTicketManager;
 import net.sf.l2j.gameserver.instancemanager.PetitionManager;
 import net.sf.l2j.gameserver.instancemanager.QuestManager;
+import net.sf.l2j.gameserver.instancemanager.RaidBossPointsManager;
 import net.sf.l2j.gameserver.instancemanager.RaidBossSpawnManager;
 import net.sf.l2j.gameserver.instancemanager.SiegeManager;
 import net.sf.l2j.gameserver.instancemanager.TransformationManager;
+import net.sf.l2j.gameserver.instancemanager.ZoneManager;
 import net.sf.l2j.gameserver.model.AutoChatHandler;
 import net.sf.l2j.gameserver.model.AutoSpawnHandler;
+import net.sf.l2j.gameserver.model.L2AdminCommandAccessRights;
 import net.sf.l2j.gameserver.model.L2Manor;
 import net.sf.l2j.gameserver.model.L2PetDataTable;
 import net.sf.l2j.gameserver.model.L2World;
@@ -101,6 +103,7 @@ import net.sf.l2j.gameserver.network.L2GameClient;
 import net.sf.l2j.gameserver.network.L2GamePacketHandler;
 import net.sf.l2j.gameserver.pathfinding.geonodes.GeoPathFinding;
 import net.sf.l2j.gameserver.script.faenor.FaenorScriptEngine;
+import net.sf.l2j.gameserver.scripting.CompiledScriptCache;
 import net.sf.l2j.gameserver.scripting.L2ScriptEngineManager;
 import net.sf.l2j.gameserver.taskmanager.KnownListUpdateTaskManager;
 import net.sf.l2j.gameserver.taskmanager.TaskManager;
@@ -156,6 +159,8 @@ public class GameServer
 	}
 	public GameServer() throws Exception
 	{
+		long serverLoadStart = System.currentTimeMillis();
+		
         gameServer = this;
 		_log.finest("used mem:" + getUsedMemoryMB()+"MB" );
 
@@ -178,7 +183,8 @@ public class GameServer
 
 		new File(Config.DATAPACK_ROOT, "data/clans").mkdirs();
 		new File(Config.DATAPACK_ROOT, "data/crests").mkdirs();
-
+		
+		
         // load script engines
         L2ScriptEngineManager.getInstance();
         
@@ -188,28 +194,37 @@ public class GameServer
 		// keep the references of Singletons to prevent garbage collection
 		CharNameTable.getInstance();
 
+		_skillTable = SkillTable.getInstance();
+		if (!_skillTable.isInitialized())
+		{
+		    _log.severe("Could not find the extraced files. Please Check Your Data.");
+		    throw new Exception("Could not initialize the skill table");
+		}
+		
 		_itemTable = ItemTable.getInstance();
 		if (!_itemTable.isInitialized())
 		{
 		    _log.severe("Could not find the extraced files. Please Check Your Data.");
 		    throw new Exception("Could not initialize the item table");
 		}
+		
+		// Load clan hall data before zone data and doors table
+        _cHManager = ClanHallManager.getInstance();
+        
+		_doorTable = DoorTable.getInstance();
+		_doorTable.parseData();
+        StaticObjects.getInstance();
 
 		ExtractableItemsData.getInstance();
 		SummonItemsData.getInstance();
 
 		MerchantPriceConfigTable.getInstance();
 		TradeController.getInstance();
-		_skillTable = SkillTable.getInstance();
-		if (!_skillTable.isInitialized())
-		{
-		    _log.severe("Could not find the extraced files. Please Check Your Data.");
-		    throw new Exception("Could not initialize the skill table");
-		}
 		
-		// L2EMU_ADD by Rayan. L2J - BigBro
 		if(Config.ALLOW_NPC_WALKERS)
+		{
 		    NpcWalkerRoutesTable.getInstance().load();
+		}
 		
 		NpcBufferTable.getInstance();
 		
@@ -260,8 +275,7 @@ public class GameServer
         if (Config.GEODATA == 2)
         	GeoPathFinding.getInstance();
 
-        // Load clan hall data before zone data
-        _cHManager = ClanHallManager.getInstance();
+        
 		CastleManager.getInstance();
 		SiegeManager.getInstance();
 		FortManager.getInstance();
@@ -270,11 +284,13 @@ public class GameServer
 		TeleportLocationTable.getInstance();
 		LevelUpData.getInstance();
 		L2World.getInstance();
-		ZoneData.getInstance();
         SpawnTable.getInstance();
+		ZoneManager.getInstance();
         RaidBossSpawnManager.getInstance();
         DayNightSpawnManager.getInstance().notifyChangeMode();
         GrandBossManager.getInstance();
+        RaidBossPointsManager.init();
+        FourSepulchersManager.getInstance().init();
         DimensionalRiftManager.getInstance();
 		Announcements.getInstance();
 		MapRegionTable.getInstance();
@@ -303,7 +319,33 @@ public class GameServer
         {
             _log.severe("Failed loading scripts.cfg, no script going to be loaded");
         }
-        
+        try
+        {
+        	CompiledScriptCache compiledScriptCache = L2ScriptEngineManager.getInstance().getCompiledScriptCache();
+        	if (compiledScriptCache == null)
+        	{
+        		_log.info("Compiled Scripts Cache is disabled.");
+        	}
+        	else
+        	{
+        		compiledScriptCache.purge();
+        		
+        		if (compiledScriptCache.isModified())
+        		{
+        			compiledScriptCache.save();
+        			_log.info("Compiled Scripts Cache was saved.");
+        		}
+        		else
+        		{
+        			_log.info("Compiled Scripts Cache is up-to-date.");
+        		}
+        	}
+        	
+        }
+        catch (IOException e)
+        {
+        	_log.log(Level.SEVERE, "Failed to store Compiled Scripts Cache.", e);
+        }
         QuestManager.getInstance().report();
         TransformationManager.getInstance().report();
         
@@ -316,10 +358,6 @@ public class GameServer
 
         MonsterRace.getInstance();
 
-		_doorTable = DoorTable.getInstance();
-		_doorTable.parseData();
-        StaticObjects.getInstance();
-
 		_sevenSignsEngine = SevenSigns.getInstance();
         SevenSignsFestival.getInstance();
 		_autoSpawnHandler = AutoSpawnHandler.getInstance();
@@ -346,7 +384,7 @@ public class GameServer
 		VoicedCommandHandler.getInstance();
 
 		AccessLevels.getInstance();
-		AdminCommandAccessRights.getInstance();
+		L2AdminCommandAccessRights.getInstance();
 		
 		if(Config.L2JMOD_ALLOW_WEDDING)
 			CoupleManager.getInstance();
@@ -453,6 +491,8 @@ public class GameServer
 		}
 		_selectorThread.start();
 		_log.config("Maximum Numbers of Connected Players: " + Config.MAXIMUM_ONLINE_USERS);
+		long serverLoadEnd = System.currentTimeMillis();
+		_log.info("Server Loaded in "+((serverLoadEnd - serverLoadStart) / 1000)+" seconds");
 	}
 
 	public static void main(String[] args) throws Exception

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/Olympiad.java

@@ -2089,7 +2089,7 @@ public class Olympiad
             try {    		
             	for (L2PcInstance player : _players)
             		player.sendPacket(_sm);
-            } catch (Exception e) {};
+            } catch (Exception e) {}
     	}
     	
     	protected void portPlayersBack()

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/ThreadPoolManager.java

@@ -96,7 +96,7 @@ public class ThreadPoolManager
 	private ThreadPoolManager()
 	{
 		_effectsScheduledThreadPool = new ScheduledThreadPoolExecutor(Config.THREAD_P_EFFECTS, new PriorityThreadFactory("EffectsSTPool", Thread.NORM_PRIORITY));
-		_generalScheduledThreadPool = new ScheduledThreadPoolExecutor(Config.THREAD_P_GENERAL, new PriorityThreadFactory("GerenalSTPool", Thread.NORM_PRIORITY));
+		_generalScheduledThreadPool = new ScheduledThreadPoolExecutor(Config.THREAD_P_GENERAL, new PriorityThreadFactory("GeneralSTPool", Thread.NORM_PRIORITY));
 
 		_ioPacketsThreadPool = new ThreadPoolExecutor(Config.IO_PACKET_THREAD_CORE_SIZE, Integer.MAX_VALUE,
 		                                                  5L, TimeUnit.SECONDS,

+ 1 - 2
L2_GameServer/java/net/sf/l2j/gameserver/Universe.java

@@ -295,8 +295,7 @@ public class Universe implements java.io.Serializable
         /* (non-Javadoc)
          * @see java.io.FilenameFilter#accept(java.io.File, java.lang.String)
          */
-        public boolean accept(@SuppressWarnings("unused")
-        File arg0, String name)
+        public boolean accept(File arg0, String name)
         {
             return name.startsWith("universe") && name.endsWith("." + _ext);
         }

+ 5 - 23
L2_GameServer/java/net/sf/l2j/gameserver/ai/L2AttackableAI.java

@@ -685,29 +685,11 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
 							        && _actor.getAttackByList().contains(originalAttackTarget)
 							        && (npc.getAI()._intention == CtrlIntention.AI_INTENTION_IDLE || npc.getAI()._intention == CtrlIntention.AI_INTENTION_ACTIVE)
 							        && GeoData.getInstance().canSeeTarget(_actor, npc))
-							{
-								if (originalAttackTarget instanceof L2PcInstance
-								        && originalAttackTarget.isInParty()
-								        && originalAttackTarget.getParty().isInDimensionalRift())
-								{
-									byte riftType = originalAttackTarget.getParty().getDimensionalRift().getType();
-									byte riftRoom = originalAttackTarget.getParty().getDimensionalRift().getCurrentRoom();
-									
-									if (_actor instanceof L2RiftInvaderInstance
-									        && !DimensionalRiftManager.getInstance().getRoom(riftType, riftRoom).checkIfInZone(npc.getX(), npc.getY(), npc.getZ()))
-										continue;
-								}
-								
-								// TODO: notifyEvent ought to be removed from
-								// here and added in the AI script, when
-								// implemented (Fulminus)
-								// Notify the L2Object AI with EVT_AGGRESSION
-								npc.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, originalAttackTarget, 1);
-								if ((originalAttackTarget instanceof L2PcInstance)
-								        || (originalAttackTarget instanceof L2Summon))
-								{
-									if (npc.getTemplate().getEventQuests(Quest.QuestEventType.ON_FACTION_CALL) != null)
-									{
+        					{
+	        					if ((originalAttackTarget instanceof L2PcInstance) || (originalAttackTarget instanceof L2Summon))
+	        					{
+	        						if (npc.getTemplate().getEventQuests(Quest.QuestEventType.ON_FACTION_CALL) != null)
+	        						{
 										L2PcInstance player = (originalAttackTarget instanceof L2PcInstance) ? (L2PcInstance) originalAttackTarget : ((L2Summon) originalAttackTarget).getOwner();
 										for (Quest quest : npc.getTemplate().getEventQuests(Quest.QuestEventType.ON_FACTION_CALL))
 											quest.notifyFactionCall(npc, (L2NpcInstance) _actor, player, (originalAttackTarget instanceof L2Summon));

+ 3 - 8
L2_GameServer/java/net/sf/l2j/gameserver/ai/L2CharacterAI.java

@@ -537,9 +537,7 @@ public class L2CharacterAI extends AbstractAI
      * Do nothing.<BR><BR>
      */
     @Override
-	protected void onEvtAggression(@SuppressWarnings("unused")
-    L2Character target, @SuppressWarnings("unused")
-    int aggro)
+	protected void onEvtAggression(L2Character target, int aggro)
     {
         // do nothing
     }
@@ -602,8 +600,7 @@ public class L2CharacterAI extends AbstractAI
      *
      */
     @Override
-	protected void onEvtSleeping(@SuppressWarnings("unused")
-    L2Character attacker)
+	protected void onEvtSleeping(L2Character attacker)
     {
         // Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)
         _actor.broadcastPacket(new AutoAttackStop(_actor.getObjectId()));
@@ -691,9 +688,7 @@ public class L2CharacterAI extends AbstractAI
      * Do nothing.<BR><BR>
      */
     @Override
-	protected void onEvtUserCmd(@SuppressWarnings("unused")
-    Object arg0, @SuppressWarnings("unused")
-    Object arg1)
+	protected void onEvtUserCmd(Object arg0, Object arg1)
     {
         // do nothing
     }

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/ai/L2ControllableMobAI.java

@@ -192,7 +192,7 @@ public class L2ControllableMobAI extends L2AttackableAI
 		try {
 			skills = _actor.getAllSkills();
 			dist2 = _actor.getPlanDistanceSq(target.getX(), target.getY());
-			range = _actor.getPhysicalAttackRange() + _actor.getTemplate().collisionRadius + target.getTemplate().collisionRadius;;
+			range = _actor.getPhysicalAttackRange() + _actor.getTemplate().collisionRadius + target.getTemplate().collisionRadius;
 			max_range = range;
 		}
         catch (NullPointerException e) {

+ 0 - 14
L2_GameServer/java/net/sf/l2j/gameserver/ai/L2DoorAI.java

@@ -43,59 +43,45 @@ public class L2DoorAI extends L2CharacterAI {
 	@Override
 	protected void onIntentionRest() {}
     @Override
-	@SuppressWarnings("unused")
 	protected void onIntentionAttack(L2Character target) {}
     @Override
-	@SuppressWarnings("unused")
 	protected void onIntentionCast(L2Skill skill, L2Object target) {}
     @Override
-	@SuppressWarnings("unused")
 	protected void onIntentionMoveTo(L2CharPosition destination) {}
     @Override
-	@SuppressWarnings("unused")
 	protected void onIntentionFollow(L2Character target) {}
     @Override
-	@SuppressWarnings("unused")
 	protected void onIntentionPickUp(L2Object item) {}
     @Override
-	@SuppressWarnings("unused")
 	protected void onIntentionInteract(L2Object object) {}
 
 	@Override
 	protected void onEvtThink() {}
     @Override
-	@SuppressWarnings("unused")
 	protected void onEvtAttacked(L2Character attacker)
     {
     	L2DoorInstance me = (L2DoorInstance)_actor;
         ThreadPoolManager.getInstance().executeTask(new onEventAttackedDoorTask(me, attacker));
 	}
     @Override
-	@SuppressWarnings("unused")
 	protected void onEvtAggression(L2Character target, int aggro) {}
     @Override
-	@SuppressWarnings("unused")
 	protected void onEvtStunned(L2Character attacker) {}
     @Override
-	@SuppressWarnings("unused")
 	protected void onEvtSleeping(L2Character attacker) {}
     @Override
-	@SuppressWarnings("unused")
 	protected void onEvtRooted(L2Character attacker) {}
 	@Override
 	protected void onEvtReadyToAct() {}
     @Override
-	@SuppressWarnings("unused")
 	protected void onEvtUserCmd(Object arg0, Object arg1) {}
 	@Override
 	protected void onEvtArrived() {}
 	@Override
 	protected void onEvtArrivedRevalidate() {}
     @Override
-	@SuppressWarnings("unused")
 	protected void onEvtArrivedBlocked(L2CharPosition blocked_at_pos) {}
     @Override
-	@SuppressWarnings("unused")
 	protected void onEvtForgetObject(L2Object object) {}
 	@Override
 	protected void onEvtCancel() {}

+ 0 - 1
L2_GameServer/java/net/sf/l2j/gameserver/cache/FastMRUCache.java

@@ -63,7 +63,6 @@ public class FastMRUCache<K,V> extends FastCollection implements Reusable
     /**
      * Holds the set factory.
      */
-    @SuppressWarnings("unchecked")
     private static final ObjectFactory FACTORY = new ObjectFactory() {
 
         @Override

+ 2 - 2
L2_GameServer/java/net/sf/l2j/gameserver/communitybbs/BB/Topic.java

@@ -172,5 +172,5 @@ public class Topic
 	public long getDate()
 	{
 		return _date;
-	};
-}
+	}
+}

+ 8 - 7
L2_GameServer/java/net/sf/l2j/gameserver/datatables/AccessLevels.java

@@ -23,6 +23,7 @@ import java.util.logging.Logger;
 import javolution.util.FastMap;
 import net.sf.l2j.Config;
 import net.sf.l2j.L2DatabaseFactory;
+import net.sf.l2j.gameserver.model.L2AccessLevel;
 
 /**
  * @author FBIagent<br>
@@ -36,13 +37,13 @@ public class AccessLevels
 	/** Reserved master access level<br> */
 	public static final int _masterAccessLevelNum = Config.MASTERACCESS_LEVEL;
 	/** The master access level which can use everything<br> */
-	public static AccessLevel _masterAccessLevel = new AccessLevel(_masterAccessLevelNum, "Master Access", Config.MASTERACCESS_NAME_COLOR, Config.MASTERACCESS_TITLE_COLOR, null, true, true, true, true, true, true, true, true);
+	public static L2AccessLevel _masterAccessLevel = new L2AccessLevel(_masterAccessLevelNum, "Master Access", Config.MASTERACCESS_NAME_COLOR, Config.MASTERACCESS_TITLE_COLOR, null, true, true, true, true, true, true, true, true);
 	/** Reserved user access level<br> */
 	public static final int _userAccessLevelNum = 0;
 	/** The user access level which can do no administrative tasks<br> */
-	public static AccessLevel _userAccessLevel = new AccessLevel(_userAccessLevelNum, "User", Integer.decode("0xFFFFFF"), Integer.decode("0xFFFFFF"), null, false, false, false, true, false, true, true, true);
+	public static L2AccessLevel _userAccessLevel = new L2AccessLevel(_userAccessLevelNum, "User", Integer.decode("0xFFFFFF"), Integer.decode("0xFFFFFF"), null, false, false, false, true, false, true, true, true);
 	/** FastMap of access levels defined in database<br> */
-	private Map<Integer, AccessLevel> _accessLevels = new FastMap<Integer, AccessLevel>();
+	private Map<Integer, L2AccessLevel> _accessLevels = new FastMap<Integer, L2AccessLevel>();
 
 	/**
 	 * Loads the access levels from database<br>
@@ -135,7 +136,7 @@ public class AccessLevels
 				takeAggro = rset.getBoolean("takeAggro");
 				gainExp = rset.getBoolean("gainExp");
 
-				_accessLevels.put(accessLevel, new AccessLevel(accessLevel, name, nameColor, titleColor, childs.equals("") ? null : childs, isGm, allowPeaceAttack, allowFixedRes, allowTransaction, allowAltG, giveDamage, takeAggro, gainExp));
+				_accessLevels.put(accessLevel, new L2AccessLevel(accessLevel, name, nameColor, titleColor, childs.equals("") ? null : childs, isGm, allowPeaceAttack, allowFixedRes, allowTransaction, allowAltG, giveDamage, takeAggro, gainExp));
 			}
 
 			rset.close();
@@ -176,9 +177,9 @@ public class AccessLevels
 	 *
 	 * @return AccessLevel: AccessLevel instance by char access level<br>
 	 */
-	public AccessLevel getAccessLevel(int accessLevelNum)
+	public L2AccessLevel getAccessLevel(int accessLevelNum)
 	{
-		AccessLevel accessLevel = null;
+		L2AccessLevel accessLevel = null;
 
 		synchronized (_accessLevels)
 		{
@@ -196,7 +197,7 @@ public class AccessLevels
 				return;
 			}
 
-			_accessLevels.put(accessLevel, new AccessLevel(accessLevel, "Banned", Integer.decode( "0x000000" ), Integer.decode( "0x000000" ), null, false, false, false, false, false, false, false, false));
+			_accessLevels.put(accessLevel, new L2AccessLevel(accessLevel, "Banned", Integer.decode( "0x000000" ), Integer.decode( "0x000000" ), null, false, false, false, false, false, false, false, false));
 		}
 	}
 }

+ 6 - 4
L2_GameServer/java/net/sf/l2j/gameserver/datatables/AdminCommandAccessRight.java

@@ -14,6 +14,8 @@
  */
 package net.sf.l2j.gameserver.datatables;
 
+import net.sf.l2j.gameserver.model.L2AccessLevel;
+
 /**
  * @author FBIagent<br>
  */
@@ -22,7 +24,7 @@ public class AdminCommandAccessRight
 	/** The admin command<br> */
 	private String _adminCommand = null;
 	/** The access levels which can use the admin command<br> */
-	private AccessLevel[] _accessLevels = null;
+	private L2AccessLevel[] _accessLevels = null;
 
 	/**
 	 * Initialized members
@@ -37,7 +39,7 @@ public class AdminCommandAccessRight
 		String[] accessLevelsSplit = accessLevels.split(",");
 		int numLevels = accessLevelsSplit.length;
 		
-		_accessLevels = new AccessLevel[numLevels];
+		_accessLevels = new L2AccessLevel[numLevels];
 		
 		for (int i = 0; i < numLevels; ++i)
 		{
@@ -69,11 +71,11 @@ public class AdminCommandAccessRight
 	 * 
 	 * @return boolean: true if characterAccessLevel is allowed to use the admin command which belongs to this access right, otherwise false<br>
 	 */
-	public boolean hasAccess(AccessLevel characterAccessLevel)
+	public boolean hasAccess(L2AccessLevel characterAccessLevel)
 	{
 		for (int i = 0; i < _accessLevels.length; ++i)
 		{
-			AccessLevel accessLevel = _accessLevels[i];
+			L2AccessLevel accessLevel = _accessLevels[i];
 			
 			if (accessLevel != null
 					&& (accessLevel.getLevel() == characterAccessLevel.getLevel() || characterAccessLevel.hasChildAccess(accessLevel)))

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/datatables/CharTemplateTable.java

@@ -52,7 +52,7 @@ public class CharTemplateTable
                                                 "Titan", "Grand Khauatari", "Dominator", "Doomcryer",
                                                 "Fortune Seeker", "Maestro",
                                                 "dummyEntry31", "dummyEntry32", "dummyEntry33", "dummyEntry34",
-                                                "Male Soldier", "Female Soldier", "Trooper", "Warder", "Berserker", "Male Soulbreaker", "Female Souldbreaker", "Arbalester", "Doombringer", "Male Soulhound", "Female Soulhound", "Trickster", "Inspector", "Judicator" 
+                                                "Male Soldier", "Female Soldier", "Trooper", "Warder", "Berserker", "Male Soulbreaker", "Female Soulbreaker", "Arbalester", "Doombringer", "Male Soulhound", "Female Soulhound", "Trickster", "Inspector", "Judicator" 
     };
 
 	private Map<Integer, L2PcTemplate> _templates;

+ 0 - 39
L2_GameServer/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminEditNpc.java

@@ -31,10 +31,8 @@ import net.sf.l2j.gameserver.datatables.NpcTable;
 import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
 import net.sf.l2j.gameserver.model.L2DropCategory;
 import net.sf.l2j.gameserver.model.L2DropData;
-import net.sf.l2j.gameserver.model.L2Object;
 import net.sf.l2j.gameserver.model.L2TradeList;
 import net.sf.l2j.gameserver.model.L2TradeList.L2TradeItem;
-import net.sf.l2j.gameserver.model.actor.instance.L2BoxInstance;
 import net.sf.l2j.gameserver.model.actor.instance.L2MerchantInstance;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
 import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
@@ -62,7 +60,6 @@ public class AdminEditNpc implements IAdminCommandHandler {
 		"admin_showShopList",
 		"admin_addShopItem",
 		"admin_delShopItem",
-		"admin_box_access",
 		"admin_editShopItem",
 		"admin_close_window"
 	};
@@ -250,42 +247,6 @@ public class AdminEditNpc implements IAdminCommandHandler {
 			else
 				activeChar.sendMessage("Usage: //del_drop <npc_id> <item_id> <category>");
 		}
-		else if(command.startsWith("admin_box_access"))
-		{
-			L2Object target = activeChar.getTarget();
-			String[] players = command.split(" ");
-			if (target instanceof L2BoxInstance)
-			{
-				L2BoxInstance box = (L2BoxInstance) target;
-				if (players.length > 1)
-				{
-					boolean access = true;
-					for (int i = 1; i < players.length; i++)
-					{
-						if (players[i].equals("no"))
-						{
-							access = false;
-							continue;
-						}
-						box.grantAccess(players[i],access);
-					}
-				}
-				else
-				{
-					try
-					{
-						String msg = "Access:";
-						for (Object p : box.getAccess())
-							msg += " "+(String)p;
-						activeChar.sendMessage(msg);
-					}
-					catch (Exception e)
-					{
-						_log.info("box_access: "+e);
-					}
-				}
-			}
-		}
 
 		return true;
 	}

+ 0 - 1
L2_GameServer/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminGeodata.java

@@ -38,7 +38,6 @@ public class AdminGeodata implements IAdminCommandHandler
 		"admin_geo_unload"
 		};
 
-	@SuppressWarnings("deprecation")
 	public boolean useAdminCommand(String command, L2PcInstance activeChar)
 	{
         if (Config.GEODATA < 1)

+ 3 - 3
L2_GameServer/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminZone.java

@@ -26,9 +26,9 @@ package net.sf.l2j.gameserver.handler.admincommandhandlers;
 
 import java.util.StringTokenizer;
 
-import net.sf.l2j.gameserver.GmListTable;
 import net.sf.l2j.gameserver.datatables.MapRegionTable;
 import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
+import net.sf.l2j.gameserver.instancemanager.ZoneManager;
 import net.sf.l2j.gameserver.model.L2Character;
 import net.sf.l2j.gameserver.model.Location;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
@@ -89,8 +89,8 @@ public class AdminZone implements IAdminCommandHandler
             activeChar.sendMessage("TeleToLocation (Town): x:" + loc.getX() + " y:" + loc.getY() + " z:" + loc.getZ());
         } else if (actualCommand.equalsIgnoreCase("admin_zone_reload"))
         {
-        	//TODO: ZONETODO ZoneManager.getInstance().reload();
-        	GmListTable.broadcastMessageToGMs("Zones can not be reloaded in this version.");
+        	ZoneManager.getInstance().reload();
+        	activeChar.sendMessage("Reloading zones...");
         }
         return true;
     }

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/handler/itemhandlers/ChristmasTree.java

@@ -66,7 +66,7 @@ public class ChristmasTree implements IItemHandler
             spawn.setLocx(target.getX());
             spawn.setLocy(target.getY());
             spawn.setLocz(target.getZ());
-            L2World.getInstance().storeObject(spawn.spawnOne());
+            L2World.getInstance().storeObject(spawn.spawnOne(false));
 
             activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false);
 

+ 15 - 3
L2_GameServer/java/net/sf/l2j/gameserver/handler/itemhandlers/Potions.java

@@ -84,7 +84,10 @@ public class Potions implements IItemHandler
 				733,
 				// Juices
 				10260, 10261, 10262, 10263, 10264, 10265,
-				10266, 10267, 10268, 10269, 10270};
+				10266, 10267, 10268, 10269, 10270,
+				// CT2 herbs
+				10655,10656,10657
+				};
 
 	public synchronized void useItem(L2PlayableInstance playable, L2ItemInstance item)
 	{
@@ -342,6 +345,15 @@ public class Potions implements IItemHandler
 				res = usePotion(activeChar, 2278, 3);// Superior Herb of Life
 				res = usePotion(activeChar, 2279, 3);// Superior Herb of Mana
 				break;
+			case 10655:
+				res = usePotion(activeChar, 2512, 1);
+				break;
+			case 10656:
+				res = usePotion(activeChar, 2514, 1);
+				break;
+			case 10657:
+				res = usePotion(activeChar, 2513, 1);
+				break;
 
 			// FISHERMAN POTIONS
 			case 8193: // Fisherman's Potion - Green
@@ -482,14 +494,14 @@ public class Potions implements IItemHandler
 
 	public boolean usePotion(L2PcInstance activeChar, int magicId, int level)
 	{
-		if (activeChar.isCastingNow() && magicId > 2277 && magicId < 2286)
+		if (activeChar.isCastingNow() && (magicId > 2277 && magicId < 2286 || magicId >= 2512 && magicId <= 2514))
 		{
 			_herbstask += 100;
 			ThreadPoolManager.getInstance().scheduleAi(new HerbTask(activeChar, magicId, level), _herbstask);
 		}
 		else
 		{
-			if (magicId > 2277 && magicId < 2286 && _herbstask >= 100) _herbstask -= 100;
+			if ((magicId > 2277 && magicId < 2286 || magicId >= 2512 && magicId <= 2514) && _herbstask >= 100) _herbstask -= 100;
 			L2Skill skill = SkillTable.getInstance().getInfo(magicId, level);
 			if (skill != null)
 			{

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/handler/itemhandlers/SevenSignsRecord.java

@@ -29,7 +29,7 @@ import net.sf.l2j.gameserver.network.serverpackets.SSQStatus;
 public class SevenSignsRecord implements IItemHandler {
 private static final int[] ITEM_IDS = {5707};
 
-	public void useItem(L2PlayableInstance playable, @SuppressWarnings("unused") L2ItemInstance item)
+	public void useItem(L2PlayableInstance playable, L2ItemInstance item)
 	{
 		L2PcInstance activeChar;
 

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/handler/itemhandlers/SummonItems.java

@@ -114,7 +114,7 @@ public class SummonItems implements IItemHandler
                 spawn.setLocx(activeChar.getX());
                 spawn.setLocy(activeChar.getY());
                 spawn.setLocz(activeChar.getZ());
-                L2World.getInstance().storeObject(spawn.spawnOne());
+                L2World.getInstance().storeObject(spawn.spawnOne(true));
                 activeChar.destroyItem("Summon", item.getObjectId(), 1, null, false);
                 activeChar.sendMessage("Created " + npcTemplate.name + " at x: " + spawn.getLocx() + " y: " + spawn.getLocy() + " z: " + spawn.getLocz());
             }

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/BeastFeed.java

@@ -34,7 +34,7 @@ public class BeastFeed implements ISkillHandler
     private static Logger _log = Logger.getLogger(BeastFeed.class.getName());
     private static final SkillType[] SKILL_IDS = {SkillType.BEAST_FEED};
 
-    public void useSkill(L2Character activeChar, L2Skill skill, @SuppressWarnings("unused") L2Object[] targets)
+    public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
     {
         if (!(activeChar instanceof L2PcInstance))
 			return;

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/CombatPointHeal.java

@@ -41,7 +41,7 @@ public class CombatPointHeal implements ISkillHandler
     /* (non-Javadoc)
      * @see net.sf.l2j.gameserver.handler.IItemHandler#useItem(net.sf.l2j.gameserver.model.L2PcInstance, net.sf.l2j.gameserver.model.L2ItemInstance)
      */
-    public void useSkill(@SuppressWarnings("unused") L2Character actChar, L2Skill skill, L2Object[] targets)
+    public void useSkill(L2Character actChar, L2Skill skill, L2Object[] targets)
     {
 //      L2Character activeChar = actChar;
     	//check for other effects

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/Craft.java

@@ -39,7 +39,7 @@ public class Craft implements ISkillHandler
 	/* (non-Javadoc)
 	 * @see net.sf.l2j.gameserver.handler.IItemHandler#useItem(net.sf.l2j.gameserver.model.L2PcInstance, net.sf.l2j.gameserver.model.L2ItemInstance)
 	 */
-	public void useSkill(L2Character activeChar, L2Skill skill, @SuppressWarnings("unused") L2Object[] targets)
+	public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
 	{
 		if (!(activeChar instanceof L2PcInstance)) return;
 

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/DeluxeKey.java

@@ -32,7 +32,7 @@ public class DeluxeKey implements ISkillHandler
     private static Logger _log = Logger.getLogger(BeastFeed.class.getName());
     private static final SkillType[] SKILL_IDS = {SkillType.DELUXE_KEY_UNLOCK};
 
-    public void useSkill(L2Character activeChar, L2Skill skill, @SuppressWarnings("unused") L2Object[] targets)
+    public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
     {
         if (!(activeChar instanceof L2PcInstance))
 			return;

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/DrainSoul.java

@@ -34,7 +34,7 @@ public class DrainSoul implements ISkillHandler
     private static Logger _log = Logger.getLogger(DrainSoul.class.getName());
     private static final SkillType[] SKILL_IDS = {SkillType.DRAIN_SOUL};
 
-    public void useSkill(L2Character activeChar, L2Skill skill, @SuppressWarnings("unused") L2Object[] targets)
+    public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
     {
         if (!(activeChar instanceof L2PcInstance))
 			return;

+ 2 - 4
L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/Fishing.java

@@ -42,9 +42,7 @@ public class Fishing implements ISkillHandler
 	private static final SkillType[] SKILL_IDS = { SkillType.FISHING };
 
 
-	public void useSkill(L2Character activeChar, @SuppressWarnings("unused")
-	L2Skill skill, @SuppressWarnings("unused")
-	L2Object[] targets)
+	public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
 	{
 		if (!(activeChar instanceof L2PcInstance))
 			return;
@@ -176,4 +174,4 @@ public class Fishing implements ISkillHandler
 	{
 		return SKILL_IDS;
 	}
-}
+}

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/FishingSkill.java

@@ -32,7 +32,7 @@ public class FishingSkill implements ISkillHandler
     //private static Logger _log = Logger.getLogger(SiegeFlag.class.getName());
 	private static final SkillType[] SKILL_IDS = {SkillType.PUMPING, SkillType.REELING};
 
-    public void useSkill(L2Character activeChar, @SuppressWarnings("unused") L2Skill skill, @SuppressWarnings("unused") L2Object[] targets)
+    public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
     {
         if (!(activeChar instanceof L2PcInstance)) return;
 

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/GiveSp.java

@@ -29,7 +29,7 @@ public class GiveSp implements ISkillHandler
 {
 	private static final SkillType[] SKILL_IDS = {SkillType.GIVE_SP};
 	
-    public void useSkill(@SuppressWarnings("unused") L2Character activeChar, L2Skill skill, L2Object[] targets)
+    public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
     {
         for (L2Object obj : targets)
         {

+ 2 - 1
L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/Harvest.java

@@ -43,7 +43,8 @@ public class Harvest implements ISkillHandler
     private L2PcInstance _activeChar;
     private L2MonsterInstance _target;
 
-    public void useSkill(L2Character activeChar, L2Skill skill, @SuppressWarnings("unused") L2Object[] targets) {
+    public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
+    {
         if (!(activeChar instanceof L2PcInstance))
             return;
 

+ 7 - 1
L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/Heal.java

@@ -144,8 +144,14 @@ public class Heal implements ISkillHandler
 
             if (target instanceof L2DoorInstance || target instanceof L2SiegeFlagInstance)
             	hp = 0;
+
+            //from CT2 u will receive exact HP, u can't go over it, if u have full HP and u get HP buff, u will receive 0HP restored message
+            if (target.getCurrentHp()+hp >= target.getMaxHp())
+            	hp = (target.getMaxHp()-(target.getCurrentHp()+hp));
+            if (hp <0)
+            	hp = 0; 
 			target.setCurrentHp(hp + target.getCurrentHp());
-			target.setLastHealAmount((int)hp);
+			target.setLastHealAmount((int) hp);
 			StatusUpdate su = new StatusUpdate(target.getObjectId());
 			su.addAttribute(StatusUpdate.CUR_HP, (int)target.getCurrentHp());
 			target.sendPacket(su);

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/ManaHeal.java

@@ -42,7 +42,7 @@ public class ManaHeal implements ISkillHandler
 	/* (non-Javadoc)
 	 * @see net.sf.l2j.gameserver.handler.IItemHandler#useItem(net.sf.l2j.gameserver.model.L2PcInstance, net.sf.l2j.gameserver.model.L2ItemInstance)
 	 */
-	public void useSkill(@SuppressWarnings("unused") L2Character actChar, L2Skill skill, L2Object[] targets)
+	public void useSkill(L2Character actChar, L2Skill skill, L2Object[] targets)
 	{
         L2Character target = null;
 

+ 85 - 85
L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/Manadam.java

@@ -35,107 +35,107 @@ import net.sf.l2j.gameserver.skills.Formulas;
  */
 public class Manadam implements ISkillHandler
 {
-private static final SkillType[] SKILL_IDS = { SkillType.MANADAM };
-
-public void useSkill(@SuppressWarnings("unused")
-L2Character activeChar, L2Skill skill, L2Object[] targets)
-{
-	L2Character target = null;
-
-	if (activeChar.isAlikeDead())
-		return;
-
-	boolean ss = false;
-	boolean bss = false;
-
-	L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance();
-
-	if (weaponInst != null)
+	private static final SkillType[] SKILL_IDS = { SkillType.MANADAM };
+	
+	public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
 	{
-		if (weaponInst.getChargedSpiritshot() == L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT)
+		L2Character target = null;
+		
+		if (activeChar.isAlikeDead())
+			return;
+		
+		boolean ss = false;
+		boolean bss = false;
+		
+		L2ItemInstance weaponInst = activeChar.getActiveWeaponInstance();
+		
+		if (weaponInst != null)
 		{
-			bss = true;
-			weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_NONE);
-		} else if (weaponInst.getChargedSpiritshot() == L2ItemInstance.CHARGED_SPIRITSHOT)
-		{
-			ss = true;
-			weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_NONE);
-		}
-	}
-	// If there is no weapon equipped, check for an active summon.
-	else if (activeChar instanceof L2Summon)
-	{
-		L2Summon activeSummon = (L2Summon) activeChar;
-			
-		if (activeSummon.getChargedSpiritShot() == L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT)
-		{
-			bss = true;
-			activeSummon.setChargedSpiritShot(L2ItemInstance.CHARGED_NONE);
+			if (weaponInst.getChargedSpiritshot() == L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT)
+			{
+				bss = true;
+				weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_NONE);
+			}
+			else if (weaponInst.getChargedSpiritshot() == L2ItemInstance.CHARGED_SPIRITSHOT)
+			{
+				ss = true;
+				weaponInst.setChargedSpiritshot(L2ItemInstance.CHARGED_NONE);
+			}
 		}
-		else if (activeSummon.getChargedSpiritShot() == L2ItemInstance.CHARGED_SPIRITSHOT)
+		// If there is no weapon equipped, check for an active summon.
+		else if (activeChar instanceof L2Summon)
 		{
-			ss = true;
-			activeSummon.setChargedSpiritShot(L2ItemInstance.CHARGED_NONE);
+			L2Summon activeSummon = (L2Summon) activeChar;
+			
+			if (activeSummon.getChargedSpiritShot() == L2ItemInstance.CHARGED_BLESSED_SPIRITSHOT)
+			{
+				bss = true;
+				activeSummon.setChargedSpiritShot(L2ItemInstance.CHARGED_NONE);
+			}
+			else if (activeSummon.getChargedSpiritShot() == L2ItemInstance.CHARGED_SPIRITSHOT)
+			{
+				ss = true;
+				activeSummon.setChargedSpiritShot(L2ItemInstance.CHARGED_NONE);
+			}
 		}
-	}
-	else if (activeChar instanceof L2NpcInstance)
-	{
-		bss = ((L2NpcInstance)activeChar).isUsingShot(false);
-		ss = ((L2NpcInstance)activeChar).isUsingShot(true);
-	}
-	for (int index = 0; index < targets.length; index++)
-	{
-		target = (L2Character) targets[index];
-
-		if (target.reflectSkill(skill))
-			target = activeChar;
-
-		boolean acted = Formulas.getInstance().calcMagicAffected(activeChar, target, skill);
-		if (target.isInvul() || !acted)
+		else if (activeChar instanceof L2NpcInstance)
 		{
-			activeChar.sendPacket(new SystemMessage(SystemMessageId.MISSED_TARGET));
+			bss = ((L2NpcInstance) activeChar).isUsingShot(false);
+			ss = ((L2NpcInstance) activeChar).isUsingShot(true);
 		}
-		else
+		for (int index = 0; index < targets.length; index++)
 		{
-			double damage = Formulas.getInstance().calcManaDam(activeChar, target, skill, ss, bss);
-
-			double mp = (damage > target.getCurrentMp() ? target.getCurrentMp() : damage);
-			target.reduceCurrentMp(mp);
-			if (damage > 0)
+			target = (L2Character) targets[index];
+			
+			if (target.reflectSkill(skill))
+				target = activeChar;
+			
+			boolean acted = Formulas.getInstance().calcMagicAffected(activeChar, target, skill);
+			if (target.isInvul() || !acted)
+			{
+				activeChar.sendPacket(new SystemMessage(SystemMessageId.MISSED_TARGET));
+			}
+			else
 			{
-				if (target.isSleeping())
+				double damage = Formulas.getInstance().calcManaDam(activeChar, target, skill, ss, bss);
+				
+				double mp = (damage > target.getCurrentMp() ? target.getCurrentMp() : damage);
+				target.reduceCurrentMp(mp);
+				if (damage > 0)
 				{
-					target.stopSleeping(null);
+					if (target.isSleeping())
+					{
+						target.stopSleeping(null);
+					}
+					else if (target.isImmobileUntilAttacked())
+					{
+						target.stopImmobileUntilAttacked(null);
+					}
 				}
-				else if (target.isImmobileUntilAttacked())
+				
+				if (target instanceof L2PcInstance)
 				{
-					target.stopImmobileUntilAttacked(null);
+					StatusUpdate sump = new StatusUpdate(target.getObjectId());
+					sump.addAttribute(StatusUpdate.CUR_MP, (int) target.getCurrentMp());
+					// [L2J_JP EDIT START - TSL]
+					target.sendPacket(sump);
+					
+					SystemMessage sm = new SystemMessage(SystemMessageId.S2_MP_HAS_BEEN_DRAINED_BY_S1);
+					sm.addCharName(activeChar);
+					sm.addNumber((int) mp);
+					target.sendPacket(sm);
 				}
+				
+				if (activeChar instanceof L2PcInstance)
+				{
+					SystemMessage sm2 = new SystemMessage(SystemMessageId.YOUR_OPPONENTS_MP_WAS_REDUCED_BY_S1);
+					sm2.addNumber((int) mp);
+					activeChar.sendPacket(sm2);
+				}
+				// [L2J_JP EDIT END - TSL]
 			}
-
-			if (target instanceof L2PcInstance)
-			{
-				StatusUpdate sump = new StatusUpdate(target.getObjectId());
-				sump.addAttribute(StatusUpdate.CUR_MP, (int) target.getCurrentMp());
-				// [L2J_JP EDIT START - TSL]
-				target.sendPacket(sump);
-
-				SystemMessage sm = new SystemMessage(SystemMessageId.S2_MP_HAS_BEEN_DRAINED_BY_S1);
-				sm.addCharName(activeChar);
-				sm.addNumber((int) mp);
-				target.sendPacket(sm);
-			}
-
-			if (activeChar instanceof L2PcInstance)
-			{
-				SystemMessage sm2 = new SystemMessage(SystemMessageId.YOUR_OPPONENTS_MP_WAS_REDUCED_BY_S1);
-				sm2.addNumber((int) mp);
-				activeChar.sendPacket(sm2);
-			}
-			// [L2J_JP EDIT END - TSL]
 		}
 	}
-}
 
 public SkillType[] getSkillIds()
 {

+ 21 - 1
L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/Mdam.java

@@ -144,7 +144,27 @@ public class Mdam implements ISkillHandler
 
             int damage = (int) Formulas.getInstance().calcMagicDam(activeChar, target, skill, ss, bss,
                                                                    mcrit);
-
+            if (skill.getMaxSoulConsumeCount() > 0 && activeChar instanceof L2PcInstance && ((L2PcInstance) activeChar).getSouls() > 0)
+            {
+            	switch (((L2PcInstance) activeChar).getSouls())
+            	{
+            		case 1:
+            			damage *= 1.10;
+            			break;
+            		case 2:
+            			damage *= 1.12;
+            			break;
+            		case 3:
+            			damage *= 1.15;
+            			break;
+            		case 4:
+            			damage *= 1.18;
+            			break;
+            		default:
+            			damage *= 1.20;
+            			break;
+            	}
+            }
             if (damage > 5000 && activeChar instanceof L2PcInstance)
             {
                 String name = "";

+ 21 - 0
L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/Pdam.java

@@ -92,6 +92,27 @@ public class Pdam implements ISkillHandler
 
             if (!crit && (skill.getCondition() & L2Skill.COND_CRIT) != 0) damage = 0;
             else damage = (int) f.calcPhysDam(activeChar, target, skill, shld, false, dual, soul);
+            if (skill.getMaxSoulConsumeCount() > 0 && activeChar instanceof L2PcInstance && ((L2PcInstance) activeChar).getSouls() > 0)
+            {
+            	switch (((L2PcInstance) activeChar).getSouls())
+            	{
+            		case 1:
+            			damage *= 1.10;
+            			break;
+            		case 2:
+            			damage *= 1.12;
+            			break;
+            		case 3:
+            			damage *= 1.15;
+            			break;
+            		case 4:
+            			damage *= 1.18;
+            			break;
+            		default:
+            			damage *= 1.20;
+            			break;
+            	}
+            }
             if (crit) damage *= 2; // PDAM Critical damage always 2x and not affected by buffs
 
             if (damage > 5000 && activeChar instanceof L2PcInstance)

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/Recall.java

@@ -32,7 +32,7 @@ public class Recall implements ISkillHandler
 	//private static Logger _log = Logger.getLogger(Recall.class.getName());
 	private static final SkillType[] SKILL_IDS = {SkillType.RECALL};
 
- 	public void useSkill(@SuppressWarnings("unused") L2Character activeChar, @SuppressWarnings("unused") L2Skill skill, L2Object[] targets)
+ 	public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
 	{
         if (activeChar instanceof L2PcInstance)
         {

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/SiegeFlag.java

@@ -41,7 +41,7 @@ public class SiegeFlag implements ISkillHandler
     //private static Logger _log = Logger.getLogger(SiegeFlag.class.getName());
 	private static final SkillType[] SKILL_IDS = {SkillType.SIEGEFLAG};
 
-    public void useSkill(L2Character activeChar, @SuppressWarnings("unused") L2Skill skill, @SuppressWarnings("unused") L2Object[] targets)
+    public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
     {
         if (!(activeChar instanceof L2PcInstance)) return;
 

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/Soul.java

@@ -33,7 +33,7 @@ public class Soul implements ISkillHandler
 {
     private static final SkillType[] SKILL_IDS = { SkillType.CHARGESOUL };
     
-    public void useSkill(L2Character activeChar, L2Skill skill, @SuppressWarnings("unused") L2Object[] targets)
+    public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
     {
         if (!(activeChar instanceof L2PcInstance) || activeChar.isAlikeDead())
             return;

+ 2 - 1
L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/Sow.java

@@ -44,7 +44,8 @@ public class Sow implements ISkillHandler {
     private L2MonsterInstance _target;
     private int _seedId;
 
-    public void useSkill(L2Character activeChar, L2Skill skill, @SuppressWarnings("unused") L2Object[] targets) {
+    public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
+    {
         if (!(activeChar instanceof L2PcInstance))
             return;
 

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/StrSiegeAssault.java

@@ -38,7 +38,7 @@ public class StrSiegeAssault implements ISkillHandler
     //private static Logger _log = Logger.getLogger(StrSiegeAssault.class.getName());
 	private static final SkillType[] SKILL_IDS = {SkillType.STRSIEGEASSAULT};
 
-    public void useSkill(L2Character activeChar, @SuppressWarnings("unused") L2Skill skill, @SuppressWarnings("unused") L2Object[] targets)
+    public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
     {
 
     	if (!(activeChar instanceof L2PcInstance)) return;

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/SummonFriend.java

@@ -39,7 +39,7 @@ public class SummonFriend implements ISkillHandler
 	//private static Logger _log = Logger.getLogger(SummonFriend.class.getName());
 	private static final SkillType[] SKILL_IDS = {SkillType.SUMMON_FRIEND};
 
- 	public void useSkill(@SuppressWarnings("unused") L2Character activeChar, @SuppressWarnings("unused") L2Skill skill, L2Object[] targets)
+ 	public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
 	{
  		if (!(activeChar instanceof L2PcInstance)) return; // currently not implemented for others
  		L2PcInstance activePlayer = (L2PcInstance)activeChar;

+ 1 - 2
L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/SummonTreasureKey.java

@@ -33,8 +33,7 @@ public class SummonTreasureKey implements ISkillHandler
     static Logger _log = Logger.getLogger(SummonTreasureKey.class.getName());
     private static final SkillType[] SKILL_IDS = {SkillType.SUMMON_TREASURE_KEY};
 
-    public void useSkill(L2Character activeChar, @SuppressWarnings("unused")
-    		L2Skill skill, @SuppressWarnings("unused")L2Object[] targets)
+    public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
     {
         if (!(activeChar instanceof L2PcInstance)) return;
 

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/Sweep.java

@@ -39,7 +39,7 @@ public class Sweep implements ISkillHandler
     //private static Logger _log = Logger.getLogger(Sweep.class.getName());
 	private static final SkillType[] SKILL_IDS = {SkillType.SWEEP};
 
-    public void useSkill(L2Character activeChar, @SuppressWarnings("unused") L2Skill skill, L2Object[] targets)
+    public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
     {
         if (!(activeChar instanceof L2PcInstance))
         {

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/TakeCastle.java

@@ -36,7 +36,7 @@ public class TakeCastle implements ISkillHandler
     //private static Logger _log = Logger.getLogger(TakeCastle.class.getName());
 	private static final SkillType[] SKILL_IDS = {SkillType.TAKECASTLE};
 
-    public void useSkill(L2Character activeChar, @SuppressWarnings("unused") L2Skill skill, @SuppressWarnings("unused") L2Object[] targets)
+    public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
     {
         if (!(activeChar instanceof L2PcInstance)) return;
 

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/TakeFort.java

@@ -35,7 +35,7 @@ public class TakeFort implements ISkillHandler
     //private static Logger _log = Logger.getLogger(TakeFort.class.getName());
     private static final SkillType[] SKILL_IDS = {SkillType.TAKEFORT};
 
-    public void useSkill(L2Character activeChar, @SuppressWarnings("unused") L2Skill skill, @SuppressWarnings("unused") L2Object[] targets)
+    public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
     {
         if (!(activeChar instanceof L2PcInstance)) return;
 

+ 1 - 2
L2_GameServer/java/net/sf/l2j/gameserver/handler/skillhandlers/Unlock.java

@@ -34,8 +34,7 @@ public class Unlock implements ISkillHandler
 	//private static Logger _log = Logger.getLogger(Unlock.class.getName());
 	private static final SkillType[] SKILL_IDS = {SkillType.UNLOCK};
 
-	public void useSkill(L2Character activeChar, L2Skill skill, @SuppressWarnings("unused")
-	L2Object[] targets)
+	public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets)
 	{
 		L2Object[] targetList = skill.getTargetList(activeChar);
 

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/handler/usercommandhandlers/Escape.java

@@ -39,7 +39,7 @@ public class Escape implements IUserCommandHandler
     /* (non-Javadoc)
      * @see net.sf.l2j.gameserver.handler.IUserCommandHandler#useUserCommand(int, net.sf.l2j.gameserver.model.L2PcInstance)
      */
-    public boolean useUserCommand(@SuppressWarnings("unused") int id, L2PcInstance activeChar)
+    public boolean useUserCommand(int id, L2PcInstance activeChar)
     {
     	// Thanks nbd
     	if (!TvTEvent.onEscapeUse(activeChar.getObjectId()))

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/handler/usercommandhandlers/Loc.java

@@ -31,7 +31,7 @@ public class Loc implements IUserCommandHandler
     /* (non-Javadoc)
      * @see net.sf.l2j.gameserver.handler.IUserCommandHandler#useUserCommand(int, net.sf.l2j.gameserver.model.L2PcInstance)
      */
-    public boolean useUserCommand(@SuppressWarnings("unused") int id, L2PcInstance activeChar)
+    public boolean useUserCommand(int id, L2PcInstance activeChar)
     {
     	int _nearestTown=MapRegionTable.getInstance().getClosestTownNumber(activeChar);
     	SystemMessageId msg;

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Wedding.java

@@ -448,4 +448,4 @@ public class Wedding implements IVoicedCommandHandler
         return _voicedCommands;
     }
 }
-        
+        

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/idfactory/CompactionIDFactory.java

@@ -136,7 +136,7 @@ public class CompactionIDFactory extends IdFactory
     }
 
     @Override
-	public synchronized void releaseId(@SuppressWarnings("unused") int id)
+	public synchronized void releaseId(int id)
     {
     	//dont release ids until we are sure it isnt messing up
        /* if (_freeSize >= _freeOIDs.length)

+ 1861 - 0
L2_GameServer/java/net/sf/l2j/gameserver/instancemanager/FourSepulchersManager.java

@@ -0,0 +1,1861 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package net.sf.l2j.gameserver.instancemanager;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ScheduledFuture;
+
+import javolution.util.FastList;
+import javolution.util.FastMap;
+import net.sf.l2j.Config;
+import net.sf.l2j.L2DatabaseFactory;
+import net.sf.l2j.gameserver.ThreadPoolManager;
+import net.sf.l2j.gameserver.datatables.DoorTable;
+import net.sf.l2j.gameserver.datatables.NpcTable;
+import net.sf.l2j.gameserver.datatables.SpawnTable;
+import net.sf.l2j.gameserver.model.L2ItemInstance;
+import net.sf.l2j.gameserver.model.L2Spawn;
+import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.model.actor.instance.L2SepulcherMonsterInstance;
+import net.sf.l2j.gameserver.model.actor.instance.L2SepulcherNpcInstance;
+import net.sf.l2j.gameserver.model.quest.QuestState;
+import net.sf.l2j.gameserver.network.SystemMessageId;
+import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
+import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
+import net.sf.l2j.gameserver.templates.L2NpcTemplate;
+import net.sf.l2j.gameserver.util.Util;
+import net.sf.l2j.util.Rnd;
+
+/**
+ * This class ...
+ * 
+ * @version $Revision: $ $Date: $
+ * @author sandman
+ * 
+ * 
+ * TODO: Gatekeepers shouting some text when doors get opened..so far unknown
+ *       in leaked C4 is this text: 1000502	[brushes hinders competitor's monster.] which is really ugly translation
+ * 
+ * TODO: Victim should attack one npc, when u save this NPC debuff zones will not be activated
+ *       and NPC will polymorph into some kind of Tammed Beast xD and shout: 1000503	[many thanks rescue.] 
+ *       which is again really ugly translation.
+ *       When Victim kill this NPC, debuff zones will get activated
+ *       with current core its impossible to make attack npc * npc i will try to search where is this prevented
+ *       but still is unknown which npc u need to save to survive in next room without debuffs
+ * 
+ */
+public class FourSepulchersManager extends GrandBossManager
+{
+	private static FourSepulchersManager _instance;
+	
+	private static final String QUEST_ID = "620_FourGoblets";
+
+	private static final int ENTRANCE_PASS = 7075;
+	private static final int USED_PASS = 7261;
+	private static final int CHAPEL_KEY = 7260;
+	private static final int ANTIQUE_BROOCH = 7262;
+
+	protected boolean _firstTimeRun;
+	protected boolean _inEntryTime = false;
+	protected boolean _inWarmUpTime = false;
+	protected boolean _inAttackTime = false;
+	protected boolean _inCoolDownTime = false;
+
+	protected ScheduledFuture<?> _changeCoolDownTimeTask = null;
+	protected ScheduledFuture<?> _changeEntryTimeTask = null;
+	protected ScheduledFuture<?> _changeWarmUpTimeTask = null;
+	protected ScheduledFuture<?> _changeAttackTimeTask = null;
+	protected ScheduledFuture<?> _onPartyAnnihilatedTask = null;
+	
+	private int[][] _startHallSpawn = { { 181632, -85587, -7218 },
+	        { 179963, -88978, -7218 }, { 173217, -86132, -7218 },
+	        { 175608, -82296, -7218 } };
+	
+	private int[][][] _shadowSpawnLoc = {
+	        { { 25339, 191231, -85574, -7216, 33380 },
+	                { 25349, 189534, -88969, -7216, 32768 },
+	                { 25346, 173195, -76560, -7215, 49277 },
+	                { 25342, 175591, -72744, -7215, 49317 } },
+	        { { 25342, 191231, -85574, -7216, 33380 },
+	                { 25339, 189534, -88969, -7216, 32768 },
+	                { 25349, 173195, -76560, -7215, 49277 },
+	                { 25346, 175591, -72744, -7215, 49317 } },
+	        { { 25346, 191231, -85574, -7216, 33380 },
+	                { 25342, 189534, -88969, -7216, 32768 },
+	                { 25339, 173195, -76560, -7215, 49277 },
+	                { 25349, 175591, -72744, -7215, 49317 } },
+	        { { 25349, 191231, -85574, -7216, 33380 },
+	                { 25346, 189534, -88969, -7216, 32768 },
+	                { 25342, 173195, -76560, -7215, 49277 },
+	                { 25339, 175591, -72744, -7215, 49317 } }, };
+
+	protected FastMap<Integer, Boolean> _archonSpawned = new FastMap<Integer, Boolean>();
+	protected FastMap<Integer, Boolean> _hallInUse = new FastMap<Integer, Boolean>();
+	protected FastMap<Integer, int[]> _startHallSpawns = new FastMap<Integer, int[]>();
+	protected FastMap<Integer, Integer> _hallGateKeepers = new FastMap<Integer, Integer>();
+	protected FastMap<Integer, Integer> _keyBoxNpc = new FastMap<Integer, Integer>();
+	protected FastMap<Integer, Integer> _victim = new FastMap<Integer, Integer>();
+	protected FastMap<Integer, L2PcInstance> _challengers = new FastMap<Integer, L2PcInstance>();
+	protected FastMap<Integer, L2Spawn> _executionerSpawns = new FastMap<Integer, L2Spawn>();
+	protected FastMap<Integer, L2Spawn> _keyBoxSpawns = new FastMap<Integer, L2Spawn>();
+	protected FastMap<Integer, L2Spawn> _mysteriousBoxSpawns = new FastMap<Integer, L2Spawn>();
+	protected FastMap<Integer, L2Spawn> _shadowSpawns = new FastMap<Integer, L2Spawn>();
+	protected FastMap<Integer, FastList<L2Spawn>> _dukeFinalMobs = new FastMap<Integer, FastList<L2Spawn>>();
+	protected FastMap<Integer, FastList<L2SepulcherMonsterInstance>> _dukeMobs = new FastMap<Integer, FastList<L2SepulcherMonsterInstance>>();
+	protected FastMap<Integer, FastList<L2Spawn>> _emperorsGraveNpcs = new FastMap<Integer, FastList<L2Spawn>>();
+	protected FastMap<Integer, FastList<L2Spawn>> _magicalMonsters = new FastMap<Integer, FastList<L2Spawn>>();
+	protected FastMap<Integer, FastList<L2Spawn>> _physicalMonsters = new FastMap<Integer, FastList<L2Spawn>>();
+	protected FastMap<Integer, FastList<L2SepulcherMonsterInstance>> _viscountMobs = new FastMap<Integer, FastList<L2SepulcherMonsterInstance>>();
+
+	protected FastList<L2Spawn> _physicalSpawns;
+	protected FastList<L2Spawn> _magicalSpawns;
+	protected FastList<L2Spawn> _managers;
+	protected FastList<L2Spawn> _dukeFinalSpawns;
+	protected FastList<L2Spawn> _emperorsGraveSpawns;
+	protected FastList<L2NpcInstance> _allMobs = new FastList<L2NpcInstance>();
+
+	protected long _attackTimeEnd = 0;
+	protected long _coolDownTimeEnd = 0;
+	protected long _entryTimeEnd = 0;
+	protected long _warmUpTimeEnd = 0;
+
+	protected byte _newCycleMin = 55;
+
+	public static final FourSepulchersManager getInstance()
+	{
+		if (_instance == null)
+			_instance = new FourSepulchersManager();
+		return _instance;
+	}
+	
+	
+	public void init()
+	{
+		if (_changeCoolDownTimeTask != null)
+			_changeCoolDownTimeTask.cancel(true);
+		if (_changeEntryTimeTask != null)
+			_changeEntryTimeTask.cancel(true);
+		if (_changeWarmUpTimeTask != null)
+			_changeWarmUpTimeTask.cancel(true);
+		if (_changeAttackTimeTask != null)
+			_changeAttackTimeTask.cancel(true);
+		
+		_changeCoolDownTimeTask = null;
+		_changeEntryTimeTask = null;
+		_changeWarmUpTimeTask = null;
+		_changeAttackTimeTask = null;
+		
+		_inEntryTime = false;
+		_inWarmUpTime = false;
+		_inAttackTime = false;
+		_inCoolDownTime = false;
+		
+		_firstTimeRun = true;
+		initFixedInfo();
+		loadMysteriousBox();
+		initKeyBoxSpawns();
+		loadPhysicalMonsters();
+		loadMagicalMonsters();
+		initLocationShadowSpawns();
+		initExecutionerSpawns();
+		loadDukeMonsters();
+		loadEmperorsGraveMonsters();
+		spawnManagers();
+		timeSelector();
+	}
+	
+	
+	
+	// phase select on server launch
+	protected void timeSelector()
+	{
+		timeCalculator();
+		long currentTime = Calendar.getInstance().getTimeInMillis();
+		// if current time >= time of entry beginning and if current time < time
+		// of entry beginning + time of entry end
+		if (currentTime >= _coolDownTimeEnd && currentTime < _entryTimeEnd) // entry
+																			// time
+																			// check
+		{
+			clean();
+			_changeEntryTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeEntryTime(), 0);
+			_log.info("FourSepulchersManager: Beginning in Entry time");
+		}
+		else if (currentTime >= _entryTimeEnd && currentTime < _warmUpTimeEnd) // warmup
+																				// time
+																				// check
+		{
+			clean();
+			_changeWarmUpTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeWarmUpTime(), 0);
+			_log.info("FourSepulchersManager: Beginning in WarmUp time");
+		}
+		else if (currentTime >= _warmUpTimeEnd && currentTime < _attackTimeEnd) // attack
+																				// time
+																				// check
+		{
+			clean();
+			_changeAttackTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeAttackTime(), 0);
+			_log.info("FourSepulchersManager: Beginning in Attack time");
+		}
+		else
+		// else cooldown time and without cleanup because it's already
+		// implemented
+		{
+			_changeCoolDownTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeCoolDownTime(), 0);
+			_log.info("FourSepulchersManager: Beginning in Cooldown time");
+		}
+	}
+	
+	
+	
+	// phase end times calculator
+	protected void timeCalculator()
+	{
+		Calendar tmp = Calendar.getInstance();
+		if (tmp.get(Calendar.MINUTE) < _newCycleMin)
+			tmp.set(Calendar.HOUR, Calendar.getInstance().get(Calendar.HOUR) - 1);
+		tmp.set(Calendar.MINUTE, _newCycleMin);
+		_coolDownTimeEnd = tmp.getTimeInMillis();
+		_entryTimeEnd = _coolDownTimeEnd + Config.FS_TIME_ENTRY * 60000;
+		_warmUpTimeEnd = _entryTimeEnd + Config.FS_TIME_WARMUP * 60000;
+		_attackTimeEnd = _warmUpTimeEnd + Config.FS_TIME_ATTACK * 60000;
+	}
+	
+	
+	public void clean()
+	{
+		for (int i=31921; i < 31925; i++)
+		{
+			int[] Location = _startHallSpawns.get(i);
+			GrandBossManager.getInstance().getZone(Location[0],Location[1],Location[2]).oustAllPlayers();
+		}
+		
+		deleteAllMobs();
+		
+		closeAllDoors();
+		
+		_hallInUse.clear();
+		_hallInUse.put(31921, false);
+		_hallInUse.put(31922, false);
+		_hallInUse.put(31923, false);
+		_hallInUse.put(31924, false);
+		
+		if (_archonSpawned.size() != 0)
+		{
+			Set<Integer> npcIdSet = _archonSpawned.keySet();
+			for (int npcId : npcIdSet)
+			{
+				_archonSpawned.put(npcId, false);
+			}
+		}
+	}
+	
+	
+	protected void spawnManagers()
+	{
+		_managers = new FastList<L2Spawn>();
+		// L2Spawn spawnDat;
+		
+		int i = 31921;
+		for (L2Spawn spawnDat; i <= 31924; i++)
+		{
+			if (i < 31921 || i > 31924)
+				continue;
+			L2NpcTemplate template1 = NpcTable.getInstance().getTemplate(i);
+			if (template1 == null)
+				continue;
+			try
+            {
+	            spawnDat = new L2Spawn(template1);
+
+	            spawnDat.setAmount(1);
+	            spawnDat.setRespawnDelay(60);
+	            switch (i)
+	            {
+	            	case 31921: // conquerors
+	            		spawnDat.setLocx(181061);
+	            		spawnDat.setLocy(-85595);
+	            		spawnDat.setLocz(-7200);
+	            		spawnDat.setHeading(-32584);
+	            		break;
+	            	case 31922: // emperors
+	            		spawnDat.setLocx(179292);
+	            		spawnDat.setLocy(-88981);
+	            		spawnDat.setLocz(-7200);
+	            		spawnDat.setHeading(-33272);
+	            		break;
+	            	case 31923: // sages
+	            		spawnDat.setLocx(173202);
+	            		spawnDat.setLocy(-87004);
+	            		spawnDat.setLocz(-7200);
+	            		spawnDat.setHeading(-16248);
+	            		break;
+	            	case 31924: // judges
+	            		spawnDat.setLocx(175606);
+	            		spawnDat.setLocy(-82853);
+	            		spawnDat.setLocz(-7200);
+	            		spawnDat.setHeading(-16248);
+	            		break;
+	            }
+	            _managers.add(spawnDat);
+	            SpawnTable.getInstance().addNewSpawn(spawnDat, false);
+	            spawnDat.doSpawn();
+	            spawnDat.startRespawn();
+	            _log.info("FourSepulchersManager: spawned "
+	            		+ spawnDat.getTemplate().getName());
+            }
+            catch (SecurityException e)
+            {
+	            e.printStackTrace();
+            }
+            catch (ClassNotFoundException e)
+            {
+	            e.printStackTrace();
+            }
+            catch (NoSuchMethodException e)
+            {
+	            e.printStackTrace();
+            }
+		}
+	}
+	
+	
+	protected void initFixedInfo()
+	{
+		_startHallSpawns.put(31921, _startHallSpawn[0]);
+		_startHallSpawns.put(31922, _startHallSpawn[1]);
+		_startHallSpawns.put(31923, _startHallSpawn[2]);
+		_startHallSpawns.put(31924, _startHallSpawn[3]);
+		
+		_hallInUse.put(31921, false);
+		_hallInUse.put(31922, false);
+		_hallInUse.put(31923, false);
+		_hallInUse.put(31924, false);
+		
+		_hallGateKeepers.put(31925, 25150012);
+		_hallGateKeepers.put(31926, 25150013);
+		_hallGateKeepers.put(31927, 25150014);
+		_hallGateKeepers.put(31928, 25150015);
+		_hallGateKeepers.put(31929, 25150016);
+		_hallGateKeepers.put(31930, 25150002);
+		_hallGateKeepers.put(31931, 25150003);
+		_hallGateKeepers.put(31932, 25150004);
+		_hallGateKeepers.put(31933, 25150005);
+		_hallGateKeepers.put(31934, 25150006);
+		_hallGateKeepers.put(31935, 25150032);
+		_hallGateKeepers.put(31936, 25150033);
+		_hallGateKeepers.put(31937, 25150034);
+		_hallGateKeepers.put(31938, 25150035);
+		_hallGateKeepers.put(31939, 25150036);
+		_hallGateKeepers.put(31940, 25150022);
+		_hallGateKeepers.put(31941, 25150023);
+		_hallGateKeepers.put(31942, 25150024);
+		_hallGateKeepers.put(31943, 25150025);
+		_hallGateKeepers.put(31944, 25150026);
+		
+		_keyBoxNpc.put(18120, 31455);
+		_keyBoxNpc.put(18121, 31455);
+		_keyBoxNpc.put(18122, 31455);
+		_keyBoxNpc.put(18123, 31455);
+		_keyBoxNpc.put(18124, 31456);
+		_keyBoxNpc.put(18125, 31456);
+		_keyBoxNpc.put(18126, 31456);
+		_keyBoxNpc.put(18127, 31456);
+		_keyBoxNpc.put(18128, 31457);
+		_keyBoxNpc.put(18129, 31457);
+		_keyBoxNpc.put(18130, 31457);
+		_keyBoxNpc.put(18131, 31457);
+		_keyBoxNpc.put(18149, 31458);
+		_keyBoxNpc.put(18150, 31459);
+		_keyBoxNpc.put(18151, 31459);
+		_keyBoxNpc.put(18152, 31459);
+		_keyBoxNpc.put(18153, 31459);
+		_keyBoxNpc.put(18154, 31460);
+		_keyBoxNpc.put(18155, 31460);
+		_keyBoxNpc.put(18156, 31460);
+		_keyBoxNpc.put(18157, 31460);
+		_keyBoxNpc.put(18158, 31461);
+		_keyBoxNpc.put(18159, 31461);
+		_keyBoxNpc.put(18160, 31461);
+		_keyBoxNpc.put(18161, 31461);
+		_keyBoxNpc.put(18162, 31462);
+		_keyBoxNpc.put(18163, 31462);
+		_keyBoxNpc.put(18164, 31462);
+		_keyBoxNpc.put(18165, 31462);
+		_keyBoxNpc.put(18183, 31463);
+		_keyBoxNpc.put(18184, 31464);
+		_keyBoxNpc.put(18212, 31465);
+		_keyBoxNpc.put(18213, 31465);
+		_keyBoxNpc.put(18214, 31465);
+		_keyBoxNpc.put(18215, 31465);
+		_keyBoxNpc.put(18216, 31466);
+		_keyBoxNpc.put(18217, 31466);
+		_keyBoxNpc.put(18218, 31466);
+		_keyBoxNpc.put(18219, 31466);
+		
+		_victim.put(18150, 18158);
+		_victim.put(18151, 18159);
+		_victim.put(18152, 18160);
+		_victim.put(18153, 18161);
+		_victim.put(18154, 18162);
+		_victim.put(18155, 18163);
+		_victim.put(18156, 18164);
+		_victim.put(18157, 18165);
+	}
+	
+	
+	private void loadMysteriousBox()
+	{
+		Connection con = null;
+		
+		_mysteriousBoxSpawns.clear();
+		
+		try
+		{
+			con = L2DatabaseFactory.getInstance().getConnection();
+			PreparedStatement statement = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay, key_npc_id FROM four_sepulchers_spawnlist Where spawntype = ? ORDER BY id");
+			statement.setInt(1, 0);
+			ResultSet rset = statement.executeQuery();
+			
+			L2Spawn spawnDat;
+			L2NpcTemplate template1;
+			
+			while (rset.next())
+			{
+				template1 = NpcTable.getInstance().getTemplate(rset.getInt("npc_templateid"));
+				if (template1 != null)
+				{
+					spawnDat = new L2Spawn(template1);
+					spawnDat.setAmount(rset.getInt("count"));
+					spawnDat.setLocx(rset.getInt("locx"));
+					spawnDat.setLocy(rset.getInt("locy"));
+					spawnDat.setLocz(rset.getInt("locz"));
+					spawnDat.setHeading(rset.getInt("heading"));
+					spawnDat.setRespawnDelay(rset.getInt("respawn_delay"));
+					SpawnTable.getInstance().addNewSpawn(spawnDat, false);
+					int keyNpcId = rset.getInt("key_npc_id");
+					_mysteriousBoxSpawns.put(keyNpcId, spawnDat);
+				}
+				else
+				{
+					_log.warning("FourSepulchersManager.LoadMysteriousBox: Data missing in NPC table for ID: "
+					        + rset.getInt("npc_templateid") + ".");
+				}
+			}
+			
+			rset.close();
+			statement.close();
+			_log.info("FourSepulchersManager: loaded "
+			        + _mysteriousBoxSpawns.size() + " Mysterious-Box spawns.");
+		}
+		catch (Exception e)
+		{
+			// problem with initializing spawn, go to next one
+			_log.warning("FourSepulchersManager.LoadMysteriousBox: Spawn could not be initialized: "
+			        + e);
+		}
+		finally
+		{
+			try
+			{
+				con.close();
+			}
+			catch (Exception e)
+			{
+			}
+		}
+	}
+	
+	
+	private void initKeyBoxSpawns()
+	{
+		L2Spawn spawnDat;
+		L2NpcTemplate template;
+		
+		for (int keyNpcId : _keyBoxNpc.keySet())
+		{
+			try
+			{
+				template = NpcTable.getInstance().getTemplate(_keyBoxNpc.get(keyNpcId));
+				if (template != null)
+				{
+					spawnDat = new L2Spawn(template);
+					spawnDat.setAmount(1);
+					spawnDat.setLocx(0);
+					spawnDat.setLocy(0);
+					spawnDat.setLocz(0);
+					spawnDat.setHeading(0);
+					spawnDat.setRespawnDelay(3600);
+					SpawnTable.getInstance().addNewSpawn(spawnDat, false);
+					_keyBoxSpawns.put(keyNpcId, spawnDat);
+				}
+				else
+				{
+					_log.warning("FourSepulchersManager.InitKeyBoxSpawns: Data missing in NPC table for ID: "
+					        + _keyBoxNpc.get(keyNpcId) + ".");
+				}
+			}
+			catch (Exception e)
+			{
+				_log.warning("FourSepulchersManager.InitKeyBoxSpawns: Spawn could not be initialized: "
+				        + e);
+			}
+		}
+	}
+	
+	
+	private void loadPhysicalMonsters()
+	{
+		_physicalMonsters.clear();
+		
+		int loaded = 0;
+		Connection con = null;
+		
+		try
+		{
+			con = L2DatabaseFactory.getInstance().getConnection();
+			
+			PreparedStatement statement1 = con.prepareStatement("SELECT Distinct key_npc_id FROM four_sepulchers_spawnlist Where spawntype = ? ORDER BY key_npc_id");
+			statement1.setInt(1, 1);
+			ResultSet rset1 = statement1.executeQuery();
+			while (rset1.next())
+			{
+				int keyNpcId = rset1.getInt("key_npc_id");
+				
+				PreparedStatement statement2 = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay, key_npc_id FROM four_sepulchers_spawnlist Where key_npc_id = ? and spawntype = ? ORDER BY id");
+				statement2.setInt(1, keyNpcId);
+				statement2.setInt(2, 1);
+				ResultSet rset2 = statement2.executeQuery();
+				
+				L2Spawn spawnDat;
+				L2NpcTemplate template1;
+				
+				_physicalSpawns = new FastList<L2Spawn>();
+				
+				while (rset2.next())
+				{
+					template1 = NpcTable.getInstance().getTemplate(rset2.getInt("npc_templateid"));
+					if (template1 != null)
+					{
+						spawnDat = new L2Spawn(template1);
+						spawnDat.setAmount(rset2.getInt("count"));
+						spawnDat.setLocx(rset2.getInt("locx"));
+						spawnDat.setLocy(rset2.getInt("locy"));
+						spawnDat.setLocz(rset2.getInt("locz"));
+						spawnDat.setHeading(rset2.getInt("heading"));
+						spawnDat.setRespawnDelay(rset2.getInt("respawn_delay"));
+						SpawnTable.getInstance().addNewSpawn(spawnDat, false);
+						_physicalSpawns.add(spawnDat);
+						loaded++;
+					}
+					else
+					{
+						_log.warning("FourSepulchersManager.LoadPhysicalMonsters: Data missing in NPC table for ID: "
+						        + rset2.getInt("npc_templateid") + ".");
+					}
+				}
+				
+				rset2.close();
+				statement2.close();
+				_physicalMonsters.put(keyNpcId, _physicalSpawns);
+			}
+			
+			rset1.close();
+			statement1.close();
+			_log.info("FourSepulchersManager: loaded " + loaded
+			        + " Physical type monsters spawns.");
+		}
+		catch (Exception e)
+		{
+			// problem with initializing spawn, go to next one
+			_log.warning("FourSepulchersManager.LoadPhysicalMonsters: Spawn could not be initialized: "
+			        + e);
+		}
+		finally
+		{
+			try
+			{
+				con.close();
+			}
+			catch (Exception e)
+			{
+			}
+		}
+	}
+	
+	
+	private void loadMagicalMonsters()
+	{
+		
+		_magicalMonsters.clear();
+		
+		int loaded = 0;
+		Connection con = null;
+		
+		try
+		{
+			con = L2DatabaseFactory.getInstance().getConnection();
+			
+			PreparedStatement statement1 = con.prepareStatement("SELECT Distinct key_npc_id FROM four_sepulchers_spawnlist Where spawntype = ? ORDER BY key_npc_id");
+			statement1.setInt(1, 2);
+			ResultSet rset1 = statement1.executeQuery();
+			while (rset1.next())
+			{
+				int keyNpcId = rset1.getInt("key_npc_id");
+				
+				PreparedStatement statement2 = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay, key_npc_id FROM four_sepulchers_spawnlist Where key_npc_id = ? and spawntype = ? ORDER BY id");
+				statement2.setInt(1, keyNpcId);
+				statement2.setInt(2, 2);
+				ResultSet rset2 = statement2.executeQuery();
+				
+				L2Spawn spawnDat;
+				L2NpcTemplate template1;
+				
+				_magicalSpawns = new FastList<L2Spawn>();
+				
+				while (rset2.next())
+				{
+					template1 = NpcTable.getInstance().getTemplate(rset2.getInt("npc_templateid"));
+					if (template1 != null)
+					{
+						spawnDat = new L2Spawn(template1);
+						spawnDat.setAmount(rset2.getInt("count"));
+						spawnDat.setLocx(rset2.getInt("locx"));
+						spawnDat.setLocy(rset2.getInt("locy"));
+						spawnDat.setLocz(rset2.getInt("locz"));
+						spawnDat.setHeading(rset2.getInt("heading"));
+						spawnDat.setRespawnDelay(rset2.getInt("respawn_delay"));
+						SpawnTable.getInstance().addNewSpawn(spawnDat, false);
+						_magicalSpawns.add(spawnDat);
+						loaded++;
+					}
+					else
+					{
+						_log.warning("FourSepulchersManager.LoadMagicalMonsters: Data missing in NPC table for ID: "
+						        + rset2.getInt("npc_templateid") + ".");
+					}
+				}
+				
+				rset2.close();
+				statement2.close();
+				_magicalMonsters.put(keyNpcId, _magicalSpawns);
+			}
+			
+			rset1.close();
+			statement1.close();
+			_log.info("FourSepulchersManager: loaded " + loaded
+			        + " Magical type monsters spawns.");
+		}
+		catch (Exception e)
+		{
+			// problem with initializing spawn, go to next one
+			_log.warning("FourSepulchersManager.LoadMagicalMonsters: Spawn could not be initialized: "
+			        + e);
+		}
+		finally
+		{
+			try
+			{
+				con.close();
+			}
+			catch (Exception e)
+			{
+			}
+		}
+	}
+	
+	
+	private void loadDukeMonsters()
+	{
+		_dukeFinalMobs.clear();
+		_archonSpawned.clear();
+		
+		int loaded = 0;
+		Connection con = null;
+		
+		try
+		{
+			con = L2DatabaseFactory.getInstance().getConnection();
+			
+			PreparedStatement statement1 = con.prepareStatement("SELECT Distinct key_npc_id FROM four_sepulchers_spawnlist Where spawntype = ? ORDER BY key_npc_id");
+			statement1.setInt(1, 5);
+			ResultSet rset1 = statement1.executeQuery();
+			while (rset1.next())
+			{
+				int keyNpcId = rset1.getInt("key_npc_id");
+				
+				PreparedStatement statement2 = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay, key_npc_id FROM four_sepulchers_spawnlist Where key_npc_id = ? and spawntype = ? ORDER BY id");
+				statement2.setInt(1, keyNpcId);
+				statement2.setInt(2, 5);
+				ResultSet rset2 = statement2.executeQuery();
+				
+				L2Spawn spawnDat;
+				L2NpcTemplate template1;
+				
+				_dukeFinalSpawns = new FastList<L2Spawn>();
+				
+				while (rset2.next())
+				{
+					template1 = NpcTable.getInstance().getTemplate(rset2.getInt("npc_templateid"));
+					if (template1 != null)
+					{
+						spawnDat = new L2Spawn(template1);
+						spawnDat.setAmount(rset2.getInt("count"));
+						spawnDat.setLocx(rset2.getInt("locx"));
+						spawnDat.setLocy(rset2.getInt("locy"));
+						spawnDat.setLocz(rset2.getInt("locz"));
+						spawnDat.setHeading(rset2.getInt("heading"));
+						spawnDat.setRespawnDelay(rset2.getInt("respawn_delay"));
+						SpawnTable.getInstance().addNewSpawn(spawnDat, false);
+						_dukeFinalSpawns.add(spawnDat);
+						loaded++;
+					}
+					else
+					{
+						_log.warning("FourSepulchersManager.LoadDukeMonsters: Data missing in NPC table for ID: "
+						        + rset2.getInt("npc_templateid") + ".");
+					}
+				}
+				
+				rset2.close();
+				statement2.close();
+				_dukeFinalMobs.put(keyNpcId, _dukeFinalSpawns);
+				_archonSpawned.put(keyNpcId, false);
+			}
+			
+			rset1.close();
+			statement1.close();
+			_log.info("FourSepulchersManager: loaded " + loaded
+			        + " Church of duke monsters spawns.");
+		}
+		catch (Exception e)
+		{
+			// problem with initializing spawn, go to next one
+			_log.warning("FourSepulchersManager.LoadDukeMonsters: Spawn could not be initialized: "
+			        + e);
+		}
+		finally
+		{
+			try
+			{
+				con.close();
+			}
+			catch (Exception e)
+			{
+			}
+		}
+	}
+	
+	
+	private void loadEmperorsGraveMonsters()
+	{
+		
+		_emperorsGraveNpcs.clear();
+		
+		int loaded = 0;
+		Connection con = null;
+		
+		try
+		{
+			con = L2DatabaseFactory.getInstance().getConnection();
+			
+			PreparedStatement statement1 = con.prepareStatement("SELECT Distinct key_npc_id FROM four_sepulchers_spawnlist Where spawntype = ? ORDER BY key_npc_id");
+			statement1.setInt(1, 6);
+			ResultSet rset1 = statement1.executeQuery();
+			while (rset1.next())
+			{
+				int keyNpcId = rset1.getInt("key_npc_id");
+				
+				PreparedStatement statement2 = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay, key_npc_id FROM four_sepulchers_spawnlist Where key_npc_id = ? and spawntype = ? ORDER BY id");
+				statement2.setInt(1, keyNpcId);
+				statement2.setInt(2, 6);
+				ResultSet rset2 = statement2.executeQuery();
+				
+				L2Spawn spawnDat;
+				L2NpcTemplate template1;
+				
+				_emperorsGraveSpawns = new FastList<L2Spawn>();
+				
+				while (rset2.next())
+				{
+					template1 = NpcTable.getInstance().getTemplate(rset2.getInt("npc_templateid"));
+					if (template1 != null)
+					{
+						spawnDat = new L2Spawn(template1);
+						spawnDat.setAmount(rset2.getInt("count"));
+						spawnDat.setLocx(rset2.getInt("locx"));
+						spawnDat.setLocy(rset2.getInt("locy"));
+						spawnDat.setLocz(rset2.getInt("locz"));
+						spawnDat.setHeading(rset2.getInt("heading"));
+						spawnDat.setRespawnDelay(rset2.getInt("respawn_delay"));
+						SpawnTable.getInstance().addNewSpawn(spawnDat, false);
+						_emperorsGraveSpawns.add(spawnDat);
+						loaded++;
+					}
+					else
+					{
+						_log.warning("FourSepulchersManager.LoadEmperorsGraveMonsters: Data missing in NPC table for ID: "
+						        + rset2.getInt("npc_templateid") + ".");
+					}
+				}
+				
+				rset2.close();
+				statement2.close();
+				_emperorsGraveNpcs.put(keyNpcId, _emperorsGraveSpawns);
+			}
+			
+			rset1.close();
+			statement1.close();
+			_log.info("FourSepulchersManager: loaded " + loaded
+			        + " Emperor's grave NPC spawns.");
+		}
+		catch (Exception e)
+		{
+			// problem with initializing spawn, go to next one
+			_log.warning("FourSepulchersManager.LoadEmperorsGraveMonsters: Spawn could not be initialized: "
+			        + e);
+		}
+		finally
+		{
+			try
+			{
+				con.close();
+			}
+			catch (Exception e)
+			{
+			}
+		}
+	}
+	
+	
+	protected void initLocationShadowSpawns()
+	{
+		int locNo = Rnd.get(4);
+		final int[] gateKeeper = { 31929, 31934, 31939, 31944 };
+		
+		L2Spawn spawnDat;
+		L2NpcTemplate template;
+		
+		_shadowSpawns.clear();
+		
+		for (int i = 0; i <= 3; i++)
+		{
+			template = NpcTable.getInstance().getTemplate(_shadowSpawnLoc[locNo][i][0]);
+			if (template != null)
+			{
+				try
+				{
+					spawnDat = new L2Spawn(template);
+					spawnDat.setAmount(1);
+					spawnDat.setLocx(_shadowSpawnLoc[locNo][i][1]);
+					spawnDat.setLocy(_shadowSpawnLoc[locNo][i][2]);
+					spawnDat.setLocz(_shadowSpawnLoc[locNo][i][3]);
+					spawnDat.setHeading(_shadowSpawnLoc[locNo][i][4]);
+					SpawnTable.getInstance().addNewSpawn(spawnDat, false);
+					int keyNpcId = gateKeeper[i];
+					_shadowSpawns.put(keyNpcId, spawnDat);
+				}
+				catch (Exception e)
+				{
+					_log.warning(e.getMessage());
+				}
+			}
+			else
+			{
+				_log.warning("FourSepulchersManager.InitLocationShadowSpawns: Data missing in NPC table for ID: "
+				        + _shadowSpawnLoc[locNo][i][0] + ".");
+			}
+		}
+	}
+	
+	
+	protected void initExecutionerSpawns()
+	{
+		L2Spawn spawnDat;
+		L2NpcTemplate template;
+		
+		for (int keyNpcId : _victim.keySet())
+		{
+			try
+			{
+				template = NpcTable.getInstance().getTemplate(_victim.get(keyNpcId));
+				if (template != null)
+				{
+					spawnDat = new L2Spawn(template);
+					spawnDat.setAmount(1);
+					spawnDat.setLocx(0);
+					spawnDat.setLocy(0);
+					spawnDat.setLocz(0);
+					spawnDat.setHeading(0);
+					spawnDat.setRespawnDelay(3600);
+					SpawnTable.getInstance().addNewSpawn(spawnDat, false);
+					_executionerSpawns.put(keyNpcId, spawnDat);
+				}
+				else
+				{
+					_log.warning("FourSepulchersManager.InitExecutionerSpawns: Data missing in NPC table for ID: "
+					        + _victim.get(keyNpcId) + ".");
+				}
+			}
+			catch (Exception e)
+			{
+				_log.warning("FourSepulchersManager.InitExecutionerSpawns: Spawn could not be initialized: "
+				        + e);
+			}
+		}
+	}
+	
+	
+	public boolean isEntryTime()
+	{
+		return _inEntryTime;
+	}
+	
+	
+	public boolean isAttackTime()
+	{
+		return _inAttackTime;
+	}
+	
+	
+	public synchronized void tryEntry(L2NpcInstance npc, L2PcInstance player)
+	{
+		int npcId = npc.getNpcId();
+		switch (npcId)
+		{
+			// ID ok
+			case 31921:
+			case 31922:
+			case 31923:
+			case 31924:
+				break;
+			// ID not ok
+			default:
+				if (!player.isGM())
+				{
+					_log.warning("Player " + player.getName() + "("
+					        + player.getObjectId()
+					        + ") tried to cheat in four sepulchers.");
+					Util.handleIllegalPlayerAction(player, "Warning!! Character "
+					        + player.getName()
+					        + " tried to enter four sepulchers with invalid npc id.", Config.DEFAULT_PUNISH);
+				}
+				return;
+		}
+		
+		if (_hallInUse.get(npcId).booleanValue())
+		{
+			showHtmlFile(player, npcId + "-FULL.htm", npc, null);
+			return;
+		}
+		
+		if (Config.FS_PARTY_MEMBER_COUNT > 1)
+		{
+			if (!player.isInParty()
+			        || player.getParty().getMemberCount() < Config.FS_PARTY_MEMBER_COUNT)
+			{
+				showHtmlFile(player, npcId + "-SP.htm", npc, null);
+				return;
+			}
+			
+			if (!player.getParty().isLeader(player))
+			{
+				showHtmlFile(player, npcId + "-NL.htm", npc, null);
+				return;
+			}
+			
+			for (L2PcInstance mem : player.getParty().getPartyMembers())
+			{
+				QuestState qs = mem.getQuestState(QUEST_ID);
+				if (qs == null || (!qs.isStarted() && !qs.isCompleted()))
+				{
+					showHtmlFile(player, npcId + "-NS.htm", npc, mem);
+					return;
+				}
+				if (mem.getInventory().getItemByItemId(ENTRANCE_PASS) == null)
+				{
+					showHtmlFile(player, npcId + "-SE.htm", npc, mem);
+					return;
+				}
+				
+				if (player.getWeightPenalty() >= 3)
+				{
+					mem.sendPacket(new SystemMessage(SystemMessageId.INVENTORY_LESS_THAN_80_PERCENT));
+					return;
+				}
+			}
+		}
+		else if (Config.FS_PARTY_MEMBER_COUNT <= 1 && player.isInParty())
+		{
+				if (!player.getParty().isLeader(player))
+				{
+					showHtmlFile(player, npcId + "-NL.htm", npc, null);
+					return;
+				}
+				for (L2PcInstance mem : player.getParty().getPartyMembers())
+				{
+					QuestState qs = mem.getQuestState(QUEST_ID);
+					if (qs == null || (!qs.isStarted() && !qs.isCompleted()))
+					{
+						showHtmlFile(player, npcId + "-NS.htm", npc, mem);
+						return;
+					}
+					if (mem.getInventory().getItemByItemId(ENTRANCE_PASS) == null)
+					{
+						showHtmlFile(player, npcId + "-SE.htm", npc, mem);
+						return;
+					}
+					
+					if (player.getWeightPenalty() >= 3)
+					{
+						mem.sendPacket(new SystemMessage(SystemMessageId.INVENTORY_LESS_THAN_80_PERCENT));
+						return;
+					}
+				}
+		}
+		else
+		{
+			QuestState qs = player.getQuestState(QUEST_ID);
+			if (qs == null || (!qs.isStarted() && !qs.isCompleted()))
+			{
+				showHtmlFile(player, npcId + "-NS.htm", npc, player);
+				return;
+			}
+			if (player.getInventory().getItemByItemId(ENTRANCE_PASS) == null)
+			{
+				showHtmlFile(player, npcId + "-SE.htm", npc, player);
+				return;
+			}
+			
+			if (player.getWeightPenalty() >= 3)
+			{
+				player.sendPacket(new SystemMessage(SystemMessageId.INVENTORY_LESS_THAN_80_PERCENT));
+				return;
+			}
+		}
+		
+		if (!isEntryTime())
+		{
+			showHtmlFile(player, npcId + "-NE.htm", npc, null);
+			return;
+		}
+		
+		showHtmlFile(player, npcId + "-OK.htm", npc, null);
+		
+		entry(npcId, player);
+	}
+	
+	
+	private void entry(int npcId, L2PcInstance player)
+	{
+		int[] Location = _startHallSpawns.get(npcId);
+		int driftx;
+		int drifty;
+		
+		if (Config.FS_PARTY_MEMBER_COUNT > 1)
+		{
+			List<L2PcInstance> members = new FastList<L2PcInstance>();
+			for (L2PcInstance mem : player.getParty().getPartyMembers())
+			{
+				if (!mem.isDead()
+				        && Util.checkIfInRange(700, player, mem, true))
+				{
+					members.add(mem);
+				}
+			}
+			
+			for (L2PcInstance mem : members)
+			{
+				GrandBossManager.getInstance().getZone(Location[0],Location[1],Location[2]).allowPlayerEntry(mem, 30);
+				driftx = Rnd.get(-80, 80);
+				drifty = Rnd.get(-80, 80);
+				mem.teleToLocation(Location[0] + driftx, Location[1] + drifty, Location[2]);
+				mem.destroyItemByItemId("Quest", ENTRANCE_PASS, 1, mem, true);
+				if (mem.getInventory().getItemByItemId(ANTIQUE_BROOCH) == null)
+				{
+					mem.addItem("Quest", USED_PASS, 1, mem, true);
+				}
+				
+				L2ItemInstance hallsKey = mem.getInventory().getItemByItemId(CHAPEL_KEY);
+				if (hallsKey != null)
+				{
+					mem.destroyItemByItemId("Quest", CHAPEL_KEY, hallsKey.getCount(), mem, true);
+				}
+			}
+			
+			_challengers.remove(npcId);
+			_challengers.put(npcId, player);
+			
+			_hallInUse.remove(npcId);
+			_hallInUse.put(npcId, true);
+		}
+		if (Config.FS_PARTY_MEMBER_COUNT <= 1 && player.isInParty())
+		{
+			List<L2PcInstance> members = new FastList<L2PcInstance>();
+			for (L2PcInstance mem : player.getParty().getPartyMembers())
+			{
+				if (!mem.isDead()
+				        && Util.checkIfInRange(700, player, mem, true))
+				{
+					members.add(mem);
+				}
+			}
+			
+			for (L2PcInstance mem : members)
+			{
+				GrandBossManager.getInstance().getZone(Location[0],Location[1],Location[2]).allowPlayerEntry(mem, 30);
+				driftx = Rnd.get(-80, 80);
+				drifty = Rnd.get(-80, 80);
+				mem.teleToLocation(Location[0] + driftx, Location[1] + drifty, Location[2]);
+				mem.destroyItemByItemId("Quest", ENTRANCE_PASS, 1, mem, true);
+				if (mem.getInventory().getItemByItemId(ANTIQUE_BROOCH) == null)
+				{
+					mem.addItem("Quest", USED_PASS, 1, mem, true);
+				}
+				
+				L2ItemInstance hallsKey = mem.getInventory().getItemByItemId(CHAPEL_KEY);
+				if (hallsKey != null)
+				{
+					mem.destroyItemByItemId("Quest", CHAPEL_KEY, hallsKey.getCount(), mem, true);
+				}
+			}
+			
+			_challengers.remove(npcId);
+			_challengers.put(npcId, player);
+			
+			_hallInUse.remove(npcId);
+			_hallInUse.put(npcId, true);
+		}
+		else
+		{
+			GrandBossManager.getInstance().getZone(Location[0],Location[1],Location[2]).allowPlayerEntry(player, 30);
+			driftx = Rnd.get(-80, 80);
+			drifty = Rnd.get(-80, 80);
+			player.teleToLocation(Location[0] + driftx, Location[1] + drifty, Location[2]);
+			player.destroyItemByItemId("Quest", ENTRANCE_PASS, 1, player, true);
+			if (player.getInventory().getItemByItemId(ANTIQUE_BROOCH) == null)
+			{
+				player.addItem("Quest", USED_PASS, 1, player, true);
+			}
+			
+			L2ItemInstance hallsKey = player.getInventory().getItemByItemId(CHAPEL_KEY);
+			if (hallsKey != null)
+			{
+				player.destroyItemByItemId("Quest", CHAPEL_KEY, hallsKey.getCount(), player, true);
+			}
+			
+			_challengers.remove(npcId);
+			_challengers.put(npcId, player);
+			
+			_hallInUse.remove(npcId);
+			_hallInUse.put(npcId, true);
+		}
+	}
+	
+	
+	public void spawnMysteriousBox(int npcId)
+	{
+		if (!isAttackTime())
+			return;
+		
+		L2Spawn spawnDat = _mysteriousBoxSpawns.get(npcId);
+		if (spawnDat != null)
+		{
+			_allMobs.add(spawnDat.doSpawn());
+			spawnDat.stopRespawn();
+		}
+	}
+
+	public void spawnMonster(int npcId)
+	{
+		if (!isAttackTime())
+			return;
+		
+		FastList<L2Spawn> monsterList;
+		FastList<L2SepulcherMonsterInstance> mobs = new FastList<L2SepulcherMonsterInstance>();
+		L2Spawn keyBoxMobSpawn;
+		
+		if (Rnd.get(2) == 0)
+		{
+			monsterList = _physicalMonsters.get(npcId);
+		}
+		else
+		{
+			monsterList = _magicalMonsters.get(npcId);
+		}
+		
+		if (monsterList != null)
+		{
+			boolean spawnKeyBoxMob = false;
+			boolean spawnedKeyBoxMob = false;
+			
+			for (L2Spawn spawnDat : monsterList)
+			{
+				if (spawnedKeyBoxMob)
+				{
+					spawnKeyBoxMob = false;
+				}
+				else
+				{
+					switch (npcId)
+					{
+						case 31469:
+						case 31474:
+						case 31479:
+						case 31484:
+							if (Rnd.get(48) == 0)
+							{
+								spawnKeyBoxMob = true;
+								// _log.info("FourSepulchersManager.SpawnMonster:
+								// Set to spawn Church of Viscount Key Mob.");
+							}
+							break;
+						default:
+							spawnKeyBoxMob = false;
+					}
+				}
+				
+				L2SepulcherMonsterInstance mob = null;
+				
+				if (spawnKeyBoxMob)
+				{
+					try
+					{
+						L2NpcTemplate template = NpcTable.getInstance().getTemplate(18149);
+						if (template != null)
+						{
+							keyBoxMobSpawn = new L2Spawn(template);
+							keyBoxMobSpawn.setAmount(1);
+							keyBoxMobSpawn.setLocx(spawnDat.getLocx());
+							keyBoxMobSpawn.setLocy(spawnDat.getLocy());
+							keyBoxMobSpawn.setLocz(spawnDat.getLocz());
+							keyBoxMobSpawn.setHeading(spawnDat.getHeading());
+							keyBoxMobSpawn.setRespawnDelay(3600);
+							SpawnTable.getInstance().addNewSpawn(keyBoxMobSpawn, false);
+							mob = (L2SepulcherMonsterInstance) keyBoxMobSpawn.doSpawn();
+							keyBoxMobSpawn.stopRespawn();
+						}
+						else
+						{
+							_log.warning("FourSepulchersManager.SpawnMonster: Data missing in NPC table for ID: 18149");
+						}
+					}
+					catch (Exception e)
+					{
+						_log.warning("FourSepulchersManager.SpawnMonster: Spawn could not be initialized: "
+						        + e);
+					}
+					
+					spawnedKeyBoxMob = true;
+				}
+				else
+				{
+					mob = (L2SepulcherMonsterInstance) spawnDat.doSpawn();
+					spawnDat.stopRespawn();
+				}
+				
+				if (mob != null)
+				{
+					mob.mysteriousBoxId = npcId;
+					switch (npcId)
+					{
+						case 31469:
+						case 31474:
+						case 31479:
+						case 31484:
+						case 31472:
+						case 31477:
+						case 31482:
+						case 31487:
+							mobs.add(mob);
+					}
+					_allMobs.add(mob);
+				}
+			}
+			
+			switch (npcId)
+			{
+				case 31469:
+				case 31474:
+				case 31479:
+				case 31484:
+					_viscountMobs.put(npcId, mobs);
+					break;
+				
+				case 31472:
+				case 31477:
+				case 31482:
+				case 31487:
+					_dukeMobs.put(npcId, mobs);
+					break;
+			}
+		}
+	}
+	
+	public synchronized boolean isViscountMobsAnnihilated(int npcId)
+	{
+		FastList<L2SepulcherMonsterInstance> mobs = _viscountMobs.get(npcId);
+		
+		if (mobs == null)
+			return true;
+		
+		for (L2SepulcherMonsterInstance mob : mobs)
+		{
+			if (!mob.isDead())
+				return false;
+		}
+		
+		return true;
+	}
+	
+	public synchronized boolean isDukeMobsAnnihilated(int npcId)
+	{
+		FastList<L2SepulcherMonsterInstance> mobs = _dukeMobs.get(npcId);
+		
+		if (mobs == null)
+			return true;
+		
+		for (L2SepulcherMonsterInstance mob : mobs)
+		{
+			if (!mob.isDead())
+				return false;
+		}
+		
+		return true;
+	}
+
+	public void spawnKeyBox(L2NpcInstance activeChar)
+	{
+		if (!isAttackTime())
+			return;
+		
+		L2Spawn spawnDat = _keyBoxSpawns.get(activeChar.getNpcId());
+		
+		if (spawnDat != null)
+		{
+			spawnDat.setAmount(1);
+			spawnDat.setLocx(activeChar.getX());
+			spawnDat.setLocy(activeChar.getY());
+			spawnDat.setLocz(activeChar.getZ());
+			spawnDat.setHeading(activeChar.getHeading());
+			spawnDat.setRespawnDelay(3600);
+			_allMobs.add(spawnDat.doSpawn());
+			spawnDat.stopRespawn();
+			
+		}
+	}
+
+	public void spawnExecutionerOfHalisha(L2NpcInstance activeChar)
+	{
+		if (!isAttackTime())
+			return;
+		
+		L2Spawn spawnDat = _executionerSpawns.get(activeChar.getNpcId());
+		
+		if (spawnDat != null)
+		{
+			spawnDat.setAmount(1);
+			spawnDat.setLocx(activeChar.getX());
+			spawnDat.setLocy(activeChar.getY());
+			spawnDat.setLocz(activeChar.getZ());
+			spawnDat.setHeading(activeChar.getHeading());
+			spawnDat.setRespawnDelay(3600);
+			_allMobs.add(spawnDat.doSpawn());
+			spawnDat.stopRespawn();
+		}
+	}
+
+	public void spawnArchonOfHalisha(int npcId)
+	{
+		if (!isAttackTime())
+			return;
+		
+		if (_archonSpawned.get(npcId))
+			return;
+		
+		FastList<L2Spawn> monsterList = _dukeFinalMobs.get(npcId);
+		
+		if (monsterList != null)
+		{
+			for (L2Spawn spawnDat : monsterList)
+			{
+				L2SepulcherMonsterInstance mob = (L2SepulcherMonsterInstance) spawnDat.doSpawn();
+				spawnDat.stopRespawn();
+				
+				if (mob != null)
+				{
+					mob.mysteriousBoxId = npcId;
+					_allMobs.add(mob);
+				}
+			}
+			_archonSpawned.put(npcId, true);
+		}
+	}
+
+	public void spawnEmperorsGraveNpc(int npcId)
+	{
+		if (!isAttackTime())
+			return;
+		
+		FastList<L2Spawn> monsterList = _emperorsGraveNpcs.get(npcId);
+		
+		if (monsterList != null)
+		{
+			for (L2Spawn spawnDat : monsterList)
+			{
+				_allMobs.add(spawnDat.doSpawn());
+				spawnDat.stopRespawn();
+			}
+		}
+	}
+	
+	
+	protected void locationShadowSpawns()
+	{
+		int locNo = Rnd.get(4);
+		// _log.info("FourSepulchersManager.LocationShadowSpawns: Location index
+		// is " + locNo + ".");
+		final int[] gateKeeper = { 31929, 31934, 31939, 31944 };
+		
+		L2Spawn spawnDat;
+		
+		for (int i = 0; i <= 3; i++)
+		{
+			int keyNpcId = gateKeeper[i];
+			spawnDat = _shadowSpawns.get(keyNpcId);
+			spawnDat.setLocx(_shadowSpawnLoc[locNo][i][1]);
+			spawnDat.setLocy(_shadowSpawnLoc[locNo][i][2]);
+			spawnDat.setLocz(_shadowSpawnLoc[locNo][i][3]);
+			spawnDat.setHeading(_shadowSpawnLoc[locNo][i][4]);
+			_shadowSpawns.put(keyNpcId, spawnDat);
+		}
+	}
+	
+	
+	public void spawnShadow(int npcId)
+	{
+		if (!isAttackTime())
+			return;
+		
+		L2Spawn spawnDat = _shadowSpawns.get(npcId);
+		if (spawnDat != null)
+		{
+			L2SepulcherMonsterInstance mob = (L2SepulcherMonsterInstance) spawnDat.doSpawn();
+			spawnDat.stopRespawn();
+			
+			if (mob != null)
+			{
+				mob.mysteriousBoxId = npcId;
+				_allMobs.add(mob);
+			}
+		}
+	}
+
+	public void deleteAllMobs()
+	{
+		// _log.info("FourSepulchersManager.DeleteAllMobs: Try to delete " +
+		// _allMobs.size() + " monsters.");
+		
+		int delCnt = 0;
+		for (L2NpcInstance mob : _allMobs)
+		{
+			try
+			{
+				mob.getSpawn().stopRespawn();
+				mob.deleteMe();
+				delCnt++;
+			}
+			catch (Exception e)
+			{
+				_log.warning(e.getMessage());
+			}
+		}
+		_allMobs.clear();
+		// _log.info("FourSepulchersManager.DeleteAllMobs: Deleted " + delCnt +
+		// " monsters.");
+	}
+	
+	
+	protected void closeAllDoors()
+	{
+		for (int doorId : _hallGateKeepers.values())
+		{
+			try
+			{
+				DoorTable.getInstance().getDoor(doorId).closeMe();
+			}
+			catch (Exception e)
+			{
+				_log.warning(e.getMessage());
+			}
+		}
+	}
+	
+	protected byte minuteSelect(byte min)
+	{
+		if ((double) min % 5 != 0)// if doesn't divides on 5 fully
+		{
+			// mad table for selecting proper minutes...
+			// may be there is a better way to do this
+			switch (min)
+			{
+				case 6:
+				case 7:
+					min = 5;
+					break;
+				case 8:
+				case 9:
+				case 11:
+				case 12:
+					min = 10;
+					break;
+				case 13:
+				case 14:
+				case 16:
+				case 17:
+					min = 15;
+					break;
+				case 18:
+				case 19:
+				case 21:
+				case 22:
+					min = 20;
+					break;
+				case 23:
+				case 24:
+				case 26:
+				case 27:
+					min = 25;
+					break;
+				case 28:
+				case 29:
+				case 31:
+				case 32:
+					min = 30;
+					break;
+				case 33:
+				case 34:
+				case 36:
+				case 37:
+					min = 35;
+					break;
+				case 38:
+				case 39:
+				case 41:
+				case 42:
+					min = 40;
+					break;
+				case 43:
+				case 44:
+				case 46:
+				case 47:
+					min = 45;
+					break;
+				case 48:
+				case 49:
+				case 51:
+				case 52:
+					min = 50;
+					break;
+				case 53:
+				case 54:
+				case 56:
+				case 57:
+					min = 55;
+					break;
+			}
+		}
+		return min;
+	}
+
+	public void managerSay(byte min)
+	{
+		// for attack phase, sending message every 5 minutes
+		if (_inAttackTime)
+		{
+			if (min < 5)
+				return; // do not shout when < 5 minutes
+				
+			min = minuteSelect(min);
+			
+			String msg = min + " minute(s) have passed."; // now this is a
+															// proper message^^
+			
+			if (min == 90)
+				msg = "Game over. The teleport will appear momentarily";
+			
+			int i = 0;
+			for (int k = _managers.size(); i < k; i++)
+			{
+				if (_managers.get(i) == null)
+				{
+					_log.warning("FourSepulchersManager: managerSay(): manager is null");
+					continue;
+				}
+				if (!(_managers.get(i).getLastSpawn() instanceof L2SepulcherNpcInstance))
+				{
+					_log.warning("FourSepulchersManager: managerSay(): manager is not Sepulcher instance");
+					continue;
+				}
+				// hall not used right now, so its manager will not tell you
+				// anything :)
+				// if you don't need this - delete next two lines.
+				if (!_hallInUse.get(_managers.get(i).getNpcid()).booleanValue())
+					continue;
+				
+				((L2SepulcherNpcInstance) _managers.get(i).getLastSpawn()).sayInShout(msg);
+			}
+		}
+		
+		else if (_inEntryTime)
+		{
+			String msg1 = "You may now enter the Sepulcher";
+			String msg2 = "If you place your hand on the stone statue in front of each sepulcher,"
+			        + " you will be able to enter";
+			int i = 0;
+			for (int k = _managers.size(); i < k; i++)
+			{
+				if (_managers.get(i) == null)
+				{
+					_log.warning("FourSepulchersManager: Something goes wrong in managerSay()...");
+					continue;
+				}
+				if (!(_managers.get(i).getLastSpawn() instanceof L2SepulcherNpcInstance))
+				{
+					_log.warning("FourSepulchersManager: Something goes wrong in managerSay()...");
+					continue;
+				}
+				((L2SepulcherNpcInstance) _managers.get(i).getLastSpawn()).sayInShout(msg1);
+				((L2SepulcherNpcInstance) _managers.get(i).getLastSpawn()).sayInShout(msg2);
+			}
+		}
+	}
+
+	protected class ManagerSay implements Runnable
+	{
+		public void run()
+		{
+			if (_inAttackTime)
+			{
+				Calendar tmp = Calendar.getInstance();
+				tmp.setTimeInMillis(Calendar.getInstance().getTimeInMillis()
+				        - _warmUpTimeEnd);
+				if (tmp.get(Calendar.MINUTE) + 5 < Config.FS_TIME_ATTACK)
+				{
+					managerSay((byte) tmp.get(Calendar.MINUTE)); // byte
+																	// because
+																	// minute
+																	// cannot be
+																	// more than
+																	// 59
+					ThreadPoolManager.getInstance().scheduleGeneral(new ManagerSay(), 5 * 60000);
+				}
+				// attack time ending chat
+				else if (tmp.get(Calendar.MINUTE) + 5 >= Config.FS_TIME_ATTACK)
+				{
+					managerSay((byte) 90); // sending a unique id :D
+				}
+			}
+			else if (_inEntryTime)
+				managerSay((byte) 0);
+		}
+	}
+	
+	protected class ChangeEntryTime implements Runnable
+	{
+		public void run()
+		{
+			// _log.info("FourSepulchersManager:In Entry Time");
+			_inEntryTime = true;
+			_inWarmUpTime = false;
+			_inAttackTime = false;
+			_inCoolDownTime = false;
+			
+			long interval = 0;
+			// if this is first launch - search time when entry time will be
+			// ended:
+			// counting difference between time when entry time ends and current
+			// time
+			// and then launching change time task
+			if (_firstTimeRun)
+				interval = _entryTimeEnd
+				        - Calendar.getInstance().getTimeInMillis();
+			else
+				interval = Config.FS_TIME_ENTRY * 60000; // else use stupid
+															// method
+				
+			// launching saying process...
+			ThreadPoolManager.getInstance().scheduleGeneral(new ManagerSay(), 0);
+			_changeWarmUpTimeTask = ThreadPoolManager.getInstance().scheduleEffect(new ChangeWarmUpTime(),interval);
+			if (_changeEntryTimeTask != null)
+			{
+				_changeEntryTimeTask.cancel(true);
+				_changeEntryTimeTask = null;
+			}
+			
+		}
+	}
+	
+	protected class ChangeWarmUpTime implements Runnable
+	{
+		public void run()
+		{
+			// _log.info("FourSepulchersManager:In Warm-Up Time");
+			_inEntryTime = true;
+			_inWarmUpTime = false;
+			_inAttackTime = false;
+			_inCoolDownTime = false;
+			
+			long interval = 0;
+			// searching time when warmup time will be ended:
+			// counting difference between time when warmup time ends and
+			// current time
+			// and then launching change time task
+			if (_firstTimeRun)
+				interval = _warmUpTimeEnd
+				        - Calendar.getInstance().getTimeInMillis();
+			else
+				interval = Config.FS_TIME_WARMUP * 60000;
+			_changeAttackTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeAttackTime(), interval);
+			
+			if (_changeWarmUpTimeTask != null)
+			{
+				_changeWarmUpTimeTask.cancel(true);
+				_changeWarmUpTimeTask = null;
+			}
+		}
+	}
+	
+	protected class ChangeAttackTime implements Runnable
+	{
+		public void run()
+		{
+			// _log.info("FourSepulchersManager:In Attack Time");
+			_inEntryTime = false;
+			_inWarmUpTime = false;
+			_inAttackTime = true;
+			_inCoolDownTime = false;
+			
+			locationShadowSpawns();
+			
+			spawnMysteriousBox(31921);
+			spawnMysteriousBox(31922);
+			spawnMysteriousBox(31923);
+			spawnMysteriousBox(31924);
+			
+			if (!_firstTimeRun)
+			{
+				_warmUpTimeEnd = Calendar.getInstance().getTimeInMillis();
+			}
+			
+			long interval = 0;
+			// say task
+			if (_firstTimeRun)
+			{
+				for (double min = Calendar.getInstance().get(Calendar.MINUTE); min < _newCycleMin; min++)
+				{
+					// looking for next shout time....
+					if (min % 5 == 0)// check if min can be divided by 5
+					{
+						_log.info(Calendar.getInstance().getTime()
+						        + " Atk announce scheduled to " + min
+						        + " minute of this hour.");
+						Calendar inter = Calendar.getInstance();
+						inter.set(Calendar.MINUTE, (int) min);
+						ThreadPoolManager.getInstance().scheduleGeneral(new ManagerSay(), inter.getTimeInMillis()
+						        - Calendar.getInstance().getTimeInMillis());
+						break;
+					}
+				}
+			}
+			else
+				ThreadPoolManager.getInstance().scheduleGeneral(new ManagerSay(), 5 * 60400);
+			// searching time when attack time will be ended:
+			// counting difference between time when attack time ends and
+			// current time
+			// and then launching change time task
+			if (_firstTimeRun)
+				interval = _attackTimeEnd
+				        - Calendar.getInstance().getTimeInMillis();
+			else
+				interval = Config.FS_TIME_ATTACK * 60000;
+			_changeCoolDownTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeCoolDownTime(), interval);
+			
+			if (_changeAttackTimeTask != null)
+			{
+				_changeAttackTimeTask.cancel(true);
+				_changeAttackTimeTask = null;
+			}
+		}
+	}
+	
+	protected class ChangeCoolDownTime implements Runnable
+	{
+		public void run()
+		{
+			// _log.info("FourSepulchersManager:In Cool-Down Time");
+			_inEntryTime = false;
+			_inWarmUpTime = false;
+			_inAttackTime = false;
+			_inCoolDownTime = true;
+			
+			clean();
+			
+			Calendar time = Calendar.getInstance();
+			// one hour = 55th min to 55 min of next hour, so we check for this,
+			// also check for first launch
+			if (Calendar.getInstance().get(Calendar.MINUTE) > _newCycleMin
+			        && !_firstTimeRun)
+				time.set(Calendar.HOUR, Calendar.getInstance().get(Calendar.HOUR) + 1);
+			time.set(Calendar.MINUTE, _newCycleMin);
+			_log.info("FourSepulchersManager: Entry time: " + time.getTime());
+			if (_firstTimeRun)
+				_firstTimeRun = false; // cooldown phase ends event hour, so it
+										// will be not first run
+				
+			long interval = time.getTimeInMillis()
+			        - Calendar.getInstance().getTimeInMillis();
+			_changeEntryTimeTask = ThreadPoolManager.getInstance().scheduleGeneral(new ChangeEntryTime(), interval);
+			
+			if (_changeCoolDownTimeTask != null)
+			{
+				_changeCoolDownTimeTask.cancel(true);
+				_changeCoolDownTimeTask = null;
+			}
+		}
+	}
+	
+	public Map<Integer, Integer> getHallGateKeepers()
+	{
+		return _hallGateKeepers;
+	}
+
+	public void showHtmlFile(L2PcInstance player, String file,
+	        L2NpcInstance npc, L2PcInstance member)
+	{
+		NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
+		html.setFile("data/html/SepulcherNpc/" + file);
+		if (member != null)
+			html.replace("%member%", member.getName());
+		player.sendPacket(html);
+	}
+}

+ 13 - 3
L2_GameServer/java/net/sf/l2j/gameserver/instancemanager/GrandBossManager.java

@@ -26,6 +26,7 @@ import net.sf.l2j.L2DatabaseFactory;
 import net.sf.l2j.gameserver.model.L2Character;
 import net.sf.l2j.gameserver.model.L2Object;
 import net.sf.l2j.gameserver.model.actor.instance.L2GrandBossInstance;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
 import net.sf.l2j.gameserver.model.zone.type.L2BossZone;
 import net.sf.l2j.gameserver.templates.StatsSet;
 import net.sf.l2j.util.L2FastList;
@@ -78,7 +79,7 @@ public class GrandBossManager
 
 	private static final String UPDATE_GRAND_BOSS_DATA2 = "UPDATE grandboss_data set status = ? where boss_id = ?";
 	
-	private static Logger _log = Logger.getLogger(GrandBossManager.class.getName());
+	protected static Logger _log = Logger.getLogger(GrandBossManager.class.getName());
 
 	private static GrandBossManager _instance;
 
@@ -90,7 +91,7 @@ public class GrandBossManager
 
 	private L2FastList<L2BossZone> _zones;
 
-	public static final GrandBossManager getInstance()
+	public static GrandBossManager getInstance()
 	{
 		if (_instance == null)
 		{
@@ -285,6 +286,16 @@ public class GrandBossManager
 		return temp.getZoneName().equalsIgnoreCase(zoneType);
 	}
 
+	public boolean checkIfInZone(L2PcInstance player)
+	{
+		if (player == null) return false;
+		L2BossZone temp = getZone(player.getX(), player.getY(), player.getZ());
+		if (temp == null)
+		{
+			return false;
+		}
+		return true;
+	}
 	/*
 	 * The rest
 	 */
@@ -425,5 +436,4 @@ public class GrandBossManager
 		 _bossStatus.clear();
 		 _zones.clear();
 	}
-
 }

+ 270 - 0
L2_GameServer/java/net/sf/l2j/gameserver/instancemanager/RaidBossPointsManager.java

@@ -0,0 +1,270 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package net.sf.l2j.gameserver.instancemanager;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Map;
+import java.util.Vector;
+import java.util.Map.Entry;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javolution.util.FastList;
+import javolution.util.FastMap;
+import net.sf.l2j.L2DatabaseFactory;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+  * @author Kerberos
+  */
+
+public class RaidBossPointsManager
+{
+	private final static Logger _log = Logger.getLogger(RaidBossPointsManager.class.getName());
+	protected static FastMap<Integer, Map<Integer, Integer>> _points;
+	protected static FastMap<Integer, Map<Integer, Integer>> _list;
+
+	public final static void init()
+	{
+		_list = new FastMap<Integer, Map<Integer, Integer>>();
+		FastList<Integer> _chars = new FastList<Integer>();
+		java.sql.Connection con = null;
+		try
+		{
+			con = L2DatabaseFactory.getInstance().getConnection();
+			PreparedStatement statement = con.prepareStatement("SELECT * FROM `character_raidpoints`");
+			ResultSet rset = statement.executeQuery();
+			while(rset.next())
+			{
+				_chars.add(rset.getInt("charId"));
+			}
+			rset.close();
+			statement.close();
+			for(FastList.Node<Integer> n = _chars.head(), end = _chars.tail(); (n = n.getNext()) != end;)
+			{
+				int charId = n.getValue();
+				FastMap<Integer, Integer> values = new FastMap<Integer, Integer>();
+				statement = con.prepareStatement("SELECT * FROM `character_raidpoints` WHERE `charId`=?");
+				statement.setInt(1, charId);
+				rset = statement.executeQuery();
+				while(rset.next())
+				{
+					values.put(rset.getInt("boss_id"), rset.getInt("points"));
+				}
+				rset.close();
+				statement.close();
+				_list.put(charId, values);
+			}
+		}
+		catch (SQLException e)
+		{
+			_log.warning("RaidPointsManager: Couldnt load raid points ");
+		}
+		catch (Exception e)
+		{
+			_log.warning(e.getMessage());
+		}
+		finally
+		{
+			try
+			{
+				con.close();
+			}
+			catch(Exception e)
+			{
+				_log.warning(e.getMessage());
+			}
+		}
+	}
+	public final static void loadPoints(L2PcInstance player)
+	{
+		if (_points == null)
+			_points = new FastMap<Integer, Map<Integer, Integer>>();
+		java.sql.Connection con = null;
+
+		try
+		{
+			FastMap<Integer, Integer> tmpScore = new FastMap<Integer, Integer>();
+			con = L2DatabaseFactory.getInstance().getConnection();
+			PreparedStatement statement;
+			
+			statement = con.prepareStatement("SELECT boss_id,points FROM character_raid_points WHERE charId=?");
+			statement.setInt(1, player.getObjectId());
+			ResultSet rs = statement.executeQuery();
+			while (rs.next())
+			{
+				int raidId = rs.getInt("boss_id");
+				int points = rs.getInt("points");
+				tmpScore.put(raidId, points);
+			}
+			rs.close();
+			statement.close();
+			_points.put(player.getObjectId(), tmpScore);
+
+		}
+		catch (SQLException e)
+		{
+			_log.warning("RaidPointsManager: Couldnt load raid points for character :" +player.getName());
+		}
+		catch (Exception e)
+		{
+			_log.warning(e.getMessage());
+		}
+		finally
+		{
+			try
+			{
+				con.close();
+			}
+			catch(Exception e)
+			{
+				_log.warning(e.getMessage());
+			}
+		}
+	}
+
+    public final static void updatePointsInDB(L2PcInstance player, int raidId, int points)
+    {
+        java.sql.Connection con = null;
+        try
+        {
+            con = L2DatabaseFactory.getInstance().getConnection();
+            PreparedStatement statement;
+            statement = con.prepareStatement("REPLACE INTO character_raid_points (`charId`,`boss_id`,`points`) VALUES (?,?,?)");
+            statement.setInt(1, player.getObjectId());
+            statement.setInt(2, raidId);
+            statement.setInt(3, points);
+			statement.executeUpdate();
+            statement.close();
+        } catch (Exception e) {
+			_log.log(Level.WARNING, "could not update char raid points:", e);
+        } finally {
+            try { con.close(); } catch (Exception e) {}
+        }
+	}
+
+    public final static void addPoints(L2PcInstance player, int bossId, int points)
+    {
+    	int ownerId = player.getObjectId();
+    	Map<Integer, Integer> tmpPoint = new FastMap<Integer, Integer>();
+		if (_points == null)
+			_points = new FastMap<Integer, Map<Integer, Integer>>();
+    	tmpPoint = _points.get(ownerId);
+    	if(tmpPoint == null || tmpPoint.isEmpty())
+    	{
+    		tmpPoint = new FastMap<Integer, Integer>();
+    		tmpPoint.put(bossId, points);
+    		updatePointsInDB(player, bossId, points);
+    	}
+    	else
+    	{
+    		int currentPoins = tmpPoint.containsKey(bossId) ? tmpPoint.get(bossId).intValue() : 0;
+    		tmpPoint.remove(bossId);
+    		tmpPoint.put(bossId, currentPoins == 0 ? points : currentPoins + points);
+    		updatePointsInDB(player, bossId, currentPoins == 0 ? points : currentPoins + points);
+    	}
+    	_points.remove(ownerId);
+    	_points.put(ownerId, tmpPoint);
+    	_list.remove(ownerId);
+    	_list.put(ownerId, tmpPoint);
+    }
+
+	public final static int getPointsByOwnerId(int ownerId)
+	{
+		Map<Integer, Integer> tmpPoint = new FastMap<Integer, Integer>();
+		if (_points == null)
+			_points = new FastMap<Integer, Map<Integer, Integer>>();
+		tmpPoint = _points.get(ownerId);
+		int totalPoints = 0;
+		
+		for(int bossId : tmpPoint.keySet())
+		{
+			totalPoints += tmpPoint.get(bossId);
+		}
+		return totalPoints;
+	}
+
+	public final static Map<Integer, Integer> getList(L2PcInstance player)
+	{
+		return _list.get(player.getObjectId());
+	}
+
+	public final static void cleanUp()
+	{
+		java.sql.Connection con = null;
+        try
+        {
+            con = L2DatabaseFactory.getInstance().getConnection();
+            PreparedStatement statement;
+            statement = con.prepareStatement("DELETE from character_raid_points WHERE charId > 0");
+			statement.executeUpdate();
+            statement.close();
+            _points.clear();
+            _points = new FastMap<Integer, Map<Integer, Integer>>();
+            _list.clear();
+            _list = new FastMap<Integer, Map<Integer, Integer>>();
+        } catch (Exception e) {
+			_log.log(Level.WARNING, "could not clean raid points: ", e);
+        } finally {
+            try { con.close(); } catch (Exception e) {}
+        }
+	}
+
+	public final static int calculateRanking(L2PcInstance player)
+	{
+		Map<Integer, Integer> tmpRanking = new FastMap<Integer, Integer>();
+		Map<Integer, Map<Integer, Integer>> tmpPoints = new FastMap<Integer, Map<Integer, Integer>>();
+		int totalPoints;
+		
+		for(int ownerId : _list.keySet())
+		{
+			totalPoints = getPointsByOwnerId(ownerId);
+			if(totalPoints != 0)
+			{
+				tmpRanking.put(ownerId, totalPoints);
+			}
+		}
+		Vector<Entry<Integer, Integer>> list = new Vector<Map.Entry<Integer, Integer>>(tmpRanking.entrySet());
+		
+		Collections.sort(list, new Comparator<Map.Entry<Integer, Integer>>(){
+			public int compare(Map.Entry<Integer, Integer> entry, Map.Entry<Integer, Integer> entry1)
+			{
+				return entry.getValue().equals(entry1.getValue()) ? 0 : entry.getValue() < entry1.getValue() ? 1 : -1;
+			}
+		});
+
+		int ranking = 0;
+		for(Map.Entry<Integer, Integer> entry : list)
+		{
+			Map<Integer, Integer> tmpPoint = new FastMap<Integer, Integer>();
+			tmpPoint = tmpPoints.get(entry.getKey());
+			
+			tmpPoint.remove(-1);
+			tmpPoint.put(-1, ranking);
+			
+			tmpPoints.remove(entry.getKey());
+			tmpPoints.put(entry.getKey(), tmpPoint);
+			ranking++;
+		}
+		Map<Integer, Integer> rank = tmpPoints.get(player.getObjectId());
+		if (rank != null)
+			return rank.get(-1);
+		return 0;
+	}
+}

+ 115 - 83
L2_GameServer/java/net/sf/l2j/gameserver/datatables/ZoneData.java → L2_GameServer/java/net/sf/l2j/gameserver/instancemanager/ZoneManager.java

@@ -12,8 +12,8 @@
  * 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 net.sf.l2j.gameserver.datatables;
+
+package net.sf.l2j.gameserver.instancemanager;
 
 import java.io.File;
 import java.sql.PreparedStatement;
@@ -26,11 +26,6 @@ import javax.xml.parsers.DocumentBuilderFactory;
 import javolution.util.FastList;
 import net.sf.l2j.Config;
 import net.sf.l2j.L2DatabaseFactory;
-import net.sf.l2j.gameserver.instancemanager.ArenaManager;
-import net.sf.l2j.gameserver.instancemanager.FishingZoneManager;
-import net.sf.l2j.gameserver.instancemanager.GrandBossManager;
-import net.sf.l2j.gameserver.instancemanager.OlympiadStadiaManager;
-import net.sf.l2j.gameserver.instancemanager.TownManager;
 import net.sf.l2j.gameserver.model.L2World;
 import net.sf.l2j.gameserver.model.L2WorldRegion;
 import net.sf.l2j.gameserver.model.zone.L2ZoneType;
@@ -62,22 +57,23 @@ import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
 
 /**
- * This class manages the augmentation data and can also create new augmentations.
- *
- * @author  durgus
+ * This class manages the augmentation data and can also create new
+ * augmentations.
+ * 
+ * @author durgus
  */
-public class ZoneData
+public class ZoneManager
 {
-	private static final Logger _log = Logger.getLogger(ZoneData.class.getName());
+	private static final Logger _log = Logger.getLogger(ZoneManager.class.getName());
 
 	// =========================================================
-	private static ZoneData _instance;
+	private static ZoneManager _instance;
 
-	public static final ZoneData getInstance()
+	public static final ZoneManager getInstance()
 	{
 		if (_instance == null)
 		{
-			_instance = new ZoneData();
+			_instance = new ZoneManager();
 		}
 		return _instance;
 	}
@@ -87,19 +83,37 @@ public class ZoneData
 
 	// =========================================================
 	// Constructor
-	public ZoneData()
+	public ZoneManager()
 	{
-		_log.info("Loading zones...");
-
 		load();
 	}
 
+	public void reload()
+	{
+		// int zoneCount = 0;
+		
+		// Get the world regions
+		int count = 0;
+		L2WorldRegion[][] worldRegions = L2World.getInstance().getAllWorldRegions();
+		for (int x = 0; x < worldRegions.length; x++)
+		{
+			for (int y = 0; y < worldRegions[x].length; y++)
+			{
+				worldRegions[x][y].getZones().clear();
+				count++;
+			}
+		}
+		_log.info("Removed zones in "+ count+ " regions.");
+		// Load the zones
+		load();
+	}
 
 	// =========================================================
 	// Method - Private
 
 	private final void load()
 	{
+		_log.info("Loading zones...");
 		java.sql.Connection con = null;
 		int zoneCount = 0;
 
@@ -116,7 +130,7 @@ public class ZoneData
 			factory.setValidating(false);
 			factory.setIgnoringComments(true);
 
-			File file = new File(Config.DATAPACK_ROOT+"/data/zones/zone.xml");
+			File file = new File(Config.DATAPACK_ROOT + "/data/zones/zone.xml");
 			if (!file.exists())
 			{
 				if (Config.DEBUG)
@@ -126,11 +140,11 @@ public class ZoneData
 
 			Document doc = factory.newDocumentBuilder().parse(file);
 
-			for (Node n=doc.getFirstChild(); n != null; n = n.getNextSibling())
+			for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
 			{
 				if ("list".equalsIgnoreCase(n.getNodeName()))
 				{
-					for (Node d=n.getFirstChild(); d != null; d = d.getNextSibling())
+					for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
 					{
 						if ("zone".equalsIgnoreCase(d.getNodeName()))
 						{
@@ -141,13 +155,14 @@ public class ZoneData
 							String zoneType = attrs.getNamedItem("type").getNodeValue();
 							String zoneShape = attrs.getNamedItem("shape").getNodeValue();
 
+
 							// Create the zone
 							L2ZoneType temp = null;
 
 							if (zoneType.equals("FishingZone"))
-								 temp = new L2FishingZone(zoneId);
+								temp = new L2FishingZone(zoneId);
 							else if (zoneType.equals("ClanHallZone"))
-								 temp = new L2ClanHallZone(zoneId);
+								temp = new L2ClanHallZone(zoneId);
 							else if (zoneType.equals("PeaceZone"))
 								temp = new L2PeaceZone(zoneId);
 							else if (zoneType.equals("Town"))
@@ -156,10 +171,10 @@ public class ZoneData
 								temp = new L2OlympiadStadiumZone(zoneId);
 							else if (zoneType.equals("CastleZone"))
 								temp = new L2CastleZone(zoneId);
-                            else if (zoneType.equals("CastleTeleportZone"))
-                                temp = new L2CastleTeleportZone(zoneId);
-			                else if (zoneType.equals("FortZone"))
-			                    temp = new L2FortZone(zoneId);              
+							else if (zoneType.equals("CastleTeleportZone"))
+								temp = new L2CastleTeleportZone(zoneId);
+							else if (zoneType.equals("FortZone"))
+								temp = new L2FortZone(zoneId);
 							else if (zoneType.equals("DamageZone"))
 								temp = new L2DamageZone(zoneId);
 							else if (zoneType.equals("PoisonZone"))
@@ -178,16 +193,16 @@ public class ZoneData
 								temp = new L2JailZone(zoneId);
 							else if (zoneType.equals("DerbyTrackZone"))
 								temp = new L2DerbyTrackZone(zoneId);
-                            else if (zoneType.equals("BossZone"))
-                                temp = new L2BossZone(zoneId);
-                            else if (zoneType.equals("WaterZone"))
-                                temp = new L2WaterZone(zoneId);
-
+							else if (zoneType.equals("BossZone"))
+								temp = new L2BossZone(zoneId);
+							else if (zoneType.equals("WaterZone"))
+								temp = new L2WaterZone(zoneId);
 
 							// Check for unknown type
 							if (temp == null)
 							{
-								_log.warning("ZoneData: No such zone type: "+zoneType);
+								_log.warning("ZoneData: No such zone type: "
+								        + zoneType);
 								continue;
 							}
 
@@ -202,24 +217,28 @@ public class ZoneData
 								statement.setInt(1, zoneId);
 								ResultSet rset = statement.executeQuery();
 
-								// Create this zone.  Parsing for cuboids is a bit different than for other polygons
-								// cuboids need exactly 2 points to be defined.  Other polygons need at least 3 (one per vertex)
+								// Create this zone. Parsing for cuboids is a
+								// bit different than for other polygons
+								// cuboids need exactly 2 points to be defined.
+								// Other polygons need at least 3 (one per
+								// vertex)
 								if (zoneShape.equalsIgnoreCase("Cuboid"))
 								{
-									int[] x = {0,0};
-									int[] y = {0,0};
+									int[] x = { 0, 0 };
+									int[] y = { 0, 0 };
 									boolean successfulLoad = true;
-									
-									for (int i=0;i<2; i++)
+
+									for (int i = 0; i < 2; i++)
 									{
-										if ( rset.next() )
+										if (rset.next())
 										{
 											x[i] = rset.getInt("x");
 											y[i] = rset.getInt("y");
 										}
 										else
 										{
-											_log.warning("ZoneData: Missing cuboid vertex in sql data for zone: "+zoneId);
+											_log.warning("ZoneData: Missing cuboid vertex in sql data for zone: "
+											        + zoneId);
 											rset.close();
 											statement.close();
 											successfulLoad = false;
@@ -228,7 +247,7 @@ public class ZoneData
 									}
 
 									if (successfulLoad)
-										temp.setZone(new ZoneCuboid(x[0],x[1], y[0],y[1],minZ,maxZ));
+										temp.setZone(new ZoneCuboid(x[0], x[1], y[0], y[1], minZ, maxZ));
 									else
 										continue;
 								}
@@ -243,22 +262,30 @@ public class ZoneData
 										fl_y.add(rset.getInt("y"));
 									}
 
-									// An nPoly needs to have at least 3 vertices
-									if ((fl_x.size() == fl_y.size()) && (fl_x.size() > 2))
+									// An nPoly needs to have at least 3
+									// vertices
+									if ((fl_x.size() == fl_y.size())
+									        && (fl_x.size() > 2))
 									{
 										// Create arrays
 										int[] aX = new int[fl_x.size()];
 										int[] aY = new int[fl_y.size()];
-	
-										// This runs only at server startup so dont complain :>
-										for (int i=0; i < fl_x.size(); i++) { aX[i] = fl_x.get(i); aY[i] = fl_y.get(i); }
-	
+
+										// This runs only at server startup so
+										// dont complain :>
+										for (int i = 0; i < fl_x.size(); i++)
+										{
+											aX[i] = fl_x.get(i);
+											aY[i] = fl_y.get(i);
+										}
+
 										// Create the zone
 										temp.setZone(new ZoneNPoly(aX, aY, minZ, maxZ));
 									}
 									else
 									{
-										_log.warning("ZoneData: Bad sql data for zone: "+zoneId);
+										_log.warning("ZoneData: Bad sql data for zone: "
+										        + zoneId);
 										rset.close();
 										statement.close();
 										continue;
@@ -273,13 +300,14 @@ public class ZoneData
 									{
 										int zoneX = rset.getInt("x");
 										int zoneY = rset.getInt("y");
-										
+
 										// create the zone
 										temp.setZone(new ZoneCylinder(zoneX, zoneY, minZ, maxZ, zoneRad));
 									}
 									else
 									{
-										_log.warning("ZoneData: Bad sql data for zone: "+zoneId);
+										_log.warning("ZoneData: Bad sql data for zone: "
+										        + zoneId);
 										rset.close();
 										statement.close();
 										continue;
@@ -287,62 +315,66 @@ public class ZoneData
 								}
 								else
 								{
-									_log.warning("ZoneData: Unknown shape: "+zoneShape);
+									_log.warning("ZoneData: Unknown shape: "
+									        + zoneShape);
 									rset.close();
 									statement.close();
 									continue;
 								}
-
+								
 								rset.close();
 								statement.close();
 							}
 							catch (Exception e)
 							{
-								_log.warning("ZoneData: Failed to load zone coordinates: " + e);
+								_log.warning("ZoneData: Failed to load zone coordinates: "
+								        + e);
 							}
 
-
 							// Check for aditional parameters
-							for (Node cd=d.getFirstChild(); cd != null; cd = cd.getNextSibling())
+							for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling())
 							{
 								if ("stat".equalsIgnoreCase(cd.getNodeName()))
 								{
 									attrs = cd.getAttributes();
 									String name = attrs.getNamedItem("name").getNodeValue();
-                            		String val = attrs.getNamedItem("val").getNodeValue();
-
-                            		temp.setParameter(name, val);
+									String val = attrs.getNamedItem("val").getNodeValue();
+									
+									temp.setParameter(name, val);
 								}
 							}
 
-							// Skip checks for fishing zones & add to fishing zone manager
+							// Skip checks for fishing zones & add to fishing
+							// zone manager
 							if (temp instanceof L2FishingZone)
 							{
-								FishingZoneManager.getInstance().addFishingZone((L2FishingZone)temp);
+								FishingZoneManager.getInstance().addFishingZone((L2FishingZone) temp);
 								continue;
 							}
-
 							if (temp instanceof L2WaterZone)
 							{
-								FishingZoneManager.getInstance().addWaterZone((L2WaterZone)temp);
+								FishingZoneManager.getInstance().addWaterZone((L2WaterZone) temp);
 							}
-							// Register the zone into any world region it intersects with...
+							// Register the zone into any world region it
+							// intersects with...
 							// currently 11136 test for each zone :>
-							int ax,ay,bx,by;
-							for (int x=0; x < worldRegions.length; x++)
+							int ax, ay, bx, by;
+							for (int x = 0; x < worldRegions.length; x++)
 							{
-								for (int y=0; y < worldRegions[x].length; y++)
+								for (int y = 0; y < worldRegions[x].length; y++)
 								{
-									ax = (x-L2World.OFFSET_X) << L2World.SHIFT_BY;
-									bx = ((x+1)-L2World.OFFSET_X) << L2World.SHIFT_BY;
-									ay = (y-L2World.OFFSET_Y) << L2World.SHIFT_BY;
-									by = ((y+1)-L2World.OFFSET_Y) << L2World.SHIFT_BY;
-
+									ax = (x - L2World.OFFSET_X) << L2World.SHIFT_BY;
+									bx = ((x + 1) - L2World.OFFSET_X) << L2World.SHIFT_BY;
+									ay = (y - L2World.OFFSET_Y) << L2World.SHIFT_BY;
+									by = ((y + 1) - L2World.OFFSET_Y) << L2World.SHIFT_BY;
+									
 									if (temp.getZone().intersectsRectangle(ax, bx, ay, by))
 									{
 										if (Config.DEBUG)
 										{
-											_log.info("Zone ("+zoneId+") added to: "+x+" "+y);
+											_log.info("Zone (" + zoneId
+											        + ") added to: " + x + " "
+											        + y);
 										}
 										worldRegions[x][y].addZone(temp);
 									}
@@ -351,13 +383,13 @@ public class ZoneData
 
 							// Special managers for arenas, towns...
 							if (temp instanceof L2ArenaZone)
-								ArenaManager.getInstance().addArena((L2ArenaZone)temp);
+								ArenaManager.getInstance().addArena((L2ArenaZone) temp);
 							else if (temp instanceof L2TownZone)
-								TownManager.getInstance().addTown((L2TownZone)temp);
+								TownManager.getInstance().addTown((L2TownZone) temp);
 							else if (temp instanceof L2OlympiadStadiumZone)
-								OlympiadStadiaManager.getInstance().addStadium((L2OlympiadStadiumZone)temp);
-						    else if (temp instanceof L2BossZone)
-						        GrandBossManager.getInstance().addZone((L2BossZone) temp);
+								OlympiadStadiaManager.getInstance().addStadium((L2OlympiadStadiumZone) temp);
+							else if (temp instanceof L2BossZone)
+								GrandBossManager.getInstance().addZone((L2BossZone) temp);
 
 							// Increase the counter
 							zoneCount++;
@@ -369,7 +401,7 @@ public class ZoneData
 		catch (Exception e)
 		{
 			_log.log(Level.SEVERE, "Error while loading zones.", e);
-			return ;
+			return;
 		}
 		finally
 		{
@@ -381,9 +413,9 @@ public class ZoneData
 			{
 			}
 		}
-        
-        GrandBossManager.getInstance().initZones();
 
-		_log.info("Done: loaded "+zoneCount+" zones.");
+		GrandBossManager.getInstance().initZones();
+		
+		_log.info("Done: loaded " + zoneCount + " zones.");
 	}
-}
+}

+ 2 - 2
L2_GameServer/java/net/sf/l2j/gameserver/model/ClanWarehouse.java

@@ -36,8 +36,8 @@ public final class ClanWarehouse extends Warehouse
 	@Override
 	public ItemLocation getBaseLocation() { return ItemLocation.CLANWH; }
 	public String getLocationId() { return "0"; }
-    public int getLocationId(@SuppressWarnings("unused") boolean dummy) { return 0; }
-    public void setLocationId(@SuppressWarnings("unused") L2PcInstance dummy) { }
+    public int getLocationId(boolean dummy) { return 0; }
+    public void setLocationId(L2PcInstance dummy) { }
 	@Override
 	public boolean validateCapacity(int slots)
 	{

+ 0 - 2
L2_GameServer/java/net/sf/l2j/gameserver/model/Inventory.java

@@ -143,7 +143,6 @@ public abstract class Inventory extends ItemContainer
     	/**
     	 * Add alteration in inventory when item equiped
     	 */
-        @SuppressWarnings("unused")
     	public void notifyEquiped(int slot, L2ItemInstance item) {
     		if (!_changed.contains(item))
     			_changed.add(item);
@@ -152,7 +151,6 @@ public abstract class Inventory extends ItemContainer
     	/**
     	 * Add alteration in inventory when item unequiped
     	 */
-        @SuppressWarnings("unused")
     	public void notifyUnequiped(int slot, L2ItemInstance item) {
     		if (!_changed.contains(item))
     			_changed.add(item);

+ 12 - 10
L2_GameServer/java/net/sf/l2j/gameserver/datatables/AccessLevel.java → L2_GameServer/java/net/sf/l2j/gameserver/model/L2AccessLevel.java

@@ -12,23 +12,25 @@
  * 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 net.sf.l2j.gameserver.datatables;
+package net.sf.l2j.gameserver.model;
 
 import java.util.logging.Logger;
 
+import net.sf.l2j.gameserver.datatables.AccessLevels;
+
 /**
  * @author FBIagent<br>
  */
-public class AccessLevel
+public class L2AccessLevel
 {
 	/** The logger<br> */
-	private static Logger _log = Logger.getLogger( AccessLevel.class.getName() );
+	private static Logger _log = Logger.getLogger( L2AccessLevel.class.getName() );
 	/** The access level<br> */
 	private int _accessLevel = 0;
 	/** The access level name<br> */
 	private String _name = null;
 	/** Child access levels */
-	AccessLevel[] _childsAccessLevel = null;
+	L2AccessLevel[] _childsAccessLevel = null;
 	/** Child access levels */
 	private String _childs = null;
 	/** The name color for the access level<br> */
@@ -69,7 +71,7 @@ public class AccessLevel
 	 * @param takeAggro as boolean<br>
 	 * @param gainExp as boolean<br>
 	 */
-	public AccessLevel(int accessLevel, String name, int nameColor, int titleColor, String childs, boolean isGm,
+	public L2AccessLevel(int accessLevel, String name, int nameColor, int titleColor, String childs, boolean isGm,
 			boolean allowPeaceAttack, boolean allowFixedRes, boolean allowTransaction, boolean allowAltG, boolean giveDamage, boolean takeAggro, boolean gainExp)
 	{
 		_accessLevel = accessLevel;
@@ -216,7 +218,7 @@ public class AccessLevel
 	 * 
 	 * @return boolean: true if a child access level is equals to allowedAccess, otherwise false<br>
 	 */
-	public boolean hasChildAccess(AccessLevel accessLevel)
+	public boolean hasChildAccess(L2AccessLevel accessLevel)
 	{
 		if (_childsAccessLevel == null)
 		{
@@ -224,7 +226,7 @@ public class AccessLevel
 				return false;
 			
 			setChildAccess(_childs);
-			for (AccessLevel childAccess : _childsAccessLevel)
+			for (L2AccessLevel childAccess : _childsAccessLevel)
 			{
 				if (childAccess != null && (childAccess.getLevel() == accessLevel.getLevel() || childAccess.hasChildAccess(accessLevel)))
 					return true;
@@ -232,7 +234,7 @@ public class AccessLevel
 		}
 		else
 		{
-			for (AccessLevel childAccess : _childsAccessLevel)
+			for (L2AccessLevel childAccess : _childsAccessLevel)
 			{
 				if (childAccess != null && (childAccess.getLevel() == accessLevel.getLevel() || childAccess.hasChildAccess(accessLevel)))
 					return true;
@@ -245,11 +247,11 @@ public class AccessLevel
 	{
 		String[] childsSplit = childs.split(";");
 
-		_childsAccessLevel = new AccessLevel[childsSplit.length];
+		_childsAccessLevel = new L2AccessLevel[childsSplit.length];
 
 		for (int i = 0;i < childsSplit.length;++ i)
 		{
-			AccessLevel accessLevelInst = AccessLevels.getInstance().getAccessLevel(Integer.valueOf(childsSplit[i]));
+			L2AccessLevel accessLevelInst = AccessLevels.getInstance().getAccessLevel(Integer.valueOf(childsSplit[i]));
 
 			if (accessLevelInst == null)
 			{

+ 10 - 8
L2_GameServer/java/net/sf/l2j/gameserver/datatables/AdminCommandAccessRights.java → L2_GameServer/java/net/sf/l2j/gameserver/model/L2AdminCommandAccessRights.java

@@ -12,7 +12,7 @@
  * 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 net.sf.l2j.gameserver.datatables;
+package net.sf.l2j.gameserver.model;
 
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -22,16 +22,18 @@ import java.util.logging.Logger;
 
 import javolution.util.FastMap;
 import net.sf.l2j.L2DatabaseFactory;
+import net.sf.l2j.gameserver.datatables.AccessLevels;
+import net.sf.l2j.gameserver.datatables.AdminCommandAccessRight;
 
 /**
  * @author FBIagent<br>
  */
-public class AdminCommandAccessRights
+public class L2AdminCommandAccessRights
 {
 	/** The logger<br> */
-	private static Logger _log = Logger.getLogger(AdminCommandAccessRights.class.getName());
+	private static Logger _log = Logger.getLogger(L2AdminCommandAccessRights.class.getName());
 	/** The one and only instance of this class, retriveable by getInstance()<br> */
-	private static AdminCommandAccessRights _instance = null;
+	private static L2AdminCommandAccessRights _instance = null;
 
 	/** The access rights<br> */
 	private Map< String, AdminCommandAccessRight > _adminCommandAccessRights = new FastMap< String, AdminCommandAccessRight >();
@@ -39,7 +41,7 @@ public class AdminCommandAccessRights
 	/**
 	 * Loads admin command access rights from database<br>
 	 */
-	private AdminCommandAccessRights()
+	private L2AdminCommandAccessRights()
 	{
 		java.sql.Connection con = null;
 		
@@ -84,12 +86,12 @@ public class AdminCommandAccessRights
 	 * 
 	 * @return AdminCommandAccessRights: the one and only instance of this class<br>
 	 */
-	public static AdminCommandAccessRights getInstance()
+	public static L2AdminCommandAccessRights getInstance()
 	{
-		return _instance == null ? (_instance = new AdminCommandAccessRights()) : _instance;
+		return _instance == null ? (_instance = new L2AdminCommandAccessRights()) : _instance;
 	}
 
-	public boolean hasAccess(String adminCommand, AccessLevel accessLevel)
+	public boolean hasAccess(String adminCommand, L2AccessLevel accessLevel)
 	{
 		if (!accessLevel.isGm())
 			return false;

+ 30 - 35
L2_GameServer/java/net/sf/l2j/gameserver/model/L2Attackable.java

@@ -23,7 +23,6 @@ import javolution.util.FastMap;
 import net.sf.l2j.Config;
 import net.sf.l2j.gameserver.ItemsAutoDestroy;
 import net.sf.l2j.gameserver.ThreadPoolManager;
-import net.sf.l2j.gameserver.ai.CtrlEvent;
 import net.sf.l2j.gameserver.ai.CtrlIntention;
 import net.sf.l2j.gameserver.ai.L2AttackableAI;
 import net.sf.l2j.gameserver.ai.L2CharacterAI;
@@ -33,6 +32,8 @@ import net.sf.l2j.gameserver.datatables.ItemTable;
 import net.sf.l2j.gameserver.datatables.SkillTable;
 import net.sf.l2j.gameserver.datatables.EventDroplist.DateDrop;
 import net.sf.l2j.gameserver.instancemanager.CursedWeaponsManager;
+import net.sf.l2j.gameserver.model.L2Summon;
+import net.sf.l2j.gameserver.model.L2Attackable.OnKillNotifyTask;
 import net.sf.l2j.gameserver.model.actor.instance.L2DoorInstance;
 import net.sf.l2j.gameserver.model.actor.instance.L2FolkInstance;
 import net.sf.l2j.gameserver.model.actor.instance.L2GrandBossInstance;
@@ -816,7 +817,21 @@ public class L2Attackable extends L2NpcInstance
      */
     public void addDamage(L2Character attacker, int damage)
     {
-        addDamageHate(attacker, damage, damage);
+        // Notify the L2Attackable AI with EVT_ATTACKED
+        if (damage > 0)
+        {
+            try {
+                if (attacker instanceof L2PcInstance || attacker instanceof L2Summon)
+                {
+                    L2PcInstance player = attacker instanceof L2PcInstance ? (L2PcInstance)attacker : ((L2Summon)attacker).getOwner();
+
+                    if (getTemplate().getEventQuests(Quest.QuestEventType.ON_ATTACK) !=null)
+                    	for (Quest quest: getTemplate().getEventQuests(Quest.QuestEventType.ON_ATTACK))
+                    		quest.notifyAttack(this, player, damage, attacker instanceof L2Summon);
+                }
+            }
+            catch (Exception e) { _log.log(Level.SEVERE, "", e); }
+        }
     }
 
     /**
@@ -829,8 +844,6 @@ public class L2Attackable extends L2NpcInstance
      */
     public void addDamageHate(L2Character attacker, int damage, int aggro)
     {
-    	// TODO: Agro calculation ought to be removed from here and placed within 
-    	// onAttack and onSkillSee in the AI Script (Fulminus)
         if (attacker == null /*|| _aggroList == null*/) return;
 
         // Get the AggroInfo of the attacker L2Character from the _aggroList of the L2Attackable
@@ -843,40 +856,12 @@ public class L2Attackable extends L2NpcInstance
             getAggroListRP().put(attacker, ai);
         }
 
-        // If aggro is negative, its comming from SEE_SPELL, buffs use constant 150
-        if (aggro < 0) {
-        	ai._hate -= (aggro*150)/(getLevel()+7);
-        	aggro = -aggro;
-        }
-        // if damage == 0 -> this is case of adding only to aggro list, dont apply formula on it
-        else if (damage == 0) ai._hate += aggro;
-        // else its damage that must be added using constant 100
-        else ai._hate += (aggro*100)/(getLevel()+7);
-
-        // Add new damage and aggro (=damage) to the AggroInfo object
+        ai._hate += aggro;
         ai._damage += damage;
 
         // Set the intention to the L2Attackable to AI_INTENTION_ACTIVE
         if (aggro > 0 && getAI().getIntention() == CtrlIntention.AI_INTENTION_IDLE)
         	getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
-
-        // Notify the L2Attackable AI with EVT_ATTACKED
-        if (damage > 0)
-        {
-        	getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, attacker);
-
-            try {
-                if (attacker instanceof L2PcInstance || attacker instanceof L2Summon)
-                {
-                    L2PcInstance player = attacker instanceof L2PcInstance ? (L2PcInstance)attacker : ((L2Summon)attacker).getOwner();
-
-                    if (getTemplate().getEventQuests(Quest.QuestEventType.ON_ATTACK) !=null)
-                    	for (Quest quest: getTemplate().getEventQuests(Quest.QuestEventType.ON_ATTACK))
-                    		quest.notifyAttack(this, player, damage, attacker instanceof L2Summon);
-                }
-            }
-            catch (Exception e) { _log.log(Level.SEVERE, "", e); }
-        }
     }
 
     public void reduceHate(L2Character target, int amount)
@@ -1436,7 +1421,7 @@ public class L2Attackable extends L2NpcInstance
                  else dropItem(player, item);
                  _spec = true;
              }
-             else for (int i = 0; i < 3; i++)
+             else for (int i = 0; i < 5; i++)
              {
             	 random = Rnd.get(100);
             	 if (random < Config.RATE_DROP_COMMON_HERBS)
@@ -1444,7 +1429,9 @@ public class L2Attackable extends L2NpcInstance
             		 RewardItem item = null;
             		 if (i == 0) item = new RewardItem(8606, 1); // Herb of Power
             		 if (i == 1) item = new RewardItem(8608, 1); // Herb of Atk. Spd.
-            		 if (i == 2) item = new RewardItem(8610, 1); // Herb of Critical Attack
+            		 if (i == 2) item = new RewardItem(8610, 1); // Herb of Critical Attack - Rate
+            		 if (i == 3) item = new RewardItem(10655, 1); // Herb of Life Force Absorption
+            		 if (i == 4) item = new RewardItem(10656, 1); // Herb of Critical Attack - Power
 
             		 if (Config.AUTO_LOOT && Config.AUTO_LOOT_HERBS) player.addItem("Loot", item.getItemId(), item.getCount(), this, true);
             		 else dropItem(player, item);
@@ -1561,6 +1548,14 @@ public class L2Attackable extends L2NpcInstance
                  if (Config.AUTO_LOOT && Config.AUTO_LOOT_HERBS) player.addItem("Loot", item.getItemId(), item.getCount(), this, true);
                  else dropItem(player, item);
              }
+             // Enlarge Head type
+             random = Rnd.get(100);
+             if (random < Config.RATE_DROP_COMMON_HERBS)
+             {
+                 RewardItem item = new RewardItem(10657, 1);  // Herb of Doubt
+                 if (Config.AUTO_LOOT && Config.AUTO_LOOT_HERBS) player.addItem("Loot", item.getItemId(), item.getCount(), this, true);
+                 else dropItem(player, item);
+             }
          }
      }
 

+ 27 - 44
L2_GameServer/java/net/sf/l2j/gameserver/model/L2Character.java

@@ -14,7 +14,6 @@
  */
 package net.sf.l2j.gameserver.model;
 
-import static net.sf.l2j.gameserver.ai.CtrlIntention.AI_INTENTION_ATTACK;
 import static net.sf.l2j.gameserver.ai.CtrlIntention.AI_INTENTION_FOLLOW;
 
 import java.util.Collection;
@@ -163,6 +162,7 @@ public abstract class L2Character extends L2Object
 	private boolean _isSleeping                             = false; // Cannot move/attack until sleep timed out or monster is attacked
 	private boolean _isStunned                              = false; // Cannot move/attack until stun timed out
 	private boolean _isBetrayed                             = false; // Betrayed by own summon
+	protected boolean _showSummonAnimation                    = false;
 	protected boolean _isTeleporting                        = false;
 	private L2Character _lastBuffer							= null;
 	protected boolean _isInvul                              = false;
@@ -200,7 +200,7 @@ public abstract class L2Character extends L2Object
 	public static final byte ZONE_MONSTERTRACK = 9;
 	public static final byte ZONE_CASTLE = 10;
 	public static final byte ZONE_SWAMP = 11;
-
+	
 	private final byte[] _zones = new byte[12];
 	
 	/**
@@ -524,7 +524,7 @@ public abstract class L2Character extends L2Object
 	 * <B><U> Overridden in </U> :</B><BR><BR>
 	 * <li> L2PcInstance</li><BR><BR>
 	 */
-	public void sendPacket(@SuppressWarnings("unused") L2GameServerPacket mov)
+	public void sendPacket(L2GameServerPacket mov)
 	{
 		// default implementation
 	}
@@ -535,7 +535,7 @@ public abstract class L2Character extends L2Object
 	 * <B><U> Overridden in </U> :</B><BR><BR>
 	 * <li> L2PcInstance</li><BR><BR>
 	 */
-	public void sendMessage(@SuppressWarnings("unused") String text)
+	public void sendMessage(String text)
 	{
 		// default implementation
 	}
@@ -1724,11 +1724,11 @@ public abstract class L2Character extends L2Object
 			}
 
             // Consume Souls if necessary
-            if (skill.getSoulConsumeCount() > 0)
+            if (skill.getSoulConsumeCount() > 0 || skill.getMaxSoulConsumeCount() > 0)
             {
                 if (this instanceof L2PcInstance)
                 {
-                    ((L2PcInstance)this).decreaseSouls(skill.getSoulConsumeCount());
+                    ((L2PcInstance)this).decreaseSouls(skill.getSoulConsumeCount(),skill);
                     sendPacket(new EtcStatusUpdate((L2PcInstance)this));
                 }
             }
@@ -3976,6 +3976,21 @@ public abstract class L2Character extends L2Object
 		if (Config.MOVE_BASED_KNOWNLIST && updateKnownObjects) this.getKnownList().findObjects();
 	}
 
+	/**
+	 * @return Returns the showSummonAnimation.
+	 */
+	public boolean isShowSummonAnimation()
+	{
+	    return _showSummonAnimation;
+	}
+
+	/**
+	 * @param showSummonAnimation The showSummonAnimation to set.
+	 */
+	public void setShowSummonAnimation(boolean showSummonAnimation)
+	{
+	    _showSummonAnimation = showSummonAnimation;
+	}
 
 	/**
 	 * Target a L2Object (add the target to the L2Character _target, _knownObject and L2Character to _KnownObject of the L2Object).<BR><BR>
@@ -4716,7 +4731,7 @@ public abstract class L2Character extends L2Object
 	 * <li> L2PetInstance</li><BR><BR>
 	 *
 	 */
-	public void addExpAndSp(@SuppressWarnings("unused") long addToExp, @SuppressWarnings("unused") int addToSp)
+	public void addExpAndSp(long addToExp, int addToSp)
 	{
 		// Dummy method (overridden by players and pets)
 	}
@@ -4844,7 +4859,7 @@ public abstract class L2Character extends L2Object
 		           if (100 - Config.ALT_PERFECT_SHLD_BLOCK < Rnd.get(100))
 		           {  
 		                     damage = 1;  
-		                     enemy.sendPacket(new SystemMessage(SystemMessageId.YOUR_EXCELLENT_SHIELD_DEFENSE_WAS_A_SUCCESS));; //SHIELD_DEFENCE faultless 
+		                     enemy.sendPacket(new SystemMessage(SystemMessageId.YOUR_EXCELLENT_SHIELD_DEFENSE_WAS_A_SUCCESS)); //SHIELD_DEFENCE faultless 
 		           }
 		            else
 		              enemy.sendPacket(new SystemMessage(SystemMessageId.SHIELD_DEFENCE_SUCCESSFULL)); 
@@ -5676,11 +5691,11 @@ public abstract class L2Character extends L2Object
 			}
 
             // Consume Souls if necessary
-            if (skill.getSoulConsumeCount() > 0)
+            if (skill.getSoulConsumeCount() > 0 || skill.getMaxSoulConsumeCount() > 0)
             {
                 if (this instanceof L2PcInstance)
                 {
-                    ((L2PcInstance)this).decreaseSouls(skill.getSoulConsumeCount());
+                    ((L2PcInstance)this).decreaseSouls(skill.getSoulConsumeCount(),skill);
                     sendPacket(new EtcStatusUpdate((L2PcInstance)this));
                 }
             }
@@ -5989,30 +6004,6 @@ public abstract class L2Character extends L2Object
 							        && (npcMob.getTemplate().getEventQuests(Quest.QuestEventType.ON_SKILL_SEE) != null))
 								for (Quest quest : npcMob.getTemplate().getEventQuests(Quest.QuestEventType.ON_SKILL_SEE))
 									quest.notifySkillSee(npcMob, player, skill, targets, this instanceof L2Summon);
-							
-							/**
-							 * ************** FULMINUS COMMENT START**************
-							 */
-							if (skill.getAggroPoints() > 0)
-							{
-								if (npcMob.isInsideRadius(player, 1000, true, true)
-								        && npcMob.hasAI()
-								        && npcMob.getAI().getIntention() == AI_INTENTION_ATTACK)
-								{
-									L2Object npcTarget = npcMob.getTarget();
-									for (L2Object target : targets)
-										if (npcTarget == target
-										        || npcMob == target)
-											npcMob.seeSpell(player, target, skill);
-								}
-							}
-							/**
-							 * ************** FULMINUS COMMENT END **************
-							 */
-							// the section within "Fulminus Comment" should be
-							// deleted from core and placed
-							// within the mob's AI Script's onSkillSee, which is
-							// called by quest.notifySkillSee
 						}
 					}
 				}
@@ -6024,14 +6015,6 @@ public abstract class L2Character extends L2Object
 		}
 	}
 	
-	public void seeSpell(L2PcInstance caster, L2Object target, L2Skill skill) 
-	{
-		// TODO: Aggro calculation due to spells ought to be inside the AI script's onSkillSee.
-		// when it is added there, this function will no longer be needed here.  (Fulminus)
-		if (this instanceof L2Attackable)
-			((L2Attackable)this).addDamageHate(caster, 0, -skill.getAggroPoints());
-	}
-	
 	/**
 	 * Return True if the L2Character is behind the target and can't be seen.<BR><BR>
 	 */
@@ -6178,7 +6161,7 @@ public abstract class L2Character extends L2Object
 	/**
 	 * Return a Random Damage in function of the weapon.<BR><BR>
 	 */
-	public final int getRandomDamage(@SuppressWarnings("unused") L2Character target)
+	public final int getRandomDamage(L2Character target)
 	{
 		L2Weapon weaponItem = getActiveWeaponItem();
 
@@ -6361,7 +6344,7 @@ public abstract class L2Character extends L2Object
 	 * <li> L2PetInstance</li><BR><BR>
 	 *
 	 */
-	public void sendDamageMessage(@SuppressWarnings("unused") L2Character target, int damage, boolean mcrit, boolean pcrit, boolean miss)
+	public void sendDamageMessage(L2Character target, int damage, boolean mcrit, boolean pcrit, boolean miss)
 	{
 	}
 

+ 10 - 10
L2_GameServer/java/net/sf/l2j/gameserver/model/L2Clan.java

@@ -2048,9 +2048,9 @@ public class L2Clan
                 {
                     if (player.reduceAdena("ClanLvl", 650000, player.getTarget(), true))
                     {
-	                    player.setSp(player.getSp() - 20000);
+	                    player.setSp(player.getSp() - 30000);
 	                    SystemMessage sp = new SystemMessage(SystemMessageId.SP_DECREASED_S1);
-	                    sp.addNumber(20000);
+	                    sp.addNumber(30000);
 	                    player.sendPacket(sp);
                         sp = null;
 	                    increaseClanLevel = true;
@@ -2065,9 +2065,9 @@ public class L2Clan
                 {
                     if (player.reduceAdena("ClanLvl", 2500000, player.getTarget(), true))
                     {
-	                    player.setSp(player.getSp() - 100000);
+	                    player.setSp(player.getSp() - 150000);
 	                    SystemMessage sp = new SystemMessage(SystemMessageId.SP_DECREASED_S1);
-	                    sp.addNumber(100000);
+	                    sp.addNumber(150000);
 	                    player.sendPacket(sp);
                         sp = null;
 	                    increaseClanLevel = true;
@@ -2083,9 +2083,9 @@ public class L2Clan
                     // itemId 1419 == Blood Mark
                     if (player.destroyItemByItemId("ClanLvl", 1419, 1, player.getTarget(), false))
                     {
-	                    player.setSp(player.getSp() - 350000);
+	                    player.setSp(player.getSp() - 500000);
 	                    SystemMessage sp = new SystemMessage(SystemMessageId.SP_DECREASED_S1);
-	                    sp.addNumber(350000);
+	                    sp.addNumber(500000);
 	                    player.sendPacket(sp);
                         sp = null;
                         SystemMessage sm = new SystemMessage(SystemMessageId.S2_S1_DISAPPEARED);
@@ -2106,9 +2106,9 @@ public class L2Clan
                     // itemId 3874 == Alliance Manifesto
                 	if (player.destroyItemByItemId("ClanLvl", 3874, 1, player.getTarget(), false))
                 	{
-	                    player.setSp(player.getSp() - 1000000);
+	                    player.setSp(player.getSp() - 1400000);
 	                    SystemMessage sp = new SystemMessage(SystemMessageId.SP_DECREASED_S1);
-	                    sp.addNumber(1000000);
+	                    sp.addNumber(1400000);
 	                    player.sendPacket(sp);
                         sp = null;
                         SystemMessage sm = new SystemMessage(SystemMessageId.S2_S1_DISAPPEARED);
@@ -2129,9 +2129,9 @@ public class L2Clan
                     // itemId 3870 == Seal of Aspiration
                 	if (player.destroyItemByItemId("ClanLvl", 3870, 1, player.getTarget(), false))
                 	{
-                		player.setSp(player.getSp() - 2500000);
+                		player.setSp(player.getSp() - 3500000);
 	                    SystemMessage sp = new SystemMessage(SystemMessageId.SP_DECREASED_S1);
-	                    sp.addNumber(2500000);
+	                    sp.addNumber(3500000);
 	                    player.sendPacket(sp);
                         sp = null;
                         SystemMessage sm = new SystemMessage(SystemMessageId.S2_S1_DISAPPEARED);

+ 0 - 1
L2_GameServer/java/net/sf/l2j/gameserver/model/L2EnchantSkillLearn.java

@@ -54,7 +54,6 @@ public final class L2EnchantSkillLearn
         return _baseLvl;
     }
     
-    @SuppressWarnings("unchecked")
     public void addEnchantDetail(EnchantSkillDetail esd)
     {
         int enchantType = L2EnchantSkillLearn.getEnchantType(esd.getLevel());

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/model/L2ItemInstance.java

@@ -898,7 +898,7 @@ public final class L2ItemInstance extends L2Object
 	 * @return boolean false
 	 */
     @Override
-	public boolean isAutoAttackable(@SuppressWarnings("unused") L2Character attacker)
+	public boolean isAutoAttackable(L2Character attacker)
     {
         return false;
     }

+ 8 - 2
L2_GameServer/java/net/sf/l2j/gameserver/model/L2Skill.java

@@ -508,6 +508,7 @@ public abstract class L2Skill
     private final int _triggeredId;
     private final int _triggeredLevel;
 
+    private final int _soulMaxConsume;
     private final int _soulConsume;
     private final int _numSouls;
     private final int _expNeeded;
@@ -640,6 +641,7 @@ public abstract class L2Skill
             _chanceCondition = ChanceCondition.parse(set);
 
         _numSouls = set.getInteger("num_souls", 0);
+        _soulMaxConsume = set.getInteger("soulMaxConsumeCount", 0);
         _soulConsume = set.getInteger("soulConsumeCount", 0);
         _expNeeded = set.getInteger("expNeeded", 0);
         _critChance = set.getInteger("critChance", 0);
@@ -1258,6 +1260,11 @@ public abstract class L2Skill
         return _numSouls;
     }
 
+    public final int getMaxSoulConsumeCount()
+    {
+        return _soulMaxConsume;
+    }
+
     public final int getSoulConsumeCount()
     {
         return _soulConsume;
@@ -2990,8 +2997,7 @@ public abstract class L2Skill
         else return targets[0];
     }
 
-    public final Func[] getStatFuncs(@SuppressWarnings("unused")
-    L2Effect effect, L2Character player)
+    public final Func[] getStatFuncs(L2Effect effect, L2Character player)
     {
         if (!(player instanceof L2PcInstance) && !(player instanceof L2Attackable)
             && !(player instanceof L2Summon)) return _emptyFunctionSet;

+ 9 - 4
L2_GameServer/java/net/sf/l2j/gameserver/model/L2Spawn.java

@@ -391,9 +391,9 @@ public class L2Spawn
 	/**
 	 * Create a L2NpcInstance in this L2Spawn.<BR><BR>
 	 */
-	public L2NpcInstance spawnOne()
+	public L2NpcInstance spawnOne(boolean val)
 	{
-		return doSpawn();
+		return doSpawn(val);
 	}
 
 	/**
@@ -412,6 +412,10 @@ public class L2Spawn
         _doRespawn = true;
     }
 
+    public L2NpcInstance doSpawn()
+    {
+    	return doSpawn(false);
+    }
 	/**
 	 * Create the L2NpcInstance, add it to the world and lauch its OnSpawn action.<BR><BR>
 	 *
@@ -432,7 +436,7 @@ public class L2Spawn
 	 * <li>Increase the current number of L2NpcInstance managed by this L2Spawn  </li><BR><BR>
 	 *
 	 */
-	public L2NpcInstance doSpawn()
+	public L2NpcInstance doSpawn(boolean isSummonSpawn)
 	{
 		L2NpcInstance mob = null;
 		try
@@ -453,7 +457,8 @@ public class L2Spawn
 			// (can be a L2ArtefactInstance, L2FriendlyMobInstance, L2GuardInstance, L2MonsterInstance, L2SiegeGuardInstance, L2BoxInstance,
 			// L2FeedableBeastInstance, L2TamedBeastInstance, L2FolkInstance or L2TvTEventNpcInstance)
 			Object  tmp = _constructor.newInstance(parameters);
-
+			if (isSummonSpawn && tmp instanceof L2Character)
+				((L2Character)tmp).setShowSummonAnimation(isSummonSpawn);
 			// Check if the Instance is a L2NpcInstance
 			if (!(tmp instanceof L2NpcInstance))
 				return mob;

+ 1 - 18
L2_GameServer/java/net/sf/l2j/gameserver/model/L2Summon.java

@@ -73,7 +73,6 @@ public abstract class L2Summon extends L2PlayableInstance
     // should vary depending on the servitor template (id and level)!
     private int _soulShotsPerHit = 1;
     private int _spiritShotsPerHit = 1;
-	protected boolean _showSummonAnimation;
 
 	public class AIAccessor extends L2Character.AIAccessor
 	{
@@ -107,7 +106,7 @@ public abstract class L2Summon extends L2PlayableInstance
         super.onSpawn();
 
         this.setFollowStatus(true);
-        this.setShowSummonAnimation(false); // addVisibleObject created the info packets with summon animation
+        setShowSummonAnimation(false); // addVisibleObject created the info packets with summon animation
                                               // if someone comes into range now, the animation shouldnt show any more
         this.getOwner().sendPacket(new PetInfo(this));
 
@@ -848,22 +847,6 @@ public abstract class L2Summon extends L2PlayableInstance
 		getOwner().sendPacket(sm);
     }
 
-	/**
-	 * @return Returns the showSummonAnimation.
-	 */
-	public boolean isShowSummonAnimation()
-	{
-	    return _showSummonAnimation;
-	}
-
-	/**
-	 * @param showSummonAnimation The showSummonAnimation to set.
-	 */
-	public void setShowSummonAnimation(boolean showSummonAnimation)
-	{
-	    _showSummonAnimation = showSummonAnimation;
-	}
-
 	/**
 	 * Servitors' skills automatically change their level based on the servitor's level.
 	 * Until level 70, the servitor gets 1 lv of skill per 10 levels. After that, it is 1

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/model/L2World.java

@@ -312,7 +312,7 @@ public final class L2World
      * @param dropper L2Character who has dropped the object (if necessary)
      *
      */
-    public void addVisibleObject(L2Object object, @SuppressWarnings("unused") L2WorldRegion newRegion, L2Character dropper)
+    public void addVisibleObject(L2Object object, L2WorldRegion newRegion, L2Character dropper)
     {
         // If selected L2Object is a L2PcIntance, add it in L2ObjectHashSet(L2PcInstance) _allPlayers of L2World
     	// XXX TODO: this code should be obsoleted by protection in putObject func...

+ 72 - 87
L2_GameServer/java/net/sf/l2j/gameserver/model/L2WorldRegion.java

@@ -21,6 +21,7 @@ import java.util.Map;
 import java.util.concurrent.ScheduledFuture;
 import java.util.logging.Logger;
 
+import javolution.util.FastList;
 import javolution.util.FastMap;
 import net.sf.l2j.Config;
 import net.sf.l2j.gameserver.ThreadPoolManager;
@@ -28,7 +29,6 @@ import net.sf.l2j.gameserver.ai.L2AttackableAI;
 import net.sf.l2j.gameserver.datatables.SpawnTable;
 import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance;
 import net.sf.l2j.gameserver.model.actor.instance.L2PlayableInstance;
-import net.sf.l2j.gameserver.model.zone.L2ZoneManager;
 import net.sf.l2j.gameserver.model.zone.L2ZoneType;
 import net.sf.l2j.gameserver.model.zone.type.L2DerbyTrackZone;
 import net.sf.l2j.gameserver.model.zone.type.L2PeaceZone;
@@ -53,8 +53,7 @@ public final class L2WorldRegion
     private int _tileX, _tileY;
     private Boolean _active = false;
     private ScheduledFuture<?> _neighborsTask = null;
-
-    private L2ZoneManager _zoneManager;
+    private final FastList<L2ZoneType>			_zones;
 
     public L2WorldRegion(int pTileX, int pTileY)
     {
@@ -70,119 +69,105 @@ public final class L2WorldRegion
             _active = true;
         else
             _active = false;
+        _zones = new FastList<L2ZoneType>();
     }
 
+	public FastList<L2ZoneType> getZones()
+	{
+		return _zones;
+	}
+	
     public void addZone(L2ZoneType zone)
     {
-    	if (_zoneManager == null)
-    	{
-    		_zoneManager = new L2ZoneManager();
-    	}
-    	_zoneManager.registerNewZone(zone);
+    	_zones.add(zone);
     }
 
     public void removeZone(L2ZoneType zone)
     {
-    	if (_zoneManager == null)
-    		return;
-    	_zoneManager.unregisterZone(zone);
+    	_zones.remove(zone);
     }
 
     public void revalidateZones(L2Character character)
     {
-    	if (_zoneManager == null) return;
         // do NOT update the world region while the character is still in the process of teleporting
     	// Once the teleport is COMPLETED, revalidation occurs safely, at that time.
-        if (character.isTeleporting())
-            return;
 
-    	if (_zoneManager != null)
-    	{
-    		_zoneManager.revalidateZones(character);
-    	}
-    }
+		if (character.isTeleporting())
+			return;
 
-    public void removeFromZones(L2Character character)
-    {
-    	if (_zoneManager == null) return;
+		for (L2ZoneType z : getZones())
+		{
+			if(z != null) z.revalidateInZone(character);
+		}
+	}
 
-    	if (_zoneManager != null)
-    	{
-    		_zoneManager.removeCharacter(character);
-    	}
-    }
+    public void removeFromZones(L2Character character)
+	{
+		for (L2ZoneType z : getZones())
+		{
+			if(z != null) z.removeCharacter(character);
+		}
+	}
     
     public boolean containsZone(int zoneId)
-    {
-        if (_zoneManager != null)
-        {
-            for (L2ZoneType e : _zoneManager.getZones())
-            {
-                if (e != null && e.getId() == zoneId)
-                {
-                    return true;
-                }
-            }
-            return false;
-        }
-        return false;
-    }
+	{
+		for (L2ZoneType z : getZones())
+		{
+			if (z.getId() == zoneId)
+			{
+				return true;
+			}
+		}
+		return false;
+	}
     
     public boolean checkEffectRangeInsidePeaceZone(L2Skill skill, final int x, final int y, final int z)
     {
-        if (_zoneManager != null)
-        {
-            final int range = skill.getEffectRange();
-            final int up = y + range;
-            final int down = y - range;
-            final int left = x + range;
-            final int right = x - range;
-            
-            for (L2ZoneType e : _zoneManager.getZones())
-            {
-            	if ((e instanceof L2TownZone && ((L2TownZone)e).isPeaceZone()) || e instanceof L2DerbyTrackZone || e instanceof L2PeaceZone)
-            	{
-            		if (e.isInsideZone(x, up, z))
-            			return false;
-                        
-            		if (e.isInsideZone(x, down, z))
-            			return false;
-                        	
-            		if (e.isInsideZone(left, y, z))
-            			return false;
-            		
-            		if (e.isInsideZone(right, y, z))
-            			return false;
-                        
-            		if (e.isInsideZone(x, y, z))
-            			return false;
-            	}
-            }
-            return true;
-        }
-        return true;
-    }
+    	final int range = skill.getEffectRange();
+    	final int up = y + range;
+    	final int down = y - range;
+    	final int left = x + range;
+    	final int right = x - range;
 
-    public void onDeath(L2Character character)
-    {
-    	if (_zoneManager == null) return;
-
-    	if (_zoneManager != null)
+    	for (L2ZoneType e : getZones())
     	{
-    		_zoneManager.onDeath(character);
-    	}
-    }
+    		if ((e instanceof L2TownZone && ((L2TownZone)e).isPeaceZone()) || e instanceof L2DerbyTrackZone || e instanceof L2PeaceZone)
+    		{
+    			if (e.isInsideZone(x, up, z))
+    				return false;
 
-    public void onRevive(L2Character character)
-    {
-    	if (_zoneManager == null) return;
+    			if (e.isInsideZone(x, down, z))
+    				return false;
 
-    	if (_zoneManager != null)
-    	{
-    		_zoneManager.onRevive(character);
+    			if (e.isInsideZone(left, y, z))
+    				return false;
+
+    			if (e.isInsideZone(right, y, z))
+    				return false;
+
+    			if (e.isInsideZone(x, y, z))
+    				return false;
+    		}
     	}
+    	return true;
     }
 
+    public void onDeath(L2Character character)
+	{
+		for (L2ZoneType z : getZones())
+		{
+			if(z != null) z.onDieInside(character);
+		}
+	}
+
+    public void onRevive(L2Character character)
+	{
+		for (L2ZoneType z : getZones())
+		{
+			if(z != null) z.onReviveInside(character);
+		}
+	}
+
     /** Task of AI notification */
     public class NeighborsTask implements Runnable
     {

+ 21 - 0
L2_GameServer/java/net/sf/l2j/gameserver/model/PcInventory.java

@@ -20,10 +20,14 @@ import java.util.List;
 import java.util.logging.Level;
 
 import javolution.util.FastList;
+import net.sf.l2j.Config;
 import net.sf.l2j.L2DatabaseFactory;
 import net.sf.l2j.gameserver.model.L2ItemInstance.ItemLocation;
 import net.sf.l2j.gameserver.model.TradeList.TradeItem;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.network.serverpackets.InventoryUpdate;
+import net.sf.l2j.gameserver.network.serverpackets.ItemList;
+import net.sf.l2j.gameserver.network.serverpackets.StatusUpdate;
 import net.sf.l2j.gameserver.templates.L2EtcItemType;
 
 public class PcInventory extends Inventory
@@ -330,6 +334,23 @@ public class PcInventory extends Inventory
 
     	if (item != null && item.getItemId() == ANCIENT_ADENA_ID && !item.equals(_ancientAdena))
     		_ancientAdena = item;
+    	if (item != null)
+    	{
+			// Send inventory update packet
+			if (!Config.FORCE_INVENTORY_UPDATE)
+			{
+				InventoryUpdate playerIU = new InventoryUpdate();
+				playerIU.addItem(item);
+				actor.sendPacket(playerIU);
+			}
+			else
+				actor.sendPacket(new ItemList(actor, false));
+
+			// Update current load as well
+			StatusUpdate su = new StatusUpdate(actor.getObjectId());
+			su.addAttribute(StatusUpdate.CUR_LOAD, actor.getCurrentLoad());
+			actor.sendPacket(su);
+    	}
 
     	return item;
     }

+ 2 - 2
L2_GameServer/java/net/sf/l2j/gameserver/model/PcWarehouse.java

@@ -33,8 +33,8 @@ public class PcWarehouse extends Warehouse
 	@Override
 	public ItemLocation getBaseLocation() { return ItemLocation.WAREHOUSE; }
 	public String getLocationId() { return "0"; }
-	public int getLocationId(@SuppressWarnings("unused") boolean dummy) { return 0; }
-	public void setLocationId(@SuppressWarnings("unused") L2PcInstance dummy) { return; }
+	public int getLocationId(boolean dummy) { return 0; }
+	public void setLocationId(L2PcInstance dummy) { return; }
 
 	@Override
 	public boolean validateCapacity(int slots)

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/model/TradeList.java

@@ -738,7 +738,7 @@ public class TradeList
             lock();
             return false;
         }
-        ;
+        
         L2ItemInstance adenaItem = playerInventory.getAdenaInstance();
         playerInventory.reduceAdena("PrivateStore", price, player, _owner);
         playerIU.addItem(adenaItem);

+ 0 - 1
L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2ArtefactInstance.java

@@ -48,7 +48,6 @@ public final class L2ArtefactInstance extends L2NpcInstance
 	 * Return False.<BR><BR>
 	 */
     @Override
-	@SuppressWarnings("unused")
     public boolean isAutoAttackable(L2Character attacker)
 	{
         return false;

+ 0 - 542
L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2BoxInstance.java

@@ -1,542 +0,0 @@
-/*
- * This program is free software: you can redistribute it and/or modify it under
- * the terms of the GNU General Public License as published by the Free Software
- * Foundation, either version 3 of the License, or (at your option) any later
- * version.
- * 
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- * 
- * You should have received a copy of the GNU General Public License along with
- * this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package net.sf.l2j.gameserver.model.actor.instance;
-
-/*
- * This class implements a L2Box instance which is used like a warehouse but
- * without limits on item numbers. It can be thought of a box with six drawers.
- * Depositing and withdrawing is done through a HTML dialog to circumvent the
- * package size limit of the warehouse dialog.
- * Access to a box has to be set by an admin and uses the players' names for
- * easier handling (s. admin command admin_box_access).
- * To spawn an L2BoxInstance change the type in npc to L2Box.
- * example: update npc set type='L2Box' where id=1042;
- * It uses two tables: boxes and boxaccess. Create these with:
-  CREATE TABLE boxes (
-  id int(11) NOT NULL auto_increment,
-  spawn decimal(11,0) default NULL,
-  npcid decimal(11,0) default NULL,
-  drawer varchar(32) default NULL,
-  itemid decimal(11,0) default NULL,
-  name varchar(32) default '',
-  count decimal(11,0) default NULL,
-  enchant decimal(2,0) default NULL,
-  PRIMARY KEY  (id)
-  ) TYPE=MyISAM;
-  CREATE TABLE boxaccess (
-  spawn decimal(11,0) default NULL,
-  charname varchar(32) default NULL
-  ) TYPE=MyISAM;
- */
-
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.util.List;
-import java.util.Set;
-
-import javolution.util.FastList;
-import javolution.util.FastSet;
-import net.sf.l2j.L2DatabaseFactory;
-import net.sf.l2j.gameserver.model.L2ItemInstance;
-import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
-import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
-import net.sf.l2j.gameserver.templates.L2NpcTemplate;
-
-public class L2BoxInstance extends L2NpcInstance {
-
-	private class L2BoxItem implements Comparable<L2BoxItem> {
-		public int itemid;
-		public int id;
-		public int count;
-		public int enchant;
-		public String name;
-		public L2BoxItem()
-		{
-			//
-		}
-		public L2BoxItem(int _itemid, int _count, String _name, int _id, int _enchant)
-		{
-			itemid = _itemid;
-			count = _count;
-			name = _name;
-			id = _id;
-			enchant = _enchant;
-		}
-		public int compareTo(L2BoxItem o)
-		{
-			int r = name.compareToIgnoreCase(o.name);
-			if (r != 0)
-				return r;
-			if (id < o.id)
-				return -1;
-			return 1;
-		}
-	}
-
-    //private static Logger _log = Logger.getLogger(L2BoxInstance.class.getName());
-	private static final int MAX_ITEMS_PER_PAGE = 25;
-	private static final String INSERT_GRANT = "INSERT INTO boxaccess (charname,spawn) VALUES(?,?)";
-	private static final String DELETE_GRANT = "DELETE FROM boxaccess WHERE charname=? AND spawn=?";
-	private static final String LIST_GRANT = "SELECT charname FROM boxaccess WHERE spawn=?";
-    private static final String VARIABLE_PREFIX = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
-
-	public L2BoxInstance(int objectId, L2NpcTemplate _template)
-	{
-		super(objectId, _template);
-	}
-
-	@Override
-	public void onBypassFeedback(L2PcInstance player, String command)
-	{
-		String playerName = player.getName();
-		boolean access = hasAccess(playerName);
-
-		if (command.startsWith("Withdraw"))
-		{
-			if (access)
-				showWithdrawWindow(player, command.substring(9));
-		}
-		else if (command.startsWith("Deposit"))
-		{
-			if (access)
-				showDepositWindow(player, command.substring(8));
-		}
-		else if (command.startsWith("InBox"))
-		{
-			if (access)
-				putInBox(player, command.substring(6));
-		}
-		else if (command.startsWith("OutBox"))
-		{
-			if (access)
-				takeOutBox(player, command.substring(7));
-		}
-		else super.onBypassFeedback(player,command);
-		//else _log.info("onBypassFeedback unknown command "+command);
-	}
-
-	@Override
-	public boolean hasRandomAnimation()
-	{
-		return false;
-	}
-
-	@Override
-	public String getHtmlPath(int npcId, int val)
-	{
-		String pom = "";
-		if (val == 0)
-		{
-			pom = "" + npcId;
-		}
-		else
-		{
-			pom = npcId + "-" + val;
-		}
-		return "data/html/custom/" + pom + ".htm";
-	}
-
-	public boolean hasAccess(String player)
-	{
-		java.sql.Connection con = null;
-		boolean result = false;
-		try
-		{
-			con = L2DatabaseFactory.getInstance().getConnection();
-			PreparedStatement st = con.prepareStatement("SELECT spawn, charname FROM boxaccess WHERE charname=? AND spawn=?");
-			st.setString(1, player);
-			st.setInt(2, getSpawn().getId());
-			ResultSet rs = st.executeQuery();
-			if (rs.next())
-				result = true;
-			rs.close();
-			st.close();
-		}
-		catch (Exception e)
-		{
-			_log.info("hasAccess failed: "+e);
-		}
-		finally
-		{
-			try { con.close(); } catch (Exception e) {}
-		}
-		return result;
-	}
-
-	public List<String> getAccess()
-	{
-		java.sql.Connection con = null;
-		List<String> acl = new FastList<String>();
-		try
-		{
-			con = L2DatabaseFactory.getInstance().getConnection();
-			PreparedStatement st = con.prepareStatement(LIST_GRANT);
-			st.setInt(1, getSpawn().getId());
-			ResultSet rs = st.executeQuery();
-			while (rs.next())
-			{
-				acl.add(rs.getString("charname"));
-			}
-			rs.close();
-			st.close();
-		}
-		catch (Exception e)
-		{
-			_log.info("getAccess failed: "+e);
-		}
-		finally
-		{
-			try { con.close(); } catch (Exception e) { }
-		}
-		return acl;
-	}
-
-	public boolean grantAccess(String player, boolean what)
-	{
-		java.sql.Connection con = null;
-		boolean result = false;
-		try
-		{
-			con = L2DatabaseFactory.getInstance().getConnection();
-			String _query;
-			if (what)
-				_query = INSERT_GRANT;
-			else
-				_query = DELETE_GRANT;
-
-			PreparedStatement st = con.prepareStatement(_query);
-			st.setString(1, player);
-			st.setInt(2, getSpawn().getId());
-			st.execute();
-			st.close();
-		}
-		catch (Exception e)
-		{
-			result = false;
-		}
-		finally
-		{
-			try { con.close(); } catch (Exception e) { }
-		}
-		return result;
-	}
-
-	private void showWithdrawWindow(L2PcInstance player, String command)
-	{
-		String drawername = "trash";
-		if (command == null)
-			return;
-		String[] cmd = command.split(" ");
-		int startPos = 0;
-		if (cmd != null)
-			drawername = cmd[0];
-		if (cmd.length>1)
-			startPos = Integer.parseInt(cmd[1]);
-
-		NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
-		int nitems = 0;
-		Set<L2BoxItem> _items = getItems(drawername);
-		if (startPos >= _items.size())
-			startPos = 0;
-		String button = "<button value=\"Withdraw\" width=80 height=15 action=\"bypass -h npc_"+getObjectId()+"_OutBox "+drawername;
-		String next = "<button value=\"next\" width=50 height=15 action=\"bypass -h npc_"+getObjectId()+"_Withdraw "+drawername+" "+(startPos+MAX_ITEMS_PER_PAGE)+"\">";
-		String back = "<button value=\"back\" width=50 height=15 action=\"bypass -h npc_"+getObjectId()+"_Chat 0\">";
-		String content = "<html><body>Drawer "+drawername+":<br>"+next+" "+back+"<table width=\"100%\">";
-		content += "<tr><td>Item</td><td>Count</td><td>Withdraw</td></tr>";
-		for (L2BoxItem i : _items)
-		{
-			nitems++;
-			if (nitems < startPos)
-				continue;
-			String varname = VARIABLE_PREFIX.charAt(nitems-startPos)+String.valueOf(i.itemid);
-			content += "<tr><td>"+i.name+"</td><td align=\"right\">"+i.count+"</td>";
-			content += "<td><edit var=\""+varname+"\" width=30></td></tr>";
-			button += " ,"+varname+" $"+varname;
-			if ((nitems - startPos) >= MAX_ITEMS_PER_PAGE)
-				break;
-		}
-		button += "\">";
-		content += "</table><br>"+button+"</body></html>";
-		_log.fine("setHtml("+content+"); items="+nitems);
-		html.setHtml(content);
-		player.sendPacket(html);
-
-		player.sendPacket( ActionFailed.STATIC_PACKET );
-	}
-
-	private void showDepositWindow(L2PcInstance player, String command)
-	{
-		String drawername = "trash";
-		if (command == null)
-			return;
-		String[] cmd = command.split(" ");
-		int startPos = 0;
-		if (cmd != null)
-			drawername = cmd[0];
-		if (cmd.length>1)
-			startPos = Integer.parseInt(cmd[1]);
-
-		NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
-		int nitems = 0;
-		Set<L2BoxItem> _items = new FastSet<L2BoxItem>();
-		for (L2ItemInstance i : player.getInventory().getItems())
-		{
-			if (i.getItemId() == 57 || i.isEquipped())
-				continue;
-			L2BoxItem bi = new L2BoxItem(i.getItemId(), i.getCount(), i.getItem().getName(), i.getObjectId(), i.getEnchantLevel());
-			_items.add(bi);
-		}
-		if (startPos >= _items.size())
-			startPos = 0;
-		String button = "<button value=\"Deposit\" width=80 height=15 action=\"bypass -h npc_"+getObjectId()+"_InBox "+drawername;
-		String next = "<button value=\"next\" width=50 height=15 action=\"bypass -h npc_"+getObjectId()+"_Deposit "+drawername+" "+(startPos+MAX_ITEMS_PER_PAGE)+"\">";
-		String back = "<button value=\"back\" width=50 height=15 action=\"bypass -h npc_"+getObjectId()+"_Chat 0\">";
-		String content = "<html><body>Drawer "+drawername+":<br>"+next+" "+back+"<table width=\"100%\">";
-		content += "<tr><td>Item</td><td>Count</td><td>Deposit</td></tr>";
-		for (L2BoxItem i : _items)
-		{
-			nitems++;
-			if (nitems < startPos)
-				continue;
-			String varname = VARIABLE_PREFIX.charAt(nitems-startPos)+String.valueOf(i.itemid);
-			content += "<tr><td>"+i.name+"</td><td align=\"right\">"+i.count+"</td>";
-			content += "<td><edit var=\""+varname+"\" width=30></td></tr>";
-			button += " ,"+varname+" $"+varname;
-			if ((nitems - startPos) >= MAX_ITEMS_PER_PAGE)
-				break;
-		}
-		button += "\">";
-		content += "</table><br>"+button+"</body></html>";
-		_log.fine("setHtml("+content+"); items="+nitems);
-		html.setHtml(content);
-		player.sendPacket(html);
-
-		player.sendPacket( ActionFailed.STATIC_PACKET );
-	}
-
-	private Set<L2BoxItem> getItems(String drawer)
-	{
-		Set<L2BoxItem> it = new FastSet<L2BoxItem>();
-		java.sql.Connection con = null;
-		try
-		{
-			con = L2DatabaseFactory.getInstance().getConnection();
-			PreparedStatement statement = con.prepareStatement("SELECT id, spawn, npcid, drawer, itemid, name, count, enchant FROM boxes where spawn=? and npcid=? and drawer=?");
-			statement.setInt(1, getSpawn().getId());
-			statement.setInt(2, getNpcId());
-			statement.setString(3, drawer);
-			ResultSet rs = statement.executeQuery();
-			while (rs.next())
-			{
-				_log.fine("found: itemid="+rs.getInt("itemid")+", count="+rs.getInt("count"));
-				it.add(new L2BoxItem(rs.getInt("itemid"),rs.getInt("count"),rs.getString("name"),rs.getInt("id"),rs.getInt("enchant")));
-			}
-			rs.close();
-			statement.close();
-		}
-		catch (Exception e)
-		{
-			_log.info("getItems failed: "+e);
-		}
-		finally
-		{
-			try { con.close(); } catch (Exception e) {}
-		}
-		return it;
-	}
-
-	private void putInBox(L2PcInstance player, String command)
-	{/* NOTE: Item storing in box is currently not implemented
-		String[] cmd = command.split(",");
-		if (cmd.length<=1)
-			return;
-		String drawername = cmd[0];
-		for (int i = 1; i < cmd.length; i++)
-		{
-			String[] part = cmd[i].split(" ");
-			if (part == null || part.length < 2)
-				continue;
-			try
-			{
-				int id = Integer.parseInt(part[0].substring(1));
-				int count = Integer.parseInt(part[1]);
-				if (count <= 0)
-					continue;
-				int realCount = player.getInventory().getItemByItemId(id).getCount();
-				if (count < realCount)
-					realCount = count;
-				L2ItemInstance item = player.getInventory().destroyItemByItemId("Box", id, realCount, player, this);
-				// other than previous l2j, destroyItemByItemId does not return the count destroyed
-				// and we cannot just use the returned item as we cannot change the count
-				L2ItemInstance newItem = ItemTable.getInstance().createItem(id);
-				newItem.setCount(realCount);
-				newItem.setEnchantLevel(item.getEnchantLevel());
-				putItemInBox(player, drawername, newItem);
-			}
-			catch (Exception e)
-			{
-				_log.fine("putInBox "+command+" failed: "+e);
-			}
-		}
-	}
-
-	private void putItemInBox(L2PcInstance player, String drawer, L2ItemInstance item)
-	{
-		String charname = player.getName();
-		java.sql.Connection con = null;
-        int foundId = 0;
-        int foundCount = 0;
-		try
-		{
-            con = L2DatabaseFactory.getInstance().getConnection();
-            if (item.isStackable())
-            {
-                PreparedStatement st2 = con.prepareStatement("SELECT id,count FROM boxes where spawn=? and npcid=? and drawer=? and itemid=?");
-                st2.setInt(1, getSpawn().getId());
-                st2.setInt(2, getNpcId());
-                st2.setString(3, drawer);
-                st2.setInt(4, item.getItemId());
-                ResultSet rs = st2.executeQuery();
-                if (rs.next())
-                {
-                    foundId = rs.getInt("id");
-                    foundCount = rs.getInt("count");
-                }
-                rs.close();
-                st2.close();
-            }
-            if (foundCount == 0)
-            {
-    			PreparedStatement statement = con.prepareStatement("INSERT INTO boxes (spawn,npcid,drawer,itemid,name,count,enchant) VALUES(?,?,?,?,?,?,?)");
-    			statement.setInt(1, getSpawn().getId());
-    			statement.setInt(2, getNpcId());
-    			statement.setString(3, drawer);
-    			statement.setInt(4, item.getItemId());
-    			statement.setString(5, item.getItem().getName());
-    			statement.setInt(6, item.getCount());
-    			statement.setInt(7, item.getEnchantLevel());
-    			statement.execute();
-    			statement.close();
-            }
-            else
-            {
-                PreparedStatement statement = con.prepareStatement("UPDATE boxes SET count=? WHERE id=?");
-                statement.setInt(1, foundCount + item.getCount());
-                statement.setInt(2, foundId);
-                statement.execute();
-                statement.close();
-            }
-		}
-		catch (Exception e)
-		{
-			_log.info("could not store item to box "+getSpawn().getId()+"-"+drawer+" for char "+charname);
-		}
-		finally
-		{
-			try { con.close(); } catch (Exception e) {}
-		}*/
-	}
-
-	private void takeOutBox(L2PcInstance player, String command)
-	{/* NOTE: Item storing in box is currently not implemented
-		String[] cmd = command.split(",");
-		if (cmd.length<=1)
-			return;
-		String drawername = cmd[0];
-		L2BoxItem bi = null;
-		for (int i = 1; i < cmd.length; i++)
-		{
-			String[] part = cmd[i].split(" ");
-			if (part == null || part.length < 2)
-				continue;
-			try
-			{
-				int id = Integer.parseInt(part[0].substring(1));
-				int count = Integer.parseInt(part[1]);
-				if (count <= 0)
-					continue;
-				L2ItemInstance item = ItemTable.getInstance().createItem(id);
-				item.setCount(count);
-				bi = takeItemOutBox(player, drawername, item);
-				if (bi.count > 0)
-				{
-					item.setCount(bi.count);
-					item.setEnchantLevel(bi.enchant);
-					player.getInventory().addItem("Box", item, player, this);
-				}
-			}
-			catch (Exception e)
-			{
-				_log.fine("takeOutBox "+command+" failed: "+e);
-			}
-		}
-	}
-
-	private L2BoxItem takeItemOutBox(L2PcInstance player, String drawer, L2ItemInstance item)
-	{
-		String charname = player.getName();
-		java.sql.Connection con = null;
-		L2BoxItem bi = new L2BoxItem();
-		bi.count = 0;
-		try
-		{
-			con = L2DatabaseFactory.getInstance().getConnection();
-			PreparedStatement statement = con.prepareStatement("SELECT id,count,enchant FROM boxes WHERE spawn=? AND npcid=? AND drawer=? AND itemid=? AND count>=?");
-			statement.setInt(1, getSpawn().getId());
-			statement.setInt(2, getNpcId());
-			statement.setString(3, drawer);
-			statement.setInt(4, item.getItemId());
-			statement.setInt(5, item.getCount());
-			ResultSet rs = statement.executeQuery();
-			while (rs.next())
-			{
-				if (rs.getInt("count") == item.getCount())
-				{
-					bi.count = item.getCount();
-					bi.itemid = item.getItemId();
-					bi.enchant = rs.getInt("enchant");
-					PreparedStatement st2 = con.prepareStatement("DELETE FROM boxes WHERE id=?");
-					st2.setInt(1, rs.getInt("id"));
-					st2.execute();
-					st2.close();
-					break;
-				}
-				if (rs.getInt("count") > item.getCount())
-				{
-					bi.count = item.getCount();
-					bi.itemid = item.getItemId();
-					bi.enchant = rs.getInt("enchant");
-					PreparedStatement st2 = con.prepareStatement("UPDATE boxes SET count=? WHERE id=?");
-					st2.setInt(1, rs.getInt("count") - bi.count);
-					st2.setInt(2, rs.getInt("id"));
-					st2.execute();
-					st2.close();
-					break;
-				}
-			}
-            rs.close();
-			statement.close();
-		}
-		catch (Exception e)
-		{
-			_log.info("could not delete/update item, box "+getSpawn().getId()+"-"+drawer+" for char "+charname+": "+e);
-		}
-		finally
-		{
-			try { con.close(); } catch (Exception e) {}
-		}
-		return bi;*/
-	}
-}

+ 0 - 2
L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2CastleTeleporterInstance.java

@@ -33,7 +33,6 @@ import net.sf.l2j.gameserver.datatables.MapRegionTable;
 import net.sf.l2j.gameserver.instancemanager.CastleManager;
 import net.sf.l2j.gameserver.model.L2World;
 import net.sf.l2j.gameserver.model.entity.Castle;
-import net.sf.l2j.gameserver.model.zone.L2ZoneManager;
 import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
 import net.sf.l2j.gameserver.network.serverpackets.MyTargetSelected;
 import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
@@ -44,7 +43,6 @@ import net.sf.l2j.gameserver.templates.L2NpcTemplate;
 public final class L2CastleTeleporterInstance extends L2FolkInstance
 {
 	private boolean _currentTask = false;
-	L2ZoneManager _zoneManager;
 
 	/**
 	* @param template

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2ClassMasterInstance.java

@@ -160,7 +160,7 @@ public final class L2ClassMasterInstance extends L2FolkInstance
 	}
 
 	@Override
-	public String getHtmlPath(@SuppressWarnings("unused") int npcId, int val)
+	public String getHtmlPath(int npcId, int val)
 	{
 		return "data/html/classmaster/" + val + ".htm";
 	}

+ 0 - 5
L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2DoorInstance.java

@@ -90,19 +90,14 @@ public class L2DoorInstance extends L2Character
         @Override
 		public L2DoorInstance getActor() { return L2DoorInstance.this; }
         @Override
-		@SuppressWarnings("unused")
         public void moveTo(int x, int y, int z, int offset) {}
         @Override
-		@SuppressWarnings("unused")
         public void moveTo(int x, int y, int z) {}
         @Override
-		@SuppressWarnings("unused")
         public void stopMove(L2CharPosition pos) {}
         @Override
-		@SuppressWarnings("unused")
         public void doAttack(L2Character target) {}
         @Override
-		@SuppressWarnings("unused")
         public void doCast(L2Skill skill) {}
     }
 

+ 34 - 0
L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2GrandBossInstance.java

@@ -14,8 +14,11 @@
  */
 package net.sf.l2j.gameserver.model.actor.instance;
 
+import net.sf.l2j.gameserver.instancemanager.RaidBossPointsManager;
 import net.sf.l2j.gameserver.model.L2Character;
+import net.sf.l2j.gameserver.model.L2Summon;
 import net.sf.l2j.gameserver.templates.L2NpcTemplate;
+import net.sf.l2j.util.Rnd;
 
 /**
  * This class manages all Grand Bosses.
@@ -61,4 +64,35 @@ public final class L2GrandBossInstance extends L2MonsterInstance
     {
         return true;
     }
+
+    /**
+     * 
+     * @see net.sf.l2j.gameserver.model.actor.instance.L2MonsterInstance#doDie(net.sf.l2j.gameserver.model.L2Character)
+     */
+    @Override
+    public boolean doDie(L2Character killer)
+	{
+		if (!super.doDie(killer))
+			return false;
+		L2PcInstance player = null;
+		
+		if (killer instanceof L2PcInstance)
+			player = (L2PcInstance) killer;
+		else if (killer instanceof L2Summon)
+			player = ((L2Summon) killer).getOwner();
+		
+		if (player != null)
+		{
+			if (player.getParty() != null)
+			{
+				for (L2PcInstance member : player.getParty().getPartyMembers())
+				{
+					RaidBossPointsManager.addPoints(member, getNpcId(), (getLevel() / 2) + Rnd.get(-5, 5));
+				}
+			}
+			else
+				RaidBossPointsManager.addPoints(player, getNpcId(), (getLevel() / 2) + Rnd.get(-5, 5));
+		}
+		return true;
+	}
 }

+ 0 - 1
L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2MonsterInstance.java

@@ -42,7 +42,6 @@ public class L2MonsterInstance extends L2Attackable
 
     protected final MinionList _minionList;
 
-    @SuppressWarnings("unused")
     protected ScheduledFuture<?> _minionMaintainTask = null;
 
     private static final int MONSTER_MAINTENANCE_INTERVAL = 1000;

+ 12 - 4
L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2NpcInstance.java

@@ -139,6 +139,7 @@ public class L2NpcInstance extends L2Character
     private int _currentRHandId;  // normally this shouldn't change from the template, but there exist exceptions
     private int _currentCollisionHeight; // used for npc grow effect skills
     private int _currentCollisionRadius; // used for npc grow effect skills
+
     /** Task launching the function onRandomAnimation() */
     protected class RandomAnimationTask implements Runnable
     {
@@ -428,7 +429,7 @@ public class L2NpcInstance extends L2Character
      * <li> L2PcInstance</li><BR><BR>
      */
     @Override
-	public boolean isAutoAttackable(@SuppressWarnings("unused") L2Character attacker)
+	public boolean isAutoAttackable(L2Character attacker)
     {
         return false;
     }
@@ -1212,11 +1213,11 @@ public class L2NpcInstance extends L2Character
         	{        		
         		if (qs.getState() == State.STARTED && qs.getInt("cond") > 0)
         		{
-        			sb.append("(in progress)");
+        			sb.append(" (In Progress)");
         		}
         		else if (qs.getState() == State.COMPLETED )
        			{
-        			sb.append("(done)");
+        			sb.append(" (Done)");
        			}
         	}
         	sb.append("]</a><br>");
@@ -2087,7 +2088,14 @@ public class L2NpcInstance extends L2Character
                         (npcId >= 31239 && npcId <= 31254))
                     return;
             // Get the text of the selected HTML file in function of the npcId and of the page number
-            filename = (getHtmlPath(npcId, val));
+            if (getTemplate().type == "L2Teleporter" && val==1 && player.getLevel() <=40)
+            {
+            	filename = "data/html/teleporter/free/" + npcId + ".htm";
+            	if (!HtmCache.getInstance().isLoadable(filename))
+            		filename = (getHtmlPath(npcId, val));
+            }
+            else
+            	filename = (getHtmlPath(npcId, val));
             break;
         }
         

+ 11 - 36
L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java

@@ -50,7 +50,6 @@ import net.sf.l2j.gameserver.cache.HtmCache;
 import net.sf.l2j.gameserver.cache.WarehouseCacheManager;
 import net.sf.l2j.gameserver.communitybbs.BB.Forum;
 import net.sf.l2j.gameserver.communitybbs.Manager.ForumsBBSManager;
-import net.sf.l2j.gameserver.datatables.AccessLevel;
 import net.sf.l2j.gameserver.datatables.AccessLevels;
 import net.sf.l2j.gameserver.datatables.CharTemplateTable;
 import net.sf.l2j.gameserver.datatables.ClanTable;
@@ -84,6 +83,7 @@ import net.sf.l2j.gameserver.model.BlockList;
 import net.sf.l2j.gameserver.model.FishData;
 import net.sf.l2j.gameserver.model.Inventory;
 import net.sf.l2j.gameserver.model.ItemContainer;
+import net.sf.l2j.gameserver.model.L2AccessLevel;
 import net.sf.l2j.gameserver.model.L2Attackable;
 import net.sf.l2j.gameserver.model.L2CharPosition;
 import net.sf.l2j.gameserver.model.L2Character;
@@ -548,7 +548,7 @@ public final class L2PcInstance extends L2PlayableInstance
     // WorldPosition used by TARGET_SIGNET_GROUND
     private Point3D _currentSkillWorldPosition;
     
-    private AccessLevel _accessLevel;
+    private L2AccessLevel _accessLevel;
 
 	private boolean _chatBanned = false; 		// Chat Banned
     private ScheduledFuture<?> _chatUnbanTask = null;
@@ -2026,6 +2026,7 @@ public final class L2PcInstance extends L2PlayableInstance
 		}
 		setTarget(this);
 		broadcastPacket(new MagicSkillUse(this, 5103, 1, 1000, 0));
+		sendPacket(new SystemMessage(SystemMessageId.CLASS_TRANSFER));
 		setClassTemplate(Id);
 		
 		// Update class icon in party and clan
@@ -2876,21 +2877,6 @@ public final class L2PcInstance extends L2PlayableInstance
 				// Add the item to inventory
 				L2ItemInstance createdItem = _inventory.addItem(process, itemId, count, this, reference);
 
-				// Send inventory update packet
-				if (!Config.FORCE_INVENTORY_UPDATE)
-				{
-					InventoryUpdate playerIU = new InventoryUpdate();
-					playerIU.addItem(createdItem);
-					sendPacket(playerIU);
-				}
-				else
-					sendPacket(new ItemList(this, false));
-
-				// Update current load as well
-				StatusUpdate su = new StatusUpdate(getObjectId());
-				su.addAttribute(StatusUpdate.CUR_LOAD, getCurrentLoad());
-				sendPacket(su);
-
 				// If over capacity, drop the item
 				if (!isGM() && !_inventory.validateCapacity(0))
 					dropItem("InvDrop", createdItem, null, true);
@@ -4697,12 +4683,6 @@ public final class L2PcInstance extends L2PlayableInstance
 	@Override
 	public boolean doDie(L2Character killer)
 	{
-		/* Since L2Character.doDie() calls stopAllEffects(), which includes
-		 * setting charm of curage and other blessings as false, this stores value 
-		 * before calling superclass method
-		 */
-		boolean charmOfCourage = getCharmOfCourage();
-		
 		// Kill the L2PcInstance
 		if (!super.doDie(killer))
 			return false;
@@ -4770,7 +4750,7 @@ public final class L2PcInstance extends L2PlayableInstance
 							// NOTE: deathPenalty +- Exp will update karma
 							// Penalty is lower if the player is at war with the pk (war has to be declared)
 							if (getSkillLevel(L2Skill.SKILL_LUCKY) < 0 || getStat().getLevel() > 9)
-								deathPenalty(pk != null && getClan() != null && getClan().isAtWarWith(pk.getClanId()), pk != null, charmOfCourage);										
+								deathPenalty(pk != null && getClan() != null && getClan().isAtWarWith(pk.getClanId()), pk != null);										
 
 						} else
 						{
@@ -4839,7 +4819,7 @@ public final class L2PcInstance extends L2PlayableInstance
 		{
 			boolean isKarmaDrop = false;
 			boolean isKillerNpc = (killer instanceof L2NpcInstance);
-			int pkLimit = Config.KARMA_PK_LIMIT;;
+			int pkLimit = Config.KARMA_PK_LIMIT;
 
 			int dropEquip           = 0;
 			int dropEquipWeapon     = 0;
@@ -5172,7 +5152,7 @@ public final class L2PcInstance extends L2PlayableInstance
 	 * <li>Send a Server->Client StatusUpdate packet with its new Experience </li><BR><BR>
 	 *
 	 */
-	public void deathPenalty(boolean atwar, boolean killed_by_pc, boolean charmOfCourage)
+	public void deathPenalty(boolean atwar, boolean killed_by_pc)
 	{
 		// TODO Need Correct Penalty
 		// Get the level of the L2PcInstance
@@ -5261,7 +5241,7 @@ public final class L2PcInstance extends L2PlayableInstance
 		// Get the Experience before applying penalty
 		setExpBeforeDeath(getExp());
 
-		if(charmOfCourage)
+		if(getCharmOfCourage())
 		{
 		    if (getSiegeState() > 0 && isInsideZone(ZONE_SIEGE))
 		    	lostExp = 0;
@@ -5273,11 +5253,6 @@ public final class L2PcInstance extends L2PlayableInstance
 		// Set the new Experience value of the L2PcInstance
 		getStat().addExp(-lostExp);
 	}
-	
-	public void deathPenalty(boolean atwar, boolean killed_by_pc)
-	{
-		deathPenalty(atwar, killed_by_pc, getCharmOfCourage());
-	}
 
 	/**
 	 * @param b
@@ -6109,7 +6084,7 @@ public final class L2PcInstance extends L2PlayableInstance
 			_accessLevel = AccessLevels._userAccessLevel;
 		else
 		{
-			AccessLevel accessLevel = AccessLevels.getInstance().getAccessLevel(level);
+			L2AccessLevel accessLevel = AccessLevels.getInstance().getAccessLevel(level);
 
 			if (accessLevel == null)
 			{
@@ -6144,7 +6119,7 @@ public final class L2PcInstance extends L2PlayableInstance
 	/**
 	 * Return the _accessLevel of the L2PcInstance.<BR><BR>
 	 */
-	public AccessLevel getAccessLevel()
+	public L2AccessLevel getAccessLevel()
 	{
 		if (Config.EVERYBODY_HAS_ADMIN_RIGHTS)
 			return AccessLevels._masterAccessLevel;
@@ -10996,9 +10971,9 @@ public final class L2PcInstance extends L2PlayableInstance
      * Decreases existing Souls.
      * @param count
      */
-    public void decreaseSouls(int count)
+    public void decreaseSouls(int count, L2Skill skill)
     {
-        if (getSouls() <= 0)
+        if (getSouls() <= 0 && skill.getSoulConsumeCount() > 0)
             return;
 
         _souls -= count;

+ 33 - 16
L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2RaidBossInstance.java

@@ -15,9 +15,11 @@
 package net.sf.l2j.gameserver.model.actor.instance;
 
 import net.sf.l2j.gameserver.ThreadPoolManager;
+import net.sf.l2j.gameserver.instancemanager.RaidBossPointsManager;
 import net.sf.l2j.gameserver.instancemanager.RaidBossSpawnManager;
 import net.sf.l2j.gameserver.model.L2Character;
 import net.sf.l2j.gameserver.model.L2Spawn;
+import net.sf.l2j.gameserver.model.L2Summon;
 import net.sf.l2j.gameserver.network.SystemMessageId;
 import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
 import net.sf.l2j.gameserver.templates.L2NpcTemplate;
@@ -62,24 +64,39 @@ public final class L2RaidBossInstance extends L2MonsterInstance
 
     @Override
     public boolean doDie(L2Character killer)
-    {
-    	if (!super.doDie(killer))
-    		return false;
-    	if(killer instanceof L2PlayableInstance)
-        {
-        	SystemMessage msg = new SystemMessage(SystemMessageId.RAID_WAS_SUCCESSFUL);
-        	broadcastPacket(msg);
-        }
-
-        RaidBossSpawnManager.getInstance().updateStatus(this, true);
-        return true;
-    }
+	{
+		if (!super.doDie(killer))
+			return false;
+		
+		L2PcInstance player = null;
+		if (killer instanceof L2PcInstance)
+			player = (L2PcInstance) killer;
+		else if (killer instanceof L2Summon)
+			player = ((L2Summon) killer).getOwner();
+		
+		if (player != null)
+		{
+			broadcastPacket(new SystemMessage(SystemMessageId.RAID_WAS_SUCCESSFUL));
+			if (player.getParty() != null)
+			{
+				for (L2PcInstance member : player.getParty().getPartyMembers())
+				{
+					RaidBossPointsManager.addPoints(member, this.getNpcId(), (this.getLevel() / 2) + Rnd.get(-5, 5));
+				}
+			}
+			else
+				RaidBossPointsManager.addPoints(player, this.getNpcId(), (this.getLevel() / 2) + Rnd.get(-5, 5));
+		}
+		
+		RaidBossSpawnManager.getInstance().updateStatus(this, true);
+		return true;
+	}
 
     /**
-     * Spawn all minions at a regular interval
-     * Also if boss is too far from home location at the time of this check, teleport it home
-     *
-     */
+	 * Spawn all minions at a regular interval Also if boss is too far from home
+	 * location at the time of this check, teleport it home
+	 * 
+	 */
     @Override
     protected void manageMinions()
     {

+ 480 - 0
L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2SepulcherMonsterInstance.java

@@ -0,0 +1,480 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package net.sf.l2j.gameserver.model.actor.instance;
+
+import java.util.concurrent.Future;
+
+import net.sf.l2j.gameserver.ThreadPoolManager;
+import net.sf.l2j.gameserver.datatables.SkillTable;
+import net.sf.l2j.gameserver.instancemanager.FourSepulchersManager;
+import net.sf.l2j.gameserver.model.L2Character;
+import net.sf.l2j.gameserver.model.L2Skill;
+import net.sf.l2j.gameserver.model.quest.QuestState;
+import net.sf.l2j.gameserver.network.serverpackets.NpcSay;
+import net.sf.l2j.gameserver.templates.L2NpcTemplate;
+
+/**
+ * 
+ * @author sandman
+ */
+public class L2SepulcherMonsterInstance extends L2MonsterInstance
+{
+	public int mysteriousBoxId = 0;
+	
+	protected Future<?> _victimSpawnKeyBoxTask = null;
+	protected Future<?> _victimShout = null;
+	protected Future<?> _changeImmortalTask = null;
+	protected Future<?> _onDeadEventTask = null;
+	
+	public L2SepulcherMonsterInstance(int objectId, L2NpcTemplate template)
+	{
+		super(objectId, template);
+		setShowSummonAnimation(true);
+	}
+	
+	@Override
+	public void onSpawn()
+	{
+		super.onSpawn();
+		setShowSummonAnimation(false);
+		switch (getNpcId())
+		{
+			case 18150:
+			case 18151:
+			case 18152:
+			case 18153:
+			case 18154:
+			case 18155:
+			case 18156:
+			case 18157:
+				if (_victimSpawnKeyBoxTask != null)
+					_victimSpawnKeyBoxTask.cancel(true);
+				_victimSpawnKeyBoxTask = ThreadPoolManager.getInstance().scheduleEffect(new VictimSpawnKeyBox(this), 300000);
+				if (_victimShout != null)
+					_victimShout.cancel(true);
+				_victimShout = ThreadPoolManager.getInstance().scheduleEffect(new VictimShout(this), 5000);
+				break;		
+			case 18196:
+			case 18197:
+			case 18198:
+			case 18199:
+			case 18200:
+			case 18201:
+			case 18202:
+			case 18203:
+			case 18204:
+			case 18205:
+			case 18206:
+			case 18207:
+			case 18208:
+			case 18209:
+			case 18210:
+			case 18211:
+				break;
+			
+			case 18231:
+			case 18232:
+			case 18233:
+			case 18234:
+			case 18235:
+			case 18236:
+			case 18237:
+			case 18238:
+			case 18239:
+			case 18240:
+			case 18241:
+			case 18242:
+			case 18243:
+				if (_changeImmortalTask != null)
+					_changeImmortalTask.cancel(true);
+				_changeImmortalTask = ThreadPoolManager.getInstance().scheduleEffect(new ChangeImmortal(this), 1600);
+				
+				break;
+			case 18256:
+				break;
+		}
+	}
+	
+	@Override
+	public boolean doDie(L2Character killer)
+	{
+		if (!super.doDie(killer))
+			return false;
+		
+		switch (getNpcId())
+		{
+			case 18120:
+			case 18121:
+			case 18122:
+			case 18123:
+			case 18124:
+			case 18125:
+			case 18126:
+			case 18127:
+			case 18128:
+			case 18129:
+			case 18130:
+			case 18131:
+			case 18149:
+			case 18158:
+			case 18159:
+			case 18160:
+			case 18161:
+			case 18162:
+			case 18163:
+			case 18164:
+			case 18165:
+			case 18183:
+			case 18184:
+			case 18212:
+			case 18213:
+			case 18214:
+			case 18215:
+			case 18216:
+			case 18217:
+			case 18218:
+			case 18219:
+				if (_onDeadEventTask != null)
+					_onDeadEventTask.cancel(true);
+				_onDeadEventTask = ThreadPoolManager.getInstance().scheduleEffect(new OnDeadEvent(this), 3500);
+				break;
+			
+			case 18150:
+			case 18151:
+			case 18152:
+			case 18153:
+			case 18154:
+			case 18155:
+			case 18156:
+			case 18157:
+				if (_victimSpawnKeyBoxTask != null)
+				{
+					_victimSpawnKeyBoxTask.cancel(true);
+					_victimSpawnKeyBoxTask = null;
+				}
+				if (_victimShout != null)
+				{
+					_victimShout.cancel(true);
+					_victimShout = null;
+				}
+				if (_onDeadEventTask != null)
+					_onDeadEventTask.cancel(true);
+				_onDeadEventTask = ThreadPoolManager.getInstance().scheduleEffect(new OnDeadEvent(this), 3500);
+				break;
+			
+			case 18141:
+			case 18142:
+			case 18143:
+			case 18144:
+			case 18145:
+			case 18146:
+			case 18147:
+			case 18148:
+				if (FourSepulchersManager.getInstance().isViscountMobsAnnihilated(mysteriousBoxId))
+				{
+					if (_onDeadEventTask != null)
+						_onDeadEventTask.cancel(true);
+					_onDeadEventTask = ThreadPoolManager.getInstance().scheduleEffect(new OnDeadEvent(this), 3500);
+				}
+				break;
+			
+			case 18220:
+			case 18221:
+			case 18222:
+			case 18223:
+			case 18224:
+			case 18225:
+			case 18226:
+			case 18227:
+			case 18228:
+			case 18229:
+			case 18230:
+			case 18231:
+			case 18232:
+			case 18233:
+			case 18234:
+			case 18235:
+			case 18236:
+			case 18237:
+			case 18238:
+			case 18239:
+			case 18240:
+				if (FourSepulchersManager.getInstance().isDukeMobsAnnihilated(mysteriousBoxId))
+				{
+					if (_onDeadEventTask != null)
+						_onDeadEventTask.cancel(true);
+					_onDeadEventTask = ThreadPoolManager.getInstance().scheduleEffect(new OnDeadEvent(this), 3500);
+				}
+				break;
+			
+			case 25339:
+			case 25342:
+			case 25346:
+			case 25349:
+				giveCup((L2PcInstance) killer);
+				if (_onDeadEventTask != null)
+					_onDeadEventTask.cancel(true);
+				_onDeadEventTask = ThreadPoolManager.getInstance().scheduleEffect(new OnDeadEvent(this), 8500);
+				break;
+		}
+		return true;
+	}
+	
+	@Override
+	public void deleteMe()
+	{
+		if (_victimSpawnKeyBoxTask != null)
+		{
+			_victimSpawnKeyBoxTask.cancel(true);
+			_victimSpawnKeyBoxTask = null;
+		}
+		if (_onDeadEventTask != null)
+		{
+			_onDeadEventTask.cancel(true);
+			_onDeadEventTask = null;
+		}
+		
+		super.deleteMe();
+	}
+	
+	@Override
+	public boolean isRaid()
+	{
+		switch (getNpcId())
+		{
+			case 25339:
+			case 25342:
+			case 25346:
+			case 25349:
+				return true;
+			default:
+				return false;
+		}
+	}
+	
+	private void giveCup(L2PcInstance player)
+	{
+		String questId = "620_FourGoblets";
+		int cupId = 0;
+		int oldBrooch = 7262;
+		
+		switch (getNpcId())
+		{
+			case 25339:
+				cupId = 7256;
+				break;
+			case 25342:
+				cupId = 7257;
+				break;
+			case 25346:
+				cupId = 7258;
+				break;
+			case 25349:
+				cupId = 7259;
+				break;
+		}
+		
+		if (player.getParty() != null)
+		{
+			for (L2PcInstance mem : player.getParty().getPartyMembers())
+			{
+				QuestState qs = mem.getQuestState(questId);
+				if (qs != null
+				        && (qs.isStarted() || qs.isCompleted())
+				        && mem.getInventory().getItemByItemId(oldBrooch) == null)
+				{
+					mem.addItem("Quest", cupId, 1, mem, true);
+				}
+			}
+		}
+		else
+		{
+			QuestState qs = player.getQuestState(questId);
+			if (qs != null && (qs.isStarted() || qs.isCompleted())
+			        && player.getInventory().getItemByItemId(oldBrooch) == null)
+			{
+				player.addItem("Quest", cupId, 1, player, true);
+			}
+		}
+	}
+
+	private class VictimShout implements Runnable
+	{
+		private L2SepulcherMonsterInstance _activeChar;
+		
+		public VictimShout(L2SepulcherMonsterInstance activeChar)
+		{
+			_activeChar = activeChar;
+		}
+
+		public void run()
+		{
+			if (_activeChar.isDead())
+				return;
+			
+			if (!_activeChar.isVisible())
+				return;	
+
+			broadcastPacket(new NpcSay(getObjectId(), 0, getNpcId(), "forgive me!!"));
+		}
+	}
+
+	private class VictimSpawnKeyBox implements Runnable
+	{
+		private L2SepulcherMonsterInstance _activeChar;
+		
+		public VictimSpawnKeyBox(L2SepulcherMonsterInstance activeChar)
+		{
+			_activeChar = activeChar;
+		}
+
+		public void run()
+		{
+			if (_activeChar.isDead())
+				return;
+			
+			if (!_activeChar.isVisible())
+				return;
+			
+			FourSepulchersManager.getInstance().spawnKeyBox(_activeChar);
+			broadcastPacket(new NpcSay(getObjectId(), 0, getNpcId(), "Many thanks for rescue me."));
+		}
+	}
+
+	private class OnDeadEvent implements Runnable
+	{
+		L2SepulcherMonsterInstance _activeChar;
+
+		public OnDeadEvent(L2SepulcherMonsterInstance activeChar)
+		{
+			_activeChar = activeChar;
+		}
+
+		public void run()
+		{
+			switch (_activeChar.getNpcId())
+			{
+				case 18120:
+				case 18121:
+				case 18122:
+				case 18123:
+				case 18124:
+				case 18125:
+				case 18126:
+				case 18127:
+				case 18128:
+				case 18129:
+				case 18130:
+				case 18131:
+				case 18149:
+				case 18158:
+				case 18159:
+				case 18160:
+				case 18161:
+				case 18162:
+				case 18163:
+				case 18164:
+				case 18165:
+				case 18183:
+				case 18184:
+				case 18212:
+				case 18213:
+				case 18214:
+				case 18215:
+				case 18216:
+				case 18217:
+				case 18218:
+				case 18219:
+					FourSepulchersManager.getInstance().spawnKeyBox(_activeChar);
+					break;
+				
+				case 18150:
+				case 18151:
+				case 18152:
+				case 18153:
+				case 18154:
+				case 18155:
+				case 18156:
+				case 18157:
+					FourSepulchersManager.getInstance().spawnExecutionerOfHalisha(_activeChar);
+					break;
+				
+				case 18141:
+				case 18142:
+				case 18143:
+				case 18144:
+				case 18145:
+				case 18146:
+				case 18147:
+				case 18148:
+					FourSepulchersManager.getInstance().spawnMonster(_activeChar.mysteriousBoxId);
+					break;
+				
+				case 18220:
+				case 18221:
+				case 18222:
+				case 18223:
+				case 18224:
+				case 18225:
+				case 18226:
+				case 18227:
+				case 18228:
+				case 18229:
+				case 18230:
+				case 18231:
+				case 18232:
+				case 18233:
+				case 18234:
+				case 18235:
+				case 18236:
+				case 18237:
+				case 18238:
+				case 18239:
+				case 18240:
+					FourSepulchersManager.getInstance().spawnArchonOfHalisha(_activeChar.mysteriousBoxId);
+					break;
+				
+				case 25339:
+				case 25342:
+				case 25346:
+				case 25349:
+					FourSepulchersManager.getInstance().spawnEmperorsGraveNpc(_activeChar.mysteriousBoxId);
+					break;
+			}
+		}
+	}
+
+	private class ChangeImmortal implements Runnable
+	{
+		L2SepulcherMonsterInstance activeChar;
+
+		public ChangeImmortal(L2SepulcherMonsterInstance mob)
+		{
+			activeChar = mob;
+		}
+
+		public void run()
+		{
+			L2Skill fp = SkillTable.getInstance().getInfo(4616, 1); // Invulnerable	by petrification
+			fp.getEffects(activeChar, activeChar);
+		}
+	}
+
+	@Override
+	public boolean isAutoAttackable(L2Character attacker)
+	{
+			return true;
+	}
+}

+ 459 - 0
L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2SepulcherNpcInstance.java

@@ -0,0 +1,459 @@
+/*
+ * This program is free software: you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License as published by the Free Software
+ * Foundation, either version 3 of the License, or (at your option) any later
+ * version.
+ * 
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ * 
+ * You should have received a copy of the GNU General Public License along with
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package net.sf.l2j.gameserver.model.actor.instance;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.concurrent.Future;
+
+import javolution.util.FastMap;
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.ThreadPoolManager;
+import net.sf.l2j.gameserver.ai.CtrlIntention;
+import net.sf.l2j.gameserver.datatables.DoorTable;
+import net.sf.l2j.gameserver.instancemanager.FourSepulchersManager;
+import net.sf.l2j.gameserver.model.L2ItemInstance;
+import net.sf.l2j.gameserver.model.L2World;
+import net.sf.l2j.gameserver.model.quest.Quest;
+import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
+import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
+import net.sf.l2j.gameserver.network.serverpackets.MyTargetSelected;
+import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
+import net.sf.l2j.gameserver.network.serverpackets.SocialAction;
+import net.sf.l2j.gameserver.network.serverpackets.StatusUpdate;
+import net.sf.l2j.gameserver.network.serverpackets.ValidateLocation;
+import net.sf.l2j.gameserver.templates.L2NpcTemplate;
+import net.sf.l2j.gameserver.util.Util;
+import net.sf.l2j.util.Rnd;
+
+/**
+ * 
+ * @author sandman
+ */
+public class L2SepulcherNpcInstance extends L2NpcInstance
+{
+	protected static Map<Integer, Integer> _hallGateKeepers = new FastMap<Integer, Integer>();
+
+	protected Future<?> _closeTask = null;
+	protected Future<?> _spawnNextMysteriousBoxTask = null;
+	protected Future<?> _spawnMonsterTask = null;
+	
+	private final static String HTML_FILE_PATH = "data/html/SepulcherNpc/";
+	private final static int HALLS_KEY = 7260;
+
+	public L2SepulcherNpcInstance(int objectID, L2NpcTemplate template)
+	{
+		super(objectID, template);
+		setShowSummonAnimation(true);
+
+		if (_closeTask != null)
+			_closeTask.cancel(true);
+		if (_spawnNextMysteriousBoxTask != null)
+			_spawnNextMysteriousBoxTask.cancel(true);
+		if (_spawnMonsterTask != null)
+			_spawnMonsterTask.cancel(true);
+		_closeTask = null;
+		_spawnNextMysteriousBoxTask = null;
+		_spawnMonsterTask = null;
+	}
+
+	@Override
+	public void onSpawn()
+	{
+		super.onSpawn();
+		setShowSummonAnimation(false);
+	}
+
+	@Override
+	public void deleteMe()
+	{
+		if (_closeTask != null)
+		{
+			_closeTask.cancel(true);
+			_closeTask = null;
+		}
+		if (_spawnNextMysteriousBoxTask != null)
+		{
+			_spawnNextMysteriousBoxTask.cancel(true);
+			_spawnNextMysteriousBoxTask = null;
+		}
+		if (_spawnMonsterTask != null)
+		{
+			_spawnMonsterTask.cancel(true);
+			_spawnMonsterTask = null;
+		}
+		super.deleteMe();
+	}
+
+	@Override
+	public void onAction(L2PcInstance player)
+	{
+		if (!canTarget(player))
+			return;
+
+		// Check if the L2PcInstance already target the L2NpcInstance
+		if (this != player.getTarget())
+		{
+			if (Config.DEBUG)
+				_log.info("new target selected:" + getObjectId());
+			
+			// Set the target of the L2PcInstance player
+			player.setTarget(this);
+			
+			
+			// Check if the player is attackable (without a forced attack)
+			if (isAutoAttackable(player))
+			{
+				// Send a Server->Client packet MyTargetSelected to the
+				// L2PcInstance player
+				// The player.getLevel() - getLevel() permit to display the
+				// correct color in the select window
+				MyTargetSelected my = new MyTargetSelected(getObjectId(), player.getLevel()
+				        - getLevel());
+				player.sendPacket(my);
+				
+				// Send a Server->Client packet StatusUpdate of the
+				// L2NpcInstance to the L2PcInstance to update its HP bar
+				StatusUpdate su = new StatusUpdate(getObjectId());
+				su.addAttribute(StatusUpdate.CUR_HP, (int) getStatus().getCurrentHp());
+				su.addAttribute(StatusUpdate.MAX_HP, getMaxHp());
+				player.sendPacket(su);
+			}
+			else
+			{
+				// Send a Server->Client packet MyTargetSelected to the
+				// L2PcInstance player
+				MyTargetSelected my = new MyTargetSelected(getObjectId(), 0);
+				player.sendPacket(my);
+			}
+			
+			// Send a Server->Client packet ValidateLocation to correct the
+			// L2NpcInstance position and heading on the client
+			player.sendPacket(new ValidateLocation(this));
+		}
+		else
+		{
+			// Check if the player is attackable (without a forced attack) and
+			// isn't dead
+			if (isAutoAttackable(player) && !isAlikeDead())
+			{
+				// Check the height difference
+				if (Math.abs(player.getZ() - getZ()) < 400) // this max heigth
+															// difference might
+															// need some tweaking
+				{
+					// Set the L2PcInstance Intention to AI_INTENTION_ATTACK
+					player.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, this);
+				}
+				else
+				{
+					// Send a Server->Client packet ActionFailed (target is out
+					// of attack range) to the L2PcInstance player
+					player.sendPacket(ActionFailed.STATIC_PACKET);
+				}
+			}
+			
+			if (!isAutoAttackable(player))
+			{
+				// Calculate the distance between the L2PcInstance and the
+				// L2NpcInstance
+				if (!canInteract(player))
+				{
+					// Notify the L2PcInstance AI with AI_INTENTION_INTERACT
+					player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this);
+				}
+				else
+				{
+					// Send a Server->Client packet SocialAction to the all
+					// L2PcInstance on the _knownPlayer of the L2NpcInstance
+					// to display a social action of the L2NpcInstance on their
+					// client
+					SocialAction sa = new SocialAction(getObjectId(), Rnd.get(8));
+					broadcastPacket(sa);
+					
+					doAction(player);
+				}
+			}
+			// Send a Server->Client ActionFailed to the L2PcInstance in order
+			// to avoid that the client wait another packet
+			player.sendPacket(ActionFailed.STATIC_PACKET);
+		}
+	}
+	private void doAction(L2PcInstance player)
+	{
+		if (isDead())
+		{
+			player.sendPacket(ActionFailed.STATIC_PACKET);
+			return;
+		}
+		
+		switch (getNpcId())
+		{
+			case 31468:
+			case 31469:
+			case 31470:
+			case 31471:
+			case 31472:
+			case 31473:
+			case 31474:
+			case 31475:
+			case 31476:
+			case 31477:
+			case 31478:
+			case 31479:
+			case 31480:
+			case 31481:
+			case 31482:
+			case 31483:
+			case 31484:
+			case 31485:
+			case 31486:
+			case 31487:
+				setIsInvul(false);
+				reduceCurrentHp(getMaxHp() + 1, player);
+				if (_spawnMonsterTask != null)
+					_spawnMonsterTask.cancel(true);
+				_spawnMonsterTask = ThreadPoolManager.getInstance().scheduleEffect(new SpawnMonster(getNpcId()), 3500);
+				break;
+			
+			case 31455:
+			case 31456:
+			case 31457:
+			case 31458:
+			case 31459:
+			case 31460:
+			case 31461:
+			case 31462:
+			case 31463:
+			case 31464:
+			case 31465:
+			case 31466:
+			case 31467:
+				setIsInvul(false);
+				reduceCurrentHp(getMaxHp() + 1, player);
+				if (player.getParty() != null && !player.getParty().isLeader(player))
+					player = player.getParty().getLeader();
+				player.addItem("Quest", HALLS_KEY, 1, player, true);
+				break;
+			
+			default:
+			{
+            	Quest[] qlsa = getTemplate().getEventQuests(Quest.QuestEventType.QUEST_START);
+            	if ( (qlsa != null) && qlsa.length > 0)
+            		player.setLastQuestNpcObject(getObjectId());
+            	Quest[] qlst = getTemplate().getEventQuests(Quest.QuestEventType.ON_FIRST_TALK);
+            	if ( (qlst != null) && qlst.length == 1)
+            		qlst[0].notifyFirstTalk(this, player);
+            	else
+            		showChatWindow(player, 0);
+			}
+		}
+		player.sendPacket(ActionFailed.STATIC_PACKET);
+	}
+	
+	
+	@Override
+	public String getHtmlPath(int npcId, int val)
+	{
+		String pom = "";
+		if (val == 0)
+		{
+			pom = "" + npcId;
+		}
+		else
+		{
+			pom = npcId + "-" + val;
+		}
+		
+		return HTML_FILE_PATH + pom + ".htm";
+	}
+	
+	
+	@Override
+	public void showChatWindow(L2PcInstance player, int val)
+	{
+		String filename = getHtmlPath(getNpcId(), val);
+		NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
+		html.setFile(filename);
+		html.replace("%objectId%", String.valueOf(getObjectId()));
+		player.sendPacket(html);
+		player.sendPacket(ActionFailed.STATIC_PACKET);
+	}
+	
+	
+	@Override
+	public void onBypassFeedback(L2PcInstance player, String command)
+	{
+		if (isBusy())
+		{
+			NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
+			html.setFile("data/html/npcbusy.htm");
+			html.replace("%busymessage%", getBusyMessage());
+			html.replace("%npcname%", getName());
+			html.replace("%playername%", player.getName());
+			player.sendPacket(html);
+		}
+		else if (command.startsWith("Chat"))
+		{
+			int val = 0;
+			try
+			{
+				val = Integer.parseInt(command.substring(5));
+			}
+			catch (IndexOutOfBoundsException ioobe)
+			{
+			}
+			catch (NumberFormatException nfe)
+			{
+			}
+			showChatWindow(player, val);
+		}
+		else if (command.startsWith("open_gate"))
+		{
+			L2ItemInstance hallsKey = player.getInventory().getItemByItemId(HALLS_KEY);
+			if (hallsKey == null)
+			{
+				showHtmlFile(player, "Gatekeeper-no.htm");
+			}
+			else if (FourSepulchersManager.getInstance().isAttackTime())
+			{
+				switch (getNpcId())
+				{
+					case 31929:
+					case 31934:
+					case 31939:
+					case 31944:
+						FourSepulchersManager.getInstance().spawnShadow(getNpcId());
+                        break;
+					default:
+					{
+						openNextDoor(getNpcId());
+						if (player.getParty() != null)
+						{
+							for (L2PcInstance mem : player.getParty().getPartyMembers())
+							{
+								if (mem.getInventory().getItemByItemId(HALLS_KEY) != null)
+									mem.destroyItemByItemId("Quest", HALLS_KEY, mem.getInventory().getItemByItemId(HALLS_KEY).getCount(), mem, true);
+							}
+						}
+						else
+							player.destroyItemByItemId("Quest", HALLS_KEY, hallsKey.getCount(), player, true);
+					}
+				}
+			}
+		}
+		else
+		{
+			super.onBypassFeedback(player, command);
+		}
+	}
+	
+	
+	public void openNextDoor(int npcId)
+	{
+		int doorId = FourSepulchersManager.getInstance().getHallGateKeepers().get(npcId).intValue();
+		DoorTable _doorTable = DoorTable.getInstance();
+		_doorTable.getDoor(doorId).openMe();
+		
+		if (_closeTask != null)
+			_closeTask.cancel(true);
+		_closeTask = ThreadPoolManager.getInstance().scheduleEffect(new CloseNextDoor(doorId), 10000);
+		if (_spawnNextMysteriousBoxTask != null)
+			_spawnNextMysteriousBoxTask.cancel(true);
+		_spawnNextMysteriousBoxTask = ThreadPoolManager.getInstance().scheduleEffect(new SpawnNextMysteriousBox(npcId), 0);
+	}
+	
+	
+	
+	private class CloseNextDoor implements Runnable
+	{
+		final DoorTable _DoorTable = DoorTable.getInstance();
+
+		private int _DoorId;
+
+		public CloseNextDoor(int doorId)
+		{
+			_DoorId = doorId;
+		}
+
+		@SuppressWarnings("synthetic-access")
+		public void run()
+		{
+			try
+			{
+				_DoorTable.getDoor(_DoorId).closeMe();
+			}
+			catch (Exception e)
+			{
+				_log.warning(e.getMessage());
+			}
+		}
+	}
+
+	private class SpawnNextMysteriousBox implements Runnable
+	{
+		private int _NpcId;
+
+		public SpawnNextMysteriousBox(int npcId)
+		{
+			_NpcId = npcId;
+		}
+		
+		public void run()
+		{
+			FourSepulchersManager.getInstance().spawnMysteriousBox(_NpcId);
+		}
+	}
+
+	private class SpawnMonster implements Runnable
+	{
+		private int _NpcId;
+		
+		public SpawnMonster(int npcId)
+		{
+			_NpcId = npcId;
+		}
+		
+		public void run()
+		{
+			FourSepulchersManager.getInstance().spawnMonster(_NpcId);
+		}
+	}
+	
+	public void sayInShout(String msg)
+	{
+		if (msg == null || msg == "")
+			return;// wrong usage
+		Collection<L2PcInstance> knownPlayers = L2World.getInstance().getAllPlayers().values();
+		if (knownPlayers == null || knownPlayers.isEmpty())
+			return;
+		CreatureSay sm = new CreatureSay(0, 1, this.getName(), msg);
+		for (L2PcInstance player : knownPlayers)
+		{
+			if (player == null)
+				continue;
+			if (Util.checkIfInRange(15000, player, this, true))
+				player.sendPacket(sm);
+		}
+	}
+
+	public void showHtmlFile(L2PcInstance player, String file)
+	{
+		NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
+		html.setFile("data/html/SepulcherNpc/" + file);
+		html.replace("%npcname%", getName());
+		player.sendPacket(html);
+	}
+}

+ 0 - 1
L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2StaticObjectInstance.java

@@ -146,7 +146,6 @@ public class L2StaticObjectInstance extends L2Object
      * @see net.sf.l2j.gameserver.model.L2Object#isAttackable()
      */
     @Override
-    @SuppressWarnings("unused")
     public boolean isAutoAttackable(L2Character attacker)
     {
         return false;

+ 1 - 1
L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2SymbolMakerInstance.java

@@ -95,7 +95,7 @@ public class L2SymbolMakerInstance extends L2FolkInstance
      * @see net.sf.l2j.gameserver.model.L2Object#isAttackable()
      */
     @Override
-	public boolean isAutoAttackable(@SuppressWarnings("unused") L2Character attacker)
+	public boolean isAutoAttackable(L2Character attacker)
     {
         return false;
     }

+ 5 - 0
L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2TeleporterInstance.java

@@ -160,7 +160,9 @@ public final class L2TeleporterInstance extends L2FolkInstance
         {
             if (condition == COND_BUSY_BECAUSE_OF_SIEGE) filename = "data/html/teleporter/castleteleporter-busy.htm"; // Busy because of siege
             else if (condition == COND_OWNER) // Clan owns castle
+            {
                 filename = getHtmlPath(getNpcId(), 0); // Owner message window
+            }
         }
 
         NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
@@ -173,6 +175,9 @@ public final class L2TeleporterInstance extends L2FolkInstance
     private void doTeleport(L2PcInstance player, int val)
     {
         L2TeleportLocation list = TeleportLocationTable.getInstance().getTemplate(val);
+        // from CT2 all players up to lvl 40 have all ports for free
+        if (player.getLevel() <=40)
+        	list.setPrice(0);
         if (list != null)
         {
             //you cannot teleport to village that is in siege

+ 18 - 6
L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java

@@ -37,6 +37,7 @@ import net.sf.l2j.gameserver.model.base.SubClass;
 import net.sf.l2j.gameserver.model.entity.Castle;
 import net.sf.l2j.gameserver.model.quest.QuestState;
 import net.sf.l2j.gameserver.network.SystemMessageId;
+import net.sf.l2j.gameserver.network.serverpackets.AcquireSkillDone;
 import net.sf.l2j.gameserver.network.serverpackets.AcquireSkillList;
 import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
 import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
@@ -823,11 +824,19 @@ public final class L2VillageMasterInstance extends L2FolkInstance
     {
         if (Config.DEBUG)
             _log.fine("PledgeSkillList activated on: "+getObjectId());
-        if(player.getClan() == null)
-        	return;
-        
-        if (player.isTransformed())
+        NpcHtmlMessage html = new NpcHtmlMessage(1);
+        if(player.getClan() == null || !player.isClanLeader())
+        {
+            TextBuilder sb = new TextBuilder();
+            sb.append("<html><body>");
+            sb.append("<br><br>You're not qualified to learn Clan skills.");
+            sb.append("</body></html>");
+            html.setHtml(sb.toString());
+            player.sendPacket(html);
+            player.sendPacket(ActionFailed.STATIC_PACKET);
         	return;
+        }
+        	
 
         L2PledgeSkillLearn[] skills = SkillTreeTable.getInstance().getAvailablePledgeSkills(player);
         AcquireSkillList asl = new AcquireSkillList(AcquireSkillList.skillType.Clan);
@@ -843,13 +852,16 @@ public final class L2VillageMasterInstance extends L2FolkInstance
 
         if (counts == 0)
         {
-            NpcHtmlMessage html = new NpcHtmlMessage(1);
 
             if (player.getClan().getLevel() < 8)
             {
                 SystemMessage sm = new SystemMessage(SystemMessageId.DO_NOT_HAVE_FURTHER_SKILLS_TO_LEARN);
-                sm.addNumber(player.getClan().getLevel()+1);
+                if (player.getClan().getLevel() < 5)
+                	sm.addNumber(5);
+                else
+                	sm.addNumber(player.getClan().getLevel()+1);
                 player.sendPacket(sm);
+                player.sendPacket(new AcquireSkillDone());
             }
             else
             {

+ 1 - 2
L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2XmassTreeInstance.java

@@ -100,8 +100,7 @@ public class L2XmassTreeInstance extends L2NpcInstance
      * @see net.sf.l2j.gameserver.model.L2Object#isAttackable()
      */
     @Override
-	public boolean isAutoAttackable(@SuppressWarnings("unused")
-    L2Character attacker)
+	public boolean isAutoAttackable(L2Character attacker)
     {
         return false;
     }

+ 0 - 1
L2_GameServer/java/net/sf/l2j/gameserver/model/actor/knownlist/PcKnownList.java

@@ -88,7 +88,6 @@ public class PcKnownList extends PlayableKnownList
      */
     @Override
 	public boolean addKnownObject(L2Object object) { return addKnownObject(object, null); }
-    @SuppressWarnings("cast")
     @Override
 	public boolean addKnownObject(L2Object object, L2Character dropper)
     {

+ 2 - 2
L2_GameServer/java/net/sf/l2j/gameserver/model/entity/Auction.java

@@ -512,5 +512,5 @@ public class Auction
 	public final String getSellerName() { return _sellerName; }
     public final String getSellerClanName() { return _sellerClanName; }
 	public final int getStartingBid() { return _startingBid; }
-    public final Map<Integer, Bidder> getBidders(){ return _bidders; };
-}
+    public final Map<Integer, Bidder> getBidders(){ return _bidders; }
+}

+ 2 - 2
L2_GameServer/java/net/sf/l2j/gameserver/model/entity/FortSiege.java

@@ -834,7 +834,7 @@ public class FortSiege
             default:
                 players = getPlayersInZone();
         }
-        ;
+        
 
         for (L2PcInstance player : players)
         {
@@ -1329,4 +1329,4 @@ public class FortSiege
         }
         return _siegeGuardManager;
     }
-}
+}

+ 2 - 2
L2_GameServer/java/net/sf/l2j/gameserver/model/entity/Siege.java

@@ -879,7 +879,7 @@ public class Siege
             default:
                 players = getPlayersInZone();
         }
-        ;
+        
 
         for (L2PcInstance player : players)
         {
@@ -1400,4 +1400,4 @@ public class Siege
         }
         return _siegeGuardManager;
     }
-}
+}

+ 96 - 29
L2_GameServer/java/net/sf/l2j/gameserver/model/quest/Quest.java

@@ -20,6 +20,7 @@ import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.util.Collection;
 import java.util.Map;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -59,6 +60,8 @@ public class Quest extends ManagedScript
 	/** HashMap containing lists of timers from the name of the timer */
 	private Map<String, FastList<QuestTimer>> _allEventTimers = new FastMap<String, FastList<QuestTimer>>();
 
+	private final ReentrantReadWriteLock _rwLock = new ReentrantReadWriteLock();
+	
 	private final int _questId;
 	private final String _name;
 	private final String _descr;
@@ -107,7 +110,7 @@ public class Quest extends ManagedScript
 	 */
 	protected void init_LoadGlobalData()
 	{
-		;
+		
 	}
 	
 	/**
@@ -118,7 +121,7 @@ public class Quest extends ManagedScript
 	 */
 	public void saveGlobalData()
 	{
-		;
+		
 	}
 
 	public static enum QuestEventType 
@@ -229,35 +232,74 @@ public class Quest extends ManagedScript
             // if there exists a timer with this name, allow the timer only if the [npc, player] set is unique
             // nulls act as wildcards
             if(getQuestTimer(name, npc, player)==null)
-                timers.add(new QuestTimer(this, name, time, npc, player, repeating));
+            {
+	    		try
+	    		{
+	    			_rwLock.writeLock().lock();
+	    			timers.add(new QuestTimer(this, name, time, npc, player, repeating));
+	    		}
+	    		finally
+	    		{
+	    			_rwLock.writeLock().unlock();
+	    		}
+            }	
         }
         // ignore the startQuestTimer in all other cases (timer is already started)
     }
 
     public QuestTimer getQuestTimer(String name, L2NpcInstance npc, L2PcInstance player)
     {
-    	FastList<QuestTimer> qt = _allEventTimers.get(name);
+    	FastList<QuestTimer> qt = getQuestTimers(name);
 		
 		if (qt == null || qt.isEmpty())
 			return null;
-		
-		for (QuestTimer timer : qt)
+		try
 		{
-			if (timer != null)
+			_rwLock.readLock().lock();
+			for (QuestTimer timer : qt)
 			{
-				if (timer.isMatch(this, name, npc, player))
-					return timer;
+				if (timer != null)
+				{
+					if (timer.isMatch(this, name, npc, player))
+						return timer;
+				}
 			}
+			
+		}
+		finally
+		{
+			_rwLock.readLock().unlock();
 		}
-		
 		return null;
     }
 
-    public FastList<QuestTimer> getQuestTimers(String name)
+    private FastList<QuestTimer> getQuestTimers(String name)
     {
     	return _allEventTimers.get(name);
     }
     
+    public void cancelQuestTimers(String name)
+    {
+    	FastList<QuestTimer> timers = getQuestTimers(name);
+    	if (timers == null)
+    		return;
+		try
+		{
+			_rwLock.writeLock().lock();
+	        for(QuestTimer timer :timers)
+	        {
+	        	if (timer != null)
+	        	{
+	        		timer.cancel();
+	        	}
+	        }
+		}
+		finally
+		{
+			_rwLock.writeLock().unlock();
+		}
+    }
+
     public void cancelQuestTimer(String name, L2NpcInstance npc, L2PcInstance player)
     {
     	QuestTimer timer = getQuestTimer(name, npc, player);
@@ -272,7 +314,15 @@ public class Quest extends ManagedScript
     	FastList<QuestTimer> timers = getQuestTimers(timer.getName());
     	if (timers == null)
     		return;
-    	timers.remove(timer);    		
+		try
+		{
+			_rwLock.writeLock().lock();
+			timers.remove(timer);
+		}
+		finally
+		{
+			_rwLock.writeLock().unlock();
+		}
     }
 	
     
@@ -311,10 +361,12 @@ public class Quest extends ManagedScript
 	public final boolean notifyFirstTalk (L2NpcInstance npc, L2PcInstance player) {
 		String res = null;
 		try { res = onFirstTalk(npc, player); } catch (Exception e) { return showError(player, e); }
-		player.setLastQuestNpcObject(npc.getObjectId());
-		// if the quest returns text to display, display it.  Otherwise, use the default npc text.
+		// if the quest returns text to display, display it.
 		if (res!=null && res.length()>0)
 			return showResult(player, res);
+		// else tell the player that
+		else 
+			player.sendPacket(ActionFailed.STATIC_PACKET);
 		// note: if the default html for this npc needs to be shown, onFirstTalk should 
 		// call npc.showChatWindow(player) and then return null.
 		return true;
@@ -356,8 +408,8 @@ public class Quest extends ManagedScript
 
 
 	// these are methods that java calls to invoke scripts
-    @SuppressWarnings("unused") public String onAttack(L2NpcInstance npc, L2PcInstance attacker, int damage, boolean isPet) { return null; } 
-    @SuppressWarnings("unused") public String onDeath (L2Character killer, L2Character victim, QuestState qs) 
+    public String onAttack(L2NpcInstance npc, L2PcInstance attacker, int damage, boolean isPet) { return null; } 
+    public String onDeath (L2Character killer, L2Character victim, QuestState qs) 
     { 	
     	if (killer instanceof L2NpcInstance)
     		return onAdvEvent("", (L2NpcInstance)killer,qs.getPlayer()); 
@@ -365,7 +417,7 @@ public class Quest extends ManagedScript
     		return onAdvEvent("", null,qs.getPlayer());
     }
     
-    @SuppressWarnings("unused") public String onAdvEvent(String event, L2NpcInstance npc, L2PcInstance player) 
+    public String onAdvEvent(String event, L2NpcInstance npc, L2PcInstance player) 
     {
     	// if not overridden by a subclass, then default to the returned value of the simpler (and older) onEvent override
     	// if the player has a state, use it as parameter in the next call, else return null
@@ -376,14 +428,14 @@ public class Quest extends ManagedScript
     	return null; 
     } 
     
-    @SuppressWarnings("unused") public String onEvent(String event, QuestState qs) { return null; } 
-    @SuppressWarnings("unused") public String onKill (L2NpcInstance npc, L2PcInstance killer, boolean isPet) { return null; }
-    @SuppressWarnings("unused") public String onTalk (L2NpcInstance npc, L2PcInstance talker) { return null; }
-    @SuppressWarnings("unused") public String onFirstTalk(L2NpcInstance npc, L2PcInstance player) { return null; } 
-    @SuppressWarnings("unused") public String onSkillSee (L2NpcInstance npc, L2PcInstance caster, L2Skill skill, L2Object[] targets, boolean isPet) { return null; }
-    @SuppressWarnings("unused") public String onSpawn (L2NpcInstance npc) { return null; }
-    @SuppressWarnings("unused") public String onFactionCall (L2NpcInstance npc, L2NpcInstance caller, L2PcInstance attacker, boolean isPet) { return null; }
-    @SuppressWarnings("unused") public String onAggroRangeEnter (L2NpcInstance npc, L2PcInstance player, boolean isPet) { return null; }
+    public String onEvent(String event, QuestState qs) { return null; } 
+    public String onKill (L2NpcInstance npc, L2PcInstance killer, boolean isPet) { return null; }
+    public String onTalk (L2NpcInstance npc, L2PcInstance talker) { return null; }
+    public String onFirstTalk(L2NpcInstance npc, L2PcInstance player) { return null; } 
+    public String onSkillSee (L2NpcInstance npc, L2PcInstance caster, L2Skill skill, L2Object[] targets, boolean isPet) { return null; }
+    public String onSpawn (L2NpcInstance npc) { return null; }
+    public String onFactionCall (L2NpcInstance npc, L2NpcInstance caller, L2PcInstance attacker, boolean isPet) { return null; }
+    public String onAggroRangeEnter (L2NpcInstance npc, L2PcInstance player, boolean isPet) { return null; }
     
 	/**
 	 * Show message error to player who has an access level greater than 0
@@ -1068,10 +1120,25 @@ public class Quest extends ManagedScript
      */
 	public L2NpcInstance addSpawn(int npcId, L2Character cha)
 	{
-	    return addSpawn(npcId, cha.getX(), cha.getY(), cha.getZ(), cha.getHeading(), false, 0);
+	    return addSpawn(npcId, cha.getX(), cha.getY(), cha.getZ(), cha.getHeading(), false, 0, false);
 	}
-	
-    public L2NpcInstance addSpawn(int npcId, int x, int y, int z,int heading, boolean randomOffset, int despawnDelay)
+
+    /**
+     * Add a temporary (quest) spawn
+     * Return instance of newly spawned npc
+     * with summon animation
+     */
+	public L2NpcInstance addSpawn(int npcId, L2Character cha, boolean isSummonSpawn)
+	{
+	    return addSpawn(npcId, cha.getX(), cha.getY(), cha.getZ(), cha.getHeading(), false, 0, isSummonSpawn);
+	}
+
+	public L2NpcInstance addSpawn(int npcId, int x, int y, int z,int heading, boolean randomOffSet, int despawnDelay)
+	{
+	    return addSpawn(npcId, x, y, z, heading, randomOffSet, despawnDelay, false);
+	}
+
+	public L2NpcInstance addSpawn(int npcId, int x, int y, int z,int heading, boolean randomOffset, int despawnDelay, boolean isSummonSpawn)
     {
     	L2NpcInstance result = null;
         try 
@@ -1109,7 +1176,7 @@ public class Quest extends ManagedScript
                 spawn.setLocy(y);
                 spawn.setLocz(z+20);
                 spawn.stopRespawn();
-                result = spawn.spawnOne();
+                result = spawn.spawnOne(isSummonSpawn);
 
 	            if (despawnDelay > 0)
 		            ThreadPoolManager.getInstance().scheduleGeneral(new DeSpawnScheduleTimerTask(result), despawnDelay);

+ 10 - 1
L2_GameServer/java/net/sf/l2j/gameserver/model/quest/QuestState.java

@@ -759,7 +759,16 @@ public final class QuestState
      */
     public L2NpcInstance addSpawn(int npcId, int x, int y, int z,int heading, boolean randomOffset, int despawnDelay)
     {
-    	return getQuest().addSpawn(npcId, x, y, z, heading, randomOffset, despawnDelay);
+    	return getQuest().addSpawn(npcId, x, y, z, heading, randomOffset, despawnDelay, false);
+    }
+
+    /**
+     * Add spawn for player instance
+     * Return object id of newly spawned npc
+     */
+    public L2NpcInstance addSpawn(int npcId, int x, int y, int z,int heading, boolean randomOffset, int despawnDelay, boolean isSummonSpawn)
+    {
+    	return getQuest().addSpawn(npcId, x, y, z, heading, randomOffset, despawnDelay, isSummonSpawn);
     }
 
 	public String showHtmlFile(String fileName)

+ 1 - 2
L2_GameServer/java/net/sf/l2j/gameserver/model/waypoint/WayPointNode.java

@@ -66,8 +66,7 @@ public class WayPointNode extends L2Object
      * @see net.sf.l2j.gameserver.model.L2Object#isAutoAttackable(net.sf.l2j.gameserver.model.L2Character)
      */
     @Override
-	public boolean isAutoAttackable(@SuppressWarnings("unused")
-    L2Character attacker)
+	public boolean isAutoAttackable(L2Character attacker)
     {
         return false;
     }

+ 6 - 2
L2_GameServer/java/net/sf/l2j/gameserver/model/zone/L2ZoneType.java

@@ -322,7 +322,11 @@ public abstract class L2ZoneType
 
 	protected abstract void onEnter(L2Character character);
 	protected abstract void onExit(L2Character character);
-	protected abstract void onDieInside(L2Character character);
-	protected abstract void onReviveInside(L2Character character);
+	public abstract void onDieInside(L2Character character);
+	public abstract void onReviveInside(L2Character character);
 
+	public FastMap<Integer, L2Character> getCharactersInside()
+	{
+		return _characterList;
+	}
 }

+ 2 - 2
L2_GameServer/java/net/sf/l2j/gameserver/model/zone/type/L2ArenaZone.java

@@ -83,10 +83,10 @@ public class L2ArenaZone extends L2ZoneType
 	}
 
 	@Override
-	protected void onDieInside(L2Character character) {}
+    public void onDieInside(L2Character character) {}
 
 	@Override
-	protected void onReviveInside(L2Character character) {}
+    public void onReviveInside(L2Character character) {}
 
 	public final int[] getSpawnLoc()
     {

Some files were not shown because too many files changed in this diff