Forráskód Böngészése

Updating Zone handling. Thx Kerberos :)

GodKratos 16 éve
szülő
commit
d9cf2e6bdb

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

@@ -23,12 +23,12 @@ import java.util.logging.Logger;
 import net.sf.l2j.Config;
 import net.sf.l2j.L2DatabaseFactory;
 import net.sf.l2j.gameserver.SevenSigns;
-import net.sf.l2j.gameserver.instancemanager.ArenaManager;
 import net.sf.l2j.gameserver.instancemanager.CastleManager;
 import net.sf.l2j.gameserver.instancemanager.ClanHallManager;
 import net.sf.l2j.gameserver.instancemanager.FortManager;
 import net.sf.l2j.gameserver.instancemanager.InstanceManager;
 import net.sf.l2j.gameserver.instancemanager.TownManager;
+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.L2NpcInstance;
@@ -495,7 +495,7 @@ public class MapRegionTable
 			}
 			
 			// Checking if in arena
-			L2ArenaZone arena = ArenaManager.getInstance().getArena(player);
+			L2ArenaZone arena = ZoneManager.getInstance().getArena(player);
 			if (arena != null)
 			{
 				coord = arena.getSpawnLoc();
@@ -511,7 +511,7 @@ public class MapRegionTable
 					if ((castle.getSiege().checkIsDefender(player.getClan()) ||	castle.getSiege().checkIsAttacker(player.getClan())) 
 							&& SevenSigns.getInstance().getSealOwner(SevenSigns.SEAL_STRIFE) == SevenSigns.CABAL_DAWN)
 					{
-						coord = TownManager.getInstance().getSecondClosestTown(activeChar).getSpawnLoc();
+						coord = TownManager.getSecondClosestTown(activeChar).getSpawnLoc();
 						return new Location(coord[0], coord[1], coord[2]);
 					}
 				}
@@ -530,7 +530,7 @@ public class MapRegionTable
 		
 		// Get the nearest town
 		// TODO: Micht: Maybe we should add some checks to prevent exception here.
-		coord = TownManager.getInstance().getClosestTown(activeChar).getSpawnLoc();
+		coord = TownManager.getClosestTown(activeChar).getSpawnLoc();
 		
 		return new Location(coord[0], coord[1], coord[2]);
 	}

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

@@ -17,7 +17,7 @@ package net.sf.l2j.gameserver.handler.skillhandlers;
 import net.sf.l2j.Config;
 import net.sf.l2j.gameserver.GeoData;
 import net.sf.l2j.gameserver.handler.ISkillHandler;
-import net.sf.l2j.gameserver.instancemanager.FishingZoneManager;
+import net.sf.l2j.gameserver.instancemanager.ZoneManager;
 import net.sf.l2j.gameserver.model.L2Character;
 import net.sf.l2j.gameserver.model.L2ItemInstance;
 import net.sf.l2j.gameserver.model.L2Object;
@@ -129,8 +129,8 @@ public class Fishing implements ISkillHandler
 		 * proceed past here... in that case, the hook will be positioned using
 		 * the old Z lookup method.
 		 */
-		L2FishingZone aimingTo = FishingZoneManager.getInstance().isInsideFishingZone(x, y, z);
-		L2WaterZone water = FishingZoneManager.getInstance().isInsideWaterZone(x, y, z);
+		L2FishingZone aimingTo = ZoneManager.getInstance().getFishingZone(x, y, z);
+		L2WaterZone water = ZoneManager.getInstance().getWaterZone(x, y, z);
 		if (aimingTo != null && water != null && (GeoData.getInstance().canSeeTarget(player.getX(), player.getY(), player.getZ() + 50, x, y, water.getWaterZ() - 50)))
 		{
 			z = water.getWaterZ() + 10;

+ 0 - 68
L2_GameServer/java/net/sf/l2j/gameserver/instancemanager/ArenaManager.java

@@ -1,68 +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.instancemanager;
-
-import java.util.logging.Logger;
-
-import javolution.util.FastList;
-import net.sf.l2j.gameserver.model.L2Character;
-import net.sf.l2j.gameserver.model.zone.type.L2ArenaZone;
-
-public class ArenaManager
-{
-    protected static final Logger _log = Logger.getLogger(ArenaManager.class.getName());
-    // =========================================================
-    private static ArenaManager _instance;
-    public static final ArenaManager getInstance()
-    {
-        if (_instance == null)
-        {
-    		_log.info("Initializing ArenaManager");
-        	_instance = new ArenaManager();
-        }
-        return _instance;
-    }
-    // =========================================================
-
-
-    // =========================================================
-    // Data Field
-    private FastList<L2ArenaZone> _arenas;
-
-    // =========================================================
-    // Constructor
-    public ArenaManager()
-    {
-    }
-
-    // =========================================================
-    // Property - Public
-
-    public void addArena(L2ArenaZone arena)
-    {
-    	if (_arenas == null)
-    		_arenas = new FastList<L2ArenaZone>();
-
-    	_arenas.add(arena);
-    }
-
-    public final L2ArenaZone getArena(L2Character character)
-    {
-    	for (L2ArenaZone temp : _arenas)
-    		if (temp.isCharacterInZone(character)) return temp;
-
-    	return null;
-    }
-}

+ 0 - 87
L2_GameServer/java/net/sf/l2j/gameserver/instancemanager/FishingZoneManager.java

@@ -1,87 +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.instancemanager;
-
-import java.util.logging.Logger;
-
-import javolution.util.FastList;
-import net.sf.l2j.gameserver.model.zone.type.L2FishingZone;
-import net.sf.l2j.gameserver.model.zone.type.L2WaterZone;
-
-public class FishingZoneManager
-{
-    protected static final Logger _log = Logger.getLogger(FishingZoneManager.class.getName());
-	// =========================================================
-	private static FishingZoneManager _instance;
-	public static final FishingZoneManager getInstance()
-	{
-		if (_instance == null)
-		{
-			_log.info("Initializing FishingZoneManager");
-			_instance = new FishingZoneManager();
-		}
-		return _instance;
-	}
-	// =========================================================
-
-
-	// =========================================================
-	// Data Field
-	private FastList<L2FishingZone> _fishingZones;
-	private FastList<L2WaterZone> _waterZones;
-
-	// =========================================================
-	// Constructor
-	public FishingZoneManager()
-	{
-	}
-
-	// =========================================================
-	// Property - Public
-
-	public void addFishingZone(L2FishingZone fishingZone)
-	{
-		if (_fishingZones == null)
-			_fishingZones = new FastList<L2FishingZone>();
-
-		_fishingZones.add(fishingZone);
-	}
-	public void addWaterZone(L2WaterZone waterZone)
-	{
-		if (_waterZones == null)
-			_waterZones = new FastList<L2WaterZone>();
-
-		_waterZones.add(waterZone);
-	}
-	/* isInsideFishingZone() - This function was modified to check the coordinates without caring for Z.
-	 * This allows for the player to fish off bridges, into the water, or from other similar high places. One
-	 * should be able to cast the line from up into the water, not only fishing whith one's feet wet. :)
-	 *
-	 *  TODO: Consider in the future, limiting the maximum height one can be above water, if we start getting
-	 *  "orbital fishing" players... xD
-	 */
-	public final L2FishingZone isInsideFishingZone(int x, int y, int z)
-	{
-		for (L2FishingZone temp : _fishingZones)
-			if (temp.isInsideZone(x, y, temp.getWaterZ() - 10)) return temp;
-		return null;
-	}
-	public final L2WaterZone isInsideWaterZone(int x, int y, int z)
-	{
-		for (L2WaterZone temp : _waterZones)
-			if (temp.isInsideZone(x, y, temp.getWaterZ())) return temp;
-		return null;
-	}
-}

+ 6 - 8
L2_GameServer/java/net/sf/l2j/gameserver/instancemanager/GrandBossManager.java

@@ -253,26 +253,26 @@ public class GrandBossManager
 	public final L2BossZone getZone(L2Character character)
 	{
 		if (_zones != null)
+		{
 			for (L2BossZone temp : _zones)
 			{
 				if (temp.isCharacterInZone(character))
-				{
 					return temp;
-				}
 			}
+		}
 		return null;
 	}
 
 	public final L2BossZone getZone(int x, int y, int z)
 	{
 		if (_zones != null)
+		{
 			for (L2BossZone temp : _zones)
 			{
 				if (temp.isInsideZone(x, y, z))
-				{
 					return temp;
-				}
 			}
+		}
 		return null;
 	}
 
@@ -280,9 +280,8 @@ public class GrandBossManager
 	{
 		L2BossZone temp = getZone(obj.getX(), obj.getY(), obj.getZ());
 		if (temp == null)
-		{
 			return false;
-		}
+		
 		return temp.getZoneName().equalsIgnoreCase(zoneType);
 	}
 
@@ -291,9 +290,8 @@ public class GrandBossManager
 		if (player == null) return false;
 		L2BossZone temp = getZone(player.getX(), player.getY(), player.getZ());
 		if (temp == null)
-		{
 			return false;
-		}
+
 		return true;
 	}
 	/*

+ 0 - 78
L2_GameServer/java/net/sf/l2j/gameserver/instancemanager/OlympiadStadiaManager.java

@@ -1,78 +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.instancemanager;
-
-import java.util.logging.Logger;
-
-import javolution.util.FastList;
-import net.sf.l2j.gameserver.model.L2Character;
-import net.sf.l2j.gameserver.model.zone.type.L2OlympiadStadiumZone;
-
-public class OlympiadStadiaManager
-{
-    protected static final Logger _log = Logger.getLogger(OlympiadStadiaManager.class.getName());
-
-    // =========================================================
-    private static OlympiadStadiaManager _instance;
-    public static final OlympiadStadiaManager getInstance()
-    {
-        if (_instance == null)
-        {
-            _log.info("Initializing OlympiadStadiaManager");
-            _instance = new OlympiadStadiaManager();
-        }
-        return _instance;
-    }
-    // =========================================================
-
-
-    // =========================================================
-    // Data Field
-    private FastList<L2OlympiadStadiumZone> _olympiadStadias;
-
-    // =========================================================
-    // Constructor
-    public OlympiadStadiaManager()
-    {
-    }
-
-    // =========================================================
-    // Property - Public
-
-    public void addStadium(L2OlympiadStadiumZone arena)
-    {
-    	if (_olympiadStadias == null)
-    		_olympiadStadias = new FastList<L2OlympiadStadiumZone>();
-
-    	_olympiadStadias.add(arena);
-    }
-
-    public final L2OlympiadStadiumZone getStadium(L2Character character)
-    {
-    	for (L2OlympiadStadiumZone temp : _olympiadStadias)
-    		if (temp.isCharacterInZone(character)) return temp;
-
-    	return null;
-    }
-
-    @Deprecated
-    public final L2OlympiadStadiumZone getOlympiadStadiumById(int olympiadStadiumId)
-    {
-    	for (L2OlympiadStadiumZone temp : _olympiadStadias)
-    		if (temp.getStadiumId() == olympiadStadiumId) return temp;
-        return null;
-    }
-
-}

+ 18 - 46
L2_GameServer/java/net/sf/l2j/gameserver/instancemanager/TownManager.java

@@ -14,54 +14,20 @@
  */
 package net.sf.l2j.gameserver.instancemanager;
 
-import java.util.logging.Logger;
-
-import javolution.util.FastList;
 import net.sf.l2j.gameserver.datatables.MapRegionTable;
 import net.sf.l2j.gameserver.model.L2Object;
 import net.sf.l2j.gameserver.model.entity.Castle;
+import net.sf.l2j.gameserver.model.zone.L2ZoneType;
 import net.sf.l2j.gameserver.model.zone.type.L2TownZone;
 
 public class TownManager
 {
-    private static final Logger _log = Logger.getLogger(TownManager.class.getName());
-
-    // =========================================================
-    private static TownManager _instance;
-    public static final TownManager getInstance()
-    {
-        if (_instance == null)
-        {
-    		_log.info("Initializing TownManager");
-        	_instance = new TownManager();
-        }
-        return _instance;
-    }
-    // =========================================================
-
-
-    // =========================================================
-    // Data Field
-    private FastList<L2TownZone> _towns;
-
-    // =========================================================
-    // Constructor
-    public TownManager()
-    {
-    }
+    //private static final Logger _log = Logger.getLogger(TownManager.class.getName());
 
     // =========================================================
     // Property - Public
 
-    public void addTown(L2TownZone arena)
-    {
-    	if (_towns == null)
-    		_towns = new FastList<L2TownZone>();
-
-    	_towns.add(arena);
-    }
-
-    public final L2TownZone getClosestTown(L2Object activeObject)
+    public final static L2TownZone getClosestTown(L2Object activeObject)
     {
         switch (MapRegionTable.getInstance().getMapRegion(activeObject.getPosition().getX(), activeObject.getPosition().getY()))
 		{
@@ -114,7 +80,7 @@ public class TownManager
         return getTown(16); // Default to floran
     }
 
-    public final L2TownZone getSecondClosestTown(L2Object activeObject)
+    public final static L2TownZone getSecondClosestTown(L2Object activeObject)
     {
         switch (MapRegionTable.getInstance().getMapRegion(activeObject.getPosition().getX(), activeObject.getPosition().getY()))
 		{
@@ -168,7 +134,7 @@ public class TownManager
     }
     
     
-    public final boolean townHasCastleInSiege(int townId)
+    public final static boolean townHasCastleInSiege(int townId)
     {
     	//int[] castleidarray = {0,0,0,0,0,0,0,1,2,3,4,0,5,0,0,6,0};
     	int[] castleidarray = {0,0,0,0,0,0,0,1,2,3,4,0,5,7,8,6,0,9,0,0,0,0,0};
@@ -183,7 +149,7 @@ public class TownManager
         return false;
     }
 
-    public final boolean townHasCastleInSiege(int x, int y)
+    public final static boolean townHasCastleInSiege(int x, int y)
     {
         int curtown= (MapRegionTable.getInstance().getMapRegion(x, y));
         //int[] castleidarray = {0,0,0,0,0,1,0,2,3,4,5,0,0,6,0,0,0,0};
@@ -199,10 +165,13 @@ public class TownManager
         return false;
     }
 
-    public final L2TownZone getTown(int townId)
+    public final static L2TownZone getTown(int townId)
     {
-        for (L2TownZone temp : _towns)
-        	if (temp.getTownId() == townId) return temp;
+    	for (L2ZoneType temp : ZoneManager.getInstance().getAllZones())
+    	{
+        	if (temp instanceof L2TownZone && ((L2TownZone) temp).getTownId() == townId)
+        		return (L2TownZone) temp;
+    	}
         return null;
     }
 
@@ -213,10 +182,13 @@ public class TownManager
      * @param z
      * @return
      */
-    public final L2TownZone getTown(int x, int y, int z)
+    public final static L2TownZone getTown(int x, int y, int z)
     {
-        for (L2TownZone temp : _towns)
-        	if (temp.isInsideZone(x, y, z)) return temp;
+        for (L2ZoneType temp : ZoneManager.getInstance().getZones(x, y, z))
+        {
+        	if (temp instanceof L2TownZone)
+        		return (L2TownZone) temp;
+        }
         return null;
     }
 }

+ 111 - 16
L2_GameServer/java/net/sf/l2j/gameserver/instancemanager/ZoneManager.java

@@ -26,6 +26,8 @@ import javax.xml.parsers.DocumentBuilderFactory;
 import javolution.util.FastList;
 import net.sf.l2j.Config;
 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.L2World;
 import net.sf.l2j.gameserver.model.L2WorldRegion;
 import net.sf.l2j.gameserver.model.zone.L2ZoneType;
@@ -48,6 +50,7 @@ public class ZoneManager
 
 	// =========================================================
 	private static ZoneManager _instance;
+	private final FastList<L2ZoneType> _zones = new FastList<L2ZoneType>();
 
 	public static final ZoneManager getInstance()
 	{
@@ -97,6 +100,7 @@ public class ZoneManager
 		_log.info("Loading zones...");
 		java.sql.Connection con = null;
 		int zoneCount = 0;
+		_zones.clear();
 
 		// Get the world regions
 		L2WorldRegion[][] worldRegions = L2World.getInstance().getAllWorldRegions();
@@ -324,18 +328,15 @@ public class ZoneManager
 									temp.setParameter(name, val);
 								}
 							}
-
-							// Skip checks for fishing zones & add to fishing
-							// zone manager
+							addZone(temp);
+							
+							// Skip checks for fishing zones
 							if (temp instanceof L2FishingZone)
 							{
-								FishingZoneManager.getInstance().addFishingZone((L2FishingZone) temp);
+								zoneCount++;
 								continue;
 							}
-							if (temp instanceof L2WaterZone)
-							{
-								FishingZoneManager.getInstance().addWaterZone((L2WaterZone) temp);
-							}
+							
 							// Register the zone into any world region it
 							// intersects with...
 							// currently 11136 test for each zone :>
@@ -362,14 +363,8 @@ public class ZoneManager
 								}
 							}
 
-							// Special managers for arenas, towns...
-							if (temp instanceof L2ArenaZone)
-								ArenaManager.getInstance().addArena((L2ArenaZone) temp);
-							else if (temp instanceof L2TownZone)
-								TownManager.getInstance().addTown((L2TownZone) temp);
-							else if (temp instanceof L2OlympiadStadiumZone)
-								OlympiadStadiaManager.getInstance().addStadium((L2OlympiadStadiumZone) temp);
-							else if (temp instanceof L2BossZone)
+							// Special managers for granbosses...
+							if (temp instanceof L2BossZone)
 								GrandBossManager.getInstance().addZone((L2BossZone) temp);
 
 							// Increase the counter
@@ -399,4 +394,104 @@ public class ZoneManager
 		
 		_log.info("Done: loaded " + zoneCount + " zones.");
 	}
+	
+	/**
+	 * Add new zone
+	 *
+	 * @param zone
+	 */
+	public void addZone(L2ZoneType zone)
+	{
+		_zones.add(zone);
+	}
+	
+	/**
+	 * Returns all zones registered with the ZoneManager.
+	 * To minimise iteration processing retrieve zones from L2WorldRegion for a specific location instead.
+	 * @return zones
+	 */
+	public FastList<L2ZoneType> getAllZones()
+	{
+		return _zones;
+	}
+	
+	/**
+	 * Returns all zones from where the object is located
+	 *
+	 * @param object
+	 * @return zones
+	 */
+	public FastList<L2ZoneType> getZones(L2Object object)
+	{
+		return getZones(object.getX(), object.getY(), object.getZ());
+	}
+
+	/**
+	 * Returns all zones from given coordinates 
+	 *
+	 * @param x
+	 * @param y
+	 * @param z
+	 * @return zones
+	 */
+	public FastList<L2ZoneType> getZones(int x, int y, int z)
+	{
+		L2WorldRegion region = L2World.getInstance().getRegion(x, y);
+		FastList<L2ZoneType> temp = new FastList<L2ZoneType>();
+		for (L2ZoneType zone : region.getZones())
+		{
+			if (zone.isInsideZone(x, y, z))
+				temp.add(zone);
+		}
+		return temp;
+	}
+	
+    public  final L2ArenaZone getArena(L2Character character)
+    {
+    	for (L2ZoneType temp : ZoneManager.getInstance().getZones(character.getX(), character.getY(), character.getZ()))
+    	{
+    		if (temp instanceof L2ArenaZone && temp.isCharacterInZone(character)) 
+    			return ((L2ArenaZone)temp);
+    	}
+
+    	return null;
+    }
+    
+	/**
+	 * getFishingZone() - This function was modified to check the coordinates without caring for Z.
+	 * This allows for the player to fish off bridges, into the water, or from other similar high places. One
+	 * should be able to cast the line from up into the water, not only fishing with one's feet wet. :)
+	 *
+	 *  TODO: Consider in the future, limiting the maximum height one can be above water, if we start getting
+	 *  "orbital fishing" players... xD
+	 */
+	public final L2FishingZone getFishingZone(int x, int y, int z)
+	{
+    	for (L2ZoneType temp : ZoneManager.getInstance().getAllZones())
+    	{
+    		if (temp instanceof L2FishingZone && temp.isInsideZone(x, y, ((L2FishingZone)temp).getWaterZ()))
+    			return ((L2FishingZone)temp);
+    	}
+		return null;
+	}
+	
+	public final L2WaterZone getWaterZone(int x, int y, int z)
+	{
+    	for (L2ZoneType temp : ZoneManager.getInstance().getZones(x,z,y))
+    	{
+    		if (temp instanceof L2WaterZone && temp.isInsideZone(x, y, ((L2WaterZone)temp).getWaterZ()))
+    			return ((L2WaterZone)temp);
+    	}
+		return null;
+	}
+	
+    public final L2OlympiadStadiumZone getOlympiadStadium(L2Character character)
+    {
+    	for (L2ZoneType temp : ZoneManager.getInstance().getZones(character.getX(), character.getY(), character.getZ()))
+    	{
+    		if (temp instanceof L2OlympiadStadiumZone && temp.isCharacterInZone(character)) 
+    			return ((L2OlympiadStadiumZone)temp);
+    	}
+    	return null;
+    }
 }

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

@@ -5330,7 +5330,7 @@ public abstract class L2Character extends L2Object
 			}
 			if (attacker instanceof L2Character)
 			{
-				return (TownManager.getInstance().getTown(target.getX(), target.getY(), target.getZ()) != null || ((L2Character)attacker).isInsideZone(ZONE_PEACE));
+				return (TownManager.getTown(target.getX(), target.getY(), target.getZ()) != null || ((L2Character)attacker).isInsideZone(ZONE_PEACE));
 			}
 		}
 
@@ -5340,10 +5340,10 @@ public abstract class L2Character extends L2Object
 		}
 		if (attacker instanceof L2Character)
 		{
-			return (TownManager.getInstance().getTown(target.getX(), target.getY(), target.getZ()) != null || ((L2Character)attacker).isInsideZone(ZONE_PEACE));
+			return (TownManager.getTown(target.getX(), target.getY(), target.getZ()) != null || ((L2Character)attacker).isInsideZone(ZONE_PEACE));
 		}
-		return (TownManager.getInstance().getTown(target.getX(), target.getY(), target.getZ()) != null ||
-				TownManager.getInstance().getTown(attacker.getX(), attacker.getY(), attacker.getZ()) != null);
+		return (TownManager.getTown(target.getX(), target.getY(), target.getZ()) != null ||
+				TownManager.getTown(attacker.getX(), attacker.getY(), attacker.getZ()) != null);
 	}
 
     /**

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

@@ -833,7 +833,7 @@ public class L2NpcInstance extends L2Character
 		// Get castle this NPC belongs to (excluding L2Attackable)
 		if (_castleIndex < 0)
 		{
-			L2TownZone town = TownManager.getInstance().getTown(getX(), getY(), getZ());
+			L2TownZone town = TownManager.getTown(getX(), getY(), getZ());
 			
 			if (town != null)
 				_castleIndex = CastleManager.getInstance().getCastleIndex(town.getTaxById());

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

@@ -222,7 +222,7 @@ public final class L2TeleporterInstance extends L2FolkInstance
 				player.sendPacket(new SystemMessage(SystemMessageId.NO_PORT_THAT_IS_IN_SIGE));
 				return;
 			}
-			else if (TownManager.getInstance().townHasCastleInSiege(list.getLocX(), list.getLocY()))
+			else if (TownManager.townHasCastleInSiege(list.getLocX(), list.getLocY()))
 			{
 				player.sendPacket(new SystemMessage(SystemMessageId.NO_PORT_THAT_IS_IN_SIGE));
 				return;

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

@@ -44,7 +44,7 @@ import net.sf.l2j.Config;
 import net.sf.l2j.L2DatabaseFactory;
 import net.sf.l2j.gameserver.Announcements;
 import net.sf.l2j.gameserver.ThreadPoolManager;
-import net.sf.l2j.gameserver.instancemanager.OlympiadStadiaManager;
+import net.sf.l2j.gameserver.instancemanager.ZoneManager;
 import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
 import net.sf.l2j.gameserver.model.entity.Hero;
 import net.sf.l2j.gameserver.model.entity.TvTEvent;
@@ -908,7 +908,7 @@ public class Olympiad
 	
 	public boolean playerInStadia(L2PcInstance player)
 	{
-		return (OlympiadStadiaManager.getInstance().getStadium(player) != null);
+		return (ZoneManager.getInstance().getOlympiadStadium(player) != null);
 	}
 	
 	public int[] getWaitingList()

+ 0 - 99
L2_GameServer/java/net/sf/l2j/gameserver/model/zone/L2ZoneManager.java

@@ -1,99 +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.zone;
-
-import javolution.util.FastList;
-import net.sf.l2j.gameserver.model.L2Character;
-
-/**
- * This class manages all zones for a given world region
- *
- * @author  durgus
- */
-public class L2ZoneManager
-{
-	private final FastList<L2ZoneType> _zones;
-	
-	/**
-	 * The Constructor creates an initial zone list
-	 * use registerNewZone() / unregisterZone() to
-	 * change the zone list
-	 *
-	 */
-	public L2ZoneManager()
-	{
-		_zones = new FastList<L2ZoneType>();
-	}
-	
-	/**
-	 * Register a new zone object into the manager
-	 * @param zone
-	 */
-	public void registerNewZone(L2ZoneType zone)
-	{
-		_zones.add(zone);
-	}
-	
-	public FastList<L2ZoneType> getZones()
-	{
-		return _zones;
-	}
-	
-	/**
-	 * Unregister a given zone from the manager (e.g. dynamic zones)
-	 * @param zone
-	 */
-	public void unregisterZone(L2ZoneType zone)
-	{
-		_zones.remove(zone);
-	}
-	
-	public void revalidateZones(L2Character character)
-	{
-		for (L2ZoneType e : _zones)
-		{
-			if (e != null)
-				e.revalidateInZone(character);
-		}
-	}
-	
-	public void removeCharacter(L2Character character)
-	{
-		for (L2ZoneType e : _zones)
-		{
-			if (e != null)
-				e.removeCharacter(character);
-		}
-	}
-	
-	public void onDeath(L2Character character)
-	{
-		for (L2ZoneType e : _zones)
-		{
-			if (e != null)
-				e.onDieInside(character);
-		}
-	}
-	
-	public void onRevive(L2Character character)
-	{
-		for (L2ZoneType e : _zones)
-		{
-			if (e != null)
-				e.onReviveInside(character);
-		}
-	}
-	
-}