Browse Source

BETA: Using Location class a bit more

Rumen Nikiforov 13 years ago
parent
commit
c142f6de16

+ 6 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/instancemanager/GrandBossManager.java

@@ -31,6 +31,7 @@ import javolution.util.FastMap;
 import com.l2jserver.L2DatabaseFactory;
 import com.l2jserver.L2DatabaseFactory;
 import com.l2jserver.gameserver.datatables.NpcTable;
 import com.l2jserver.gameserver.datatables.NpcTable;
 import com.l2jserver.gameserver.model.L2Object;
 import com.l2jserver.gameserver.model.L2Object;
+import com.l2jserver.gameserver.model.Location;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.instance.L2GrandBossInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2GrandBossInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
@@ -249,6 +250,11 @@ public class GrandBossManager
 		return null;
 		return null;
 	}
 	}
 	
 	
+	public final L2BossZone getZone(Location loc)
+	{
+		return getZone(loc.getX(), loc.getY(), loc.getZ());
+	}
+	
 	public final L2BossZone getZone(int x, int y, int z)
 	public final L2BossZone getZone(int x, int y, int z)
 	{
 	{
 		if (_zones != null)
 		if (_zones != null)

+ 148 - 164
L2J_Server_BETA/java/com/l2jserver/gameserver/model/L2ItemInstance.java

@@ -55,11 +55,8 @@ import com.l2jserver.gameserver.templates.item.L2ItemType;
 import com.l2jserver.gameserver.templates.item.L2Weapon;
 import com.l2jserver.gameserver.templates.item.L2Weapon;
 import com.l2jserver.gameserver.util.GMAudit;
 import com.l2jserver.gameserver.util.GMAudit;
 
 
-
-
 /**
 /**
  * This class manages items.
  * This class manages items.
- *
  * @version $Revision: 1.4.2.1.2.11 $ $Date: 2005/03/31 16:07:50 $
  * @version $Revision: 1.4.2.1.2.11 $ $Date: 2005/03/31 16:07:50 $
  */
  */
 public final class L2ItemInstance extends L2Object
 public final class L2ItemInstance extends L2Object
@@ -68,7 +65,7 @@ public final class L2ItemInstance extends L2Object
 	private static final Logger _logItems = Logger.getLogger("item");
 	private static final Logger _logItems = Logger.getLogger("item");
 	
 	
 	/** Enumeration of locations for item */
 	/** Enumeration of locations for item */
-	public static enum ItemLocation 
+	public static enum ItemLocation
 	{
 	{
 		VOID,
 		VOID,
 		INVENTORY,
 		INVENTORY,
@@ -107,7 +104,7 @@ public final class L2ItemInstance extends L2Object
 	/** Location of the item : Inventory, PaperDoll, WareHouse */
 	/** Location of the item : Inventory, PaperDoll, WareHouse */
 	private ItemLocation _loc;
 	private ItemLocation _loc;
 	
 	
-	/** Slot where item is stored : Paperdoll slot, inventory order ...*/
+	/** Slot where item is stored : Paperdoll slot, inventory order ... */
 	private int _locData;
 	private int _locData;
 	
 	
 	/** Level of enchantment of the item */
 	/** Level of enchantment of the item */
@@ -117,10 +114,10 @@ public final class L2ItemInstance extends L2Object
 	private boolean _wear;
 	private boolean _wear;
 	
 	
 	/** Augmented Item */
 	/** Augmented Item */
-	private L2Augmentation _augmentation=null;
+	private L2Augmentation _augmentation = null;
 	
 	
 	/** Shadow item */
 	/** Shadow item */
-	private int _mana=-1;
+	private int _mana = -1;
 	private boolean _consumingMana = false;
 	private boolean _consumingMana = false;
 	private static final int MANA_CONSUMPTION_RATE = 60000;
 	private static final int MANA_CONSUMPTION_RATE = 60000;
 	
 	
@@ -132,18 +129,18 @@ public final class L2ItemInstance extends L2Object
 	
 	
 	private boolean _published = false;
 	private boolean _published = false;
 	
 	
-	public static final int CHARGED_NONE				=	0;
-	public static final int CHARGED_SOULSHOT				=	1;
-	public static final int CHARGED_SPIRITSHOT			=	1;
-	//public static final int CHARGED_BLESSED_SOULSHOT		=	2; // It's a really exists? ;-)
-	public static final int CHARGED_BLESSED_SPIRITSHOT		=	2;
+	public static final int CHARGED_NONE = 0;
+	public static final int CHARGED_SOULSHOT = 1;
+	public static final int CHARGED_SPIRITSHOT = 1;
+	// public static final int CHARGED_BLESSED_SOULSHOT = 2; // It's a really exists? ;-)
+	public static final int CHARGED_BLESSED_SPIRITSHOT = 2;
 	
 	
 	/** Item charged with SoulShot (type of SoulShot) */
 	/** Item charged with SoulShot (type of SoulShot) */
-	private int				_chargedSoulshot			=	CHARGED_NONE;
+	private int _chargedSoulshot = CHARGED_NONE;
 	/** Item charged with SpiritShot (type of SpiritShot) */
 	/** Item charged with SpiritShot (type of SpiritShot) */
-	private int				_chargedSpiritshot		=	CHARGED_NONE;
+	private int _chargedSpiritshot = CHARGED_NONE;
 	
 	
-	private boolean _chargedFishtshot =	false;
+	private boolean _chargedFishtshot = false;
 	
 	
 	private boolean _protected;
 	private boolean _protected;
 	
 	
@@ -151,7 +148,7 @@ public final class L2ItemInstance extends L2Object
 	public static final int ADDED = 1;
 	public static final int ADDED = 1;
 	public static final int REMOVED = 3;
 	public static final int REMOVED = 3;
 	public static final int MODIFIED = 2;
 	public static final int MODIFIED = 2;
-	private int _lastChange = 2;	//1 ??, 2 modified, 3 removed
+	private int _lastChange = 2; // 1 ??, 2 modified, 3 removed
 	private boolean _existsInDb; // if a record exists in DB.
 	private boolean _existsInDb; // if a record exists in DB.
 	private boolean _storedInDb; // if DB data is up-to-date.
 	private boolean _storedInDb; // if DB data is up-to-date.
 	
 	
@@ -163,6 +160,7 @@ public final class L2ItemInstance extends L2Object
 	public ScheduledFuture<?> _lifeTimeTask;
 	public ScheduledFuture<?> _lifeTimeTask;
 	
 	
 	private final DropProtection _dropProtection = new DropProtection();
 	private final DropProtection _dropProtection = new DropProtection();
+	
 	/**
 	/**
 	 * Constructor of the L2ItemInstance from the objectId and the itemId.
 	 * Constructor of the L2ItemInstance from the objectId and the itemId.
 	 * @param objectId : int designating the ID of the object in the world
 	 * @param objectId : int designating the ID of the object in the world
@@ -183,7 +181,7 @@ public final class L2ItemInstance extends L2Object
 		_type2 = 0;
 		_type2 = 0;
 		_dropTime = 0;
 		_dropTime = 0;
 		_mana = _item.getDuration();
 		_mana = _item.getDuration();
-		_time = _item.getTime() == -1 ? -1 : System.currentTimeMillis() + ((long)_item.getTime()*60*1000);
+		_time = _item.getTime() == -1 ? -1 : System.currentTimeMillis() + ((long) _item.getTime() * 60 * 1000);
 		scheduleLifeTimeTask();
 		scheduleLifeTimeTask();
 	}
 	}
 	
 	
@@ -204,7 +202,7 @@ public final class L2ItemInstance extends L2Object
 		setCount(1);
 		setCount(1);
 		_loc = ItemLocation.VOID;
 		_loc = ItemLocation.VOID;
 		_mana = _item.getDuration();
 		_mana = _item.getDuration();
-		_time = _item.getTime() == -1 ? -1 : System.currentTimeMillis() + ((long)_item.getTime()*60*1000);
+		_time = _item.getTime() == -1 ? -1 : System.currentTimeMillis() + ((long) _item.getTime() * 60 * 1000);
 		scheduleLifeTimeTask();
 		scheduleLifeTimeTask();
 	}
 	}
 	
 	
@@ -215,23 +213,23 @@ public final class L2ItemInstance extends L2Object
 	}
 	}
 	
 	
 	/**
 	/**
-	 * Remove a L2ItemInstance from the world and send server->client GetItem packets.<BR><BR>
-	 *
-	 * <B><U> Actions</U> :</B><BR><BR>
-	 * <li>Send a Server->Client Packet GetItem to player that pick up and its _knowPlayers member </li>
-	 * <li>Remove the L2Object from the world</li><BR><BR>
-	 *
-	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : This method DOESN'T REMOVE the object from _allObjects of L2World </B></FONT><BR><BR>
-	 *
-	 * <B><U> Assert </U> :</B><BR><BR>
-	 * <li> this instanceof L2ItemInstance</li>
-	 * <li> _worldRegion != null <I>(L2Object is visible at the beginning)</I></li><BR><BR>
-	 *
-	 * <B><U> Example of use </U> :</B><BR><BR>
-	 * <li> Do Pickup Item : PCInstance and Pet</li><BR><BR>
-	 *
+	 * Remove a L2ItemInstance from the world and send server->client GetItem packets.<BR>
+	 * <BR>
+	 * <B><U> Actions</U> :</B><BR>
+	 * <BR>
+	 * <li>Send a Server->Client Packet GetItem to player that pick up and its _knowPlayers member</li> <li>Remove the L2Object from the world</li><BR>
+	 * <BR>
+	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : This method DOESN'T REMOVE the object from _allObjects of L2World </B></FONT><BR>
+	 * <BR>
+	 * <B><U> Assert </U> :</B><BR>
+	 * <BR>
+	 * <li>this instanceof L2ItemInstance</li> <li>_worldRegion != null <I>(L2Object is visible at the beginning)</I></li><BR>
+	 * <BR>
+	 * <B><U> Example of use </U> :</B><BR>
+	 * <BR>
+	 * <li>Do Pickup Item : PCInstance and Pet</li><BR>
+	 * <BR>
 	 * @param player Player that pick up the item
 	 * @param player Player that pick up the item
-	 *
 	 */
 	 */
 	public final void pickupMe(L2Character player)
 	public final void pickupMe(L2Character player)
 	{
 	{
@@ -260,8 +258,8 @@ public final class L2ItemInstance extends L2Object
 		
 		
 		if (!Config.DISABLE_TUTORIAL && (itemId == PcInventory.ADENA_ID || itemId == 6353))
 		if (!Config.DISABLE_TUTORIAL && (itemId == PcInventory.ADENA_ID || itemId == 6353))
 		{
 		{
-			//Note from UnAfraid:
-			//Unhardcode this?
+			// Note from UnAfraid:
+			// Unhardcode this?
 			L2PcInstance actor = player.getActingPlayer();
 			L2PcInstance actor = player.getActingPlayer();
 			if (actor != null)
 			if (actor != null)
 			{
 			{
@@ -292,7 +290,10 @@ public final class L2ItemInstance extends L2Object
 			{
 			{
 				LogRecord record = new LogRecord(Level.INFO, "SETOWNER:" + process);
 				LogRecord record = new LogRecord(Level.INFO, "SETOWNER:" + process);
 				record.setLoggerName("item");
 				record.setLoggerName("item");
-				record.setParameters(new Object[]{this, creator, reference});
+				record.setParameters(new Object[]
+				{
+					this, creator, reference
+				});
 				_logItems.log(record);
 				_logItems.log(record);
 			}
 			}
 		}
 		}
@@ -304,15 +305,13 @@ public final class L2ItemInstance extends L2Object
 				String referenceName = "no-reference";
 				String referenceName = "no-reference";
 				if (reference instanceof L2Object)
 				if (reference instanceof L2Object)
 				{
 				{
-					referenceName = (((L2Object)reference).getName() != null?((L2Object)reference).getName():"no-name");
+					referenceName = (((L2Object) reference).getName() != null ? ((L2Object) reference).getName() : "no-name");
 				}
 				}
 				else if (reference instanceof String)
 				else if (reference instanceof String)
-					referenceName = (String)reference;
-				String targetName = (creator.getTarget() != null?creator.getTarget().getName():"no-target");
+					referenceName = (String) reference;
+				String targetName = (creator.getTarget() != null ? creator.getTarget().getName() : "no-target");
 				if (Config.GMAUDIT)
 				if (Config.GMAUDIT)
-					GMAudit.auditGMAction(creator.getName()+" ["+creator.getObjectId()+"]",
-							process + "(id: "+getItemId()+" name: "+getName()+")", targetName,
-							"L2Object referencing this action is: " + referenceName);
+					GMAudit.auditGMAction(creator.getName() + " [" + creator.getObjectId() + "]", process + "(id: " + getItemId() + " name: " + getName() + ")", targetName, "L2Object referencing this action is: " + referenceName);
 			}
 			}
 		}
 		}
 	}
 	}
@@ -323,7 +322,8 @@ public final class L2ItemInstance extends L2Object
 	 */
 	 */
 	public void setOwnerId(int owner_id)
 	public void setOwnerId(int owner_id)
 	{
 	{
-		if (owner_id == _ownerId) return;
+		if (owner_id == _ownerId)
+			return;
 		
 		
 		_ownerId = owner_id;
 		_ownerId = owner_id;
 		_storedInDb = false;
 		_storedInDb = false;
@@ -348,7 +348,8 @@ public final class L2ItemInstance extends L2Object
 	}
 	}
 	
 	
 	/**
 	/**
-	 * Sets the location of the item.<BR><BR>
+	 * Sets the location of the item.<BR>
+	 * <BR>
 	 * <U><I>Remark :</I></U> If loc and loc_data different from database, say datas not up-to-date
 	 * <U><I>Remark :</I></U> If loc and loc_data different from database, say datas not up-to-date
 	 * @param loc : ItemLocation (enumeration)
 	 * @param loc : ItemLocation (enumeration)
 	 * @param loc_data : int designating the slot where the item is stored or the village for freights
 	 * @param loc_data : int designating the slot where the item is stored or the village for freights
@@ -368,7 +369,8 @@ public final class L2ItemInstance extends L2Object
 	}
 	}
 	
 	
 	/**
 	/**
-	 * Sets the quantity of the item.<BR><BR>
+	 * Sets the quantity of the item.<BR>
+	 * <BR>
 	 * @param count the new count to set
 	 * @param count the new count to set
 	 */
 	 */
 	public void setCount(long count)
 	public void setCount(long count)
@@ -391,7 +393,8 @@ public final class L2ItemInstance extends L2Object
 	}
 	}
 	
 	
 	/**
 	/**
-	 * Sets the quantity of the item.<BR><BR>
+	 * Sets the quantity of the item.<BR>
+	 * <BR>
 	 * <U><I>Remark :</I></U> If loc and loc_data different from database, say datas not up-to-date
 	 * <U><I>Remark :</I></U> If loc and loc_data different from database, say datas not up-to-date
 	 * @param process : String Identifier of process triggering this action
 	 * @param process : String Identifier of process triggering this action
 	 * @param count : int
 	 * @param count : int
@@ -407,7 +410,7 @@ public final class L2ItemInstance extends L2Object
 		long old = getCount();
 		long old = getCount();
 		long max = getItemId() == ADENA_ID ? MAX_ADENA : Integer.MAX_VALUE;
 		long max = getItemId() == ADENA_ID ? MAX_ADENA : Integer.MAX_VALUE;
 		
 		
-		if ( count > 0 && getCount() > max - count)
+		if (count > 0 && getCount() > max - count)
 		{
 		{
 			setCount(max);
 			setCount(max);
 		}
 		}
@@ -429,7 +432,10 @@ public final class L2ItemInstance extends L2Object
 			{
 			{
 				LogRecord record = new LogRecord(Level.INFO, "CHANGE:" + process);
 				LogRecord record = new LogRecord(Level.INFO, "CHANGE:" + process);
 				record.setLoggerName("item");
 				record.setLoggerName("item");
-				record.setParameters(new Object[]{this, "PrevCount("+old+")",creator, reference});
+				record.setParameters(new Object[]
+				{
+					this, "PrevCount(" + old + ")", creator, reference
+				});
 				_logItems.log(record);
 				_logItems.log(record);
 			}
 			}
 		}
 		}
@@ -441,16 +447,13 @@ public final class L2ItemInstance extends L2Object
 				String referenceName = "no-reference";
 				String referenceName = "no-reference";
 				if (reference instanceof L2Object)
 				if (reference instanceof L2Object)
 				{
 				{
-					referenceName = (((L2Object)reference).getName() != null?((L2Object)reference).getName():"no-name");
+					referenceName = (((L2Object) reference).getName() != null ? ((L2Object) reference).getName() : "no-name");
 				}
 				}
 				else if (reference instanceof String)
 				else if (reference instanceof String)
-					referenceName = (String)reference;
-				String targetName = (creator.getTarget() != null?creator.getTarget().getName():"no-target");
+					referenceName = (String) reference;
+				String targetName = (creator.getTarget() != null ? creator.getTarget().getName() : "no-target");
 				if (Config.GMAUDIT)
 				if (Config.GMAUDIT)
-					GMAudit.auditGMAction(creator.getName()+" ["+creator.getObjectId()+"]",
-							process + "(id: "+getItemId()+" objId: "+getObjectId()+
-							" name: "+getName()+" count: "+count+")", targetName,
-							"L2Object referencing this action is: " + referenceName);
+					GMAudit.auditGMAction(creator.getName() + " [" + creator.getObjectId() + "]", process + "(id: " + getItemId() + " objId: " + getObjectId() + " name: " + getName() + " count: " + count + ")", targetName, "L2Object referencing this action is: " + referenceName);
 			}
 			}
 		}
 		}
 	}
 	}
@@ -478,7 +481,7 @@ public final class L2ItemInstance extends L2Object
 	 */
 	 */
 	public boolean isEquipable()
 	public boolean isEquipable()
 	{
 	{
-		return !(_item.getBodyPart() == 0 || _item.getItemType() == L2EtcItemType.ARROW || _item.getItemType() == L2EtcItemType.BOLT || _item.getItemType() == L2EtcItemType.LURE );
+		return !(_item.getBodyPart() == 0 || _item.getItemType() == L2EtcItemType.ARROW || _item.getItemType() == L2EtcItemType.BOLT || _item.getItemType() == L2EtcItemType.LURE);
 	}
 	}
 	
 	
 	/**
 	/**
@@ -513,26 +516,32 @@ public final class L2ItemInstance extends L2Object
 	{
 	{
 		return _type1;
 		return _type1;
 	}
 	}
+	
 	public int getCustomType2()
 	public int getCustomType2()
 	{
 	{
 		return _type2;
 		return _type2;
 	}
 	}
+	
 	public void setCustomType1(int newtype)
 	public void setCustomType1(int newtype)
 	{
 	{
-		_type1=newtype;
+		_type1 = newtype;
 	}
 	}
+	
 	public void setCustomType2(int newtype)
 	public void setCustomType2(int newtype)
 	{
 	{
-		_type2=newtype;
+		_type2 = newtype;
 	}
 	}
+	
 	public void setDropTime(long time)
 	public void setDropTime(long time)
 	{
 	{
-		_dropTime=time;
+		_dropTime = time;
 	}
 	}
+	
 	public long getDropTime()
 	public long getDropTime()
 	{
 	{
 		return _dropTime;
 		return _dropTime;
 	}
 	}
+	
 	/**
 	/**
 	 * Returns the type of item
 	 * Returns the type of item
 	 * @return Enum
 	 * @return Enum
@@ -619,7 +628,6 @@ public final class L2ItemInstance extends L2Object
 	
 	
 	/**
 	/**
 	 * Returns the quantity of crystals for crystallization
 	 * Returns the quantity of crystals for crystallization
-	 * 
 	 * @return int
 	 * @return int
 	 */
 	 */
 	public final int getCrystalCount()
 	public final int getCrystalCount()
@@ -709,7 +717,7 @@ public final class L2ItemInstance extends L2Object
 	}
 	}
 	
 	
 	/**
 	/**
-	 * @param isPrivateWareHouse 
+	 * @param isPrivateWareHouse
 	 * @return if item can be deposited in warehouse or freight
 	 * @return if item can be deposited in warehouse or freight
 	 */
 	 */
 	public boolean isDepositable(boolean isPrivateWareHouse)
 	public boolean isDepositable(boolean isPrivateWareHouse)
@@ -740,12 +748,12 @@ public final class L2ItemInstance extends L2Object
 	{
 	{
 		return _item.isPotion();
 		return _item.isPotion();
 	}
 	}
-
+	
 	public boolean isElixir()
 	public boolean isElixir()
 	{
 	{
 		return _item.isElixir();
 		return _item.isElixir();
 	}
 	}
-
+	
 	public boolean isHeroItem()
 	public boolean isHeroItem()
 	{
 	{
 		return _item.isHeroItem();
 		return _item.isHeroItem();
@@ -771,25 +779,20 @@ public final class L2ItemInstance extends L2Object
 	}
 	}
 	
 	
 	/**
 	/**
-	 * @param player 
-	 * @param allowAdena 
-	 * @param allowNonTradeable 
+	 * @param player
+	 * @param allowAdena
+	 * @param allowNonTradeable
 	 * @return if item is available for manipulation
 	 * @return if item is available for manipulation
 	 */
 	 */
 	public boolean isAvailable(L2PcInstance player, boolean allowAdena, boolean allowNonTradeable)
 	public boolean isAvailable(L2PcInstance player, boolean allowAdena, boolean allowNonTradeable)
 	{
 	{
-		return (
-				(!isEquipped()) // Not equipped
-				&& (getItem().getType2() != L2Item.TYPE2_QUEST) // Not Quest Item
-				&& (getItem().getType2() != L2Item.TYPE2_MONEY || getItem().getType1() != L2Item.TYPE1_SHIELD_ARMOR) // not money, not shield
-				&& (player.getPet() == null || getObjectId() != player.getPet().getControlObjectId()) // Not Control item of currently summoned pet
-				&& (player.getActiveEnchantItem() != this) // Not momentarily used enchant scroll
-				&& (allowAdena || getItemId() != PcInventory.ADENA_ID) // Not Adena
-				&& (player.getCurrentSkill() == null || player.getCurrentSkill().getSkill().getItemConsumeId() != getItemId())
-				&& (!player.isCastingSimultaneouslyNow() || player.getLastSimultaneousSkillCast() == null || player.getLastSimultaneousSkillCast().getItemConsumeId() != getItemId())
-				&& (allowNonTradeable || isTradeable()
-				&& (!(getItem().getItemType() == L2EtcItemType.PET_COLLAR && player.havePetInvItems())))
-		);
+		return ((!isEquipped()) // Not equipped
+			&& (getItem().getType2() != L2Item.TYPE2_QUEST) // Not Quest Item
+			&& (getItem().getType2() != L2Item.TYPE2_MONEY || getItem().getType1() != L2Item.TYPE1_SHIELD_ARMOR) // not money, not shield
+			&& (player.getPet() == null || getObjectId() != player.getPet().getControlObjectId()) // Not Control item of currently summoned pet
+			&& (player.getActiveEnchantItem() != this) // Not momentarily used enchant scroll
+			&& (allowAdena || getItemId() != PcInventory.ADENA_ID) // Not Adena
+			&& (player.getCurrentSkill() == null || player.getCurrentSkill().getSkill().getItemConsumeId() != getItemId()) && (!player.isCastingSimultaneouslyNow() || player.getLastSimultaneousSkillCast() == null || player.getLastSimultaneousSkillCast().getItemConsumeId() != getItemId()) && (allowNonTradeable || isTradeable() && (!(getItem().getItemType() == L2EtcItemType.PET_COLLAR && player.havePetInvItems()))));
 	}
 	}
 	
 	
 	/**
 	/**
@@ -812,7 +815,6 @@ public final class L2ItemInstance extends L2Object
 		_storedInDb = false;
 		_storedInDb = false;
 	}
 	}
 	
 	
-	
 	/**
 	/**
 	 * Returns whether this item is augmented or not
 	 * Returns whether this item is augmented or not
 	 * @return true if augmented
 	 * @return true if augmented
@@ -848,7 +850,6 @@ public final class L2ItemInstance extends L2Object
 	
 	
 	/**
 	/**
 	 * Remove the augmentation
 	 * Remove the augmentation
-	 *
 	 */
 	 */
 	public void removeAugmentation()
 	public void removeAugmentation()
 	{
 	{
@@ -871,7 +872,7 @@ public final class L2ItemInstance extends L2Object
 		}
 		}
 		catch (Exception e)
 		catch (Exception e)
 		{
 		{
-			_log.log(Level.SEVERE, "Could not remove augmentation for item: "+this+" from DB:", e);
+			_log.log(Level.SEVERE, "Could not remove augmentation for item: " + this + " from DB:", e);
 		}
 		}
 		finally
 		finally
 		{
 		{
@@ -913,7 +914,7 @@ public final class L2ItemInstance extends L2Object
 		}
 		}
 		catch (Exception e)
 		catch (Exception e)
 		{
 		{
-			_log.log(Level.SEVERE, "Could not restore augmentation and elemental data for item " + this + " from DB: "+e.getMessage(), e);
+			_log.log(Level.SEVERE, "Could not restore augmentation and elemental data for item " + this + " from DB: " + e.getMessage(), e);
 		}
 		}
 		finally
 		finally
 		{
 		{
@@ -938,7 +939,7 @@ public final class L2ItemInstance extends L2Object
 			else
 			else
 			{
 			{
 				statement.setInt(2, _augmentation.getAttributes());
 				statement.setInt(2, _augmentation.getAttributes());
-				if(_augmentation.getSkill() == null)
+				if (_augmentation.getSkill() == null)
 				{
 				{
 					statement.setInt(3, 0);
 					statement.setInt(3, 0);
 					statement.setInt(4, 0);
 					statement.setInt(4, 0);
@@ -954,7 +955,7 @@ public final class L2ItemInstance extends L2Object
 		}
 		}
 		catch (SQLException e)
 		catch (SQLException e)
 		{
 		{
-			_log.log(Level.SEVERE, "Could not update atributes for item: "+this+" from DB:", e);
+			_log.log(Level.SEVERE, "Could not update atributes for item: " + this + " from DB:", e);
 			
 			
 		}
 		}
 		finally
 		finally
@@ -993,7 +994,7 @@ public final class L2ItemInstance extends L2Object
 		}
 		}
 		catch (SQLException e)
 		catch (SQLException e)
 		{
 		{
-			_log.log(Level.SEVERE, "Could not update elementals for item: "+this+" from DB:", e);
+			_log.log(Level.SEVERE, "Could not update elementals for item: " + this + " from DB:", e);
 		}
 		}
 		finally
 		finally
 		{
 		{
@@ -1054,7 +1055,7 @@ public final class L2ItemInstance extends L2Object
 		else if (_elementals != null)
 		else if (_elementals != null)
 		{
 		{
 			Elementals elm = getElemental(element);
 			Elementals elm = getElemental(element);
-			if (elm != null )
+			if (elm != null)
 				return elm.getValue();
 				return elm.getValue();
 		}
 		}
 		return 0;
 		return 0;
@@ -1077,7 +1078,7 @@ public final class L2ItemInstance extends L2Object
 			else
 			else
 			{
 			{
 				elm = new Elementals(element, value);
 				elm = new Elementals(element, value);
-				Elementals[] array = new Elementals[_elementals.length+1];
+				Elementals[] array = new Elementals[_elementals.length + 1];
 				System.arraycopy(_elementals, 0, array, 0, _elementals.length);
 				System.arraycopy(_elementals, 0, array, 0, _elementals.length);
 				array[_elementals.length] = elm;
 				array[_elementals.length] = elm;
 				_elementals = array;
 				_elementals = array;
@@ -1130,7 +1131,7 @@ public final class L2ItemInstance extends L2Object
 			PreparedStatement statement = null;
 			PreparedStatement statement = null;
 			if (element != -1)
 			if (element != -1)
 			{
 			{
-				//Item can have still others
+				// Item can have still others
 				statement = con.prepareStatement("DELETE FROM item_elementals WHERE itemId = ? AND elemType = ?");
 				statement = con.prepareStatement("DELETE FROM item_elementals WHERE itemId = ? AND elemType = ?");
 				statement.setInt(2, element);
 				statement.setInt(2, element);
 			}
 			}
@@ -1146,7 +1147,7 @@ public final class L2ItemInstance extends L2Object
 		}
 		}
 		catch (Exception e)
 		catch (Exception e)
 		{
 		{
-			_log.log(Level.SEVERE, "Could not remove elemental enchant for item: "+this+" from DB:", e);
+			_log.log(Level.SEVERE, "Could not remove elemental enchant for item: " + this + " from DB:", e);
 		}
 		}
 		finally
 		finally
 		{
 		{
@@ -1155,8 +1156,7 @@ public final class L2ItemInstance extends L2Object
 	}
 	}
 	
 	
 	/**
 	/**
-	 * Used to decrease mana
-	 * (mana means life time for shadow items)
+	 * Used to decrease mana (mana means life time for shadow items)
 	 */
 	 */
 	public static class ScheduleConsumeManaTask implements Runnable
 	public static class ScheduleConsumeManaTask implements Runnable
 	{
 	{
@@ -1183,10 +1183,8 @@ public final class L2ItemInstance extends L2Object
 		}
 		}
 	}
 	}
 	
 	
-	
 	/**
 	/**
-	 * Returns true if this item is a shadow item
-	 * Shadow items have a limited life-time
+	 * Returns true if this item is a shadow item Shadow items have a limited life-time
 	 * @return
 	 * @return
 	 */
 	 */
 	public boolean isShadowItem()
 	public boolean isShadowItem()
@@ -1204,10 +1202,7 @@ public final class L2ItemInstance extends L2Object
 	}
 	}
 	
 	
 	/**
 	/**
-	 * Decreases the mana of this shadow item,
-	 * sends a inventory update
-	 * schedules a new consumption task if non is running
-	 * optionally one could force a new task
+	 * Decreases the mana of this shadow item, sends a inventory update schedules a new consumption task if non is running optionally one could force a new task
 	 * @param resetConsumingMana if true forces a new consumption task if item is equipped
 	 * @param resetConsumingMana if true forces a new consumption task if item is equipped
 	 */
 	 */
 	public void decreaseMana(boolean resetConsumingMana)
 	public void decreaseMana(boolean resetConsumingMana)
@@ -1216,10 +1211,7 @@ public final class L2ItemInstance extends L2Object
 	}
 	}
 	
 	
 	/**
 	/**
-	 * Decreases the mana of this shadow item,
-	 * sends a inventory update
-	 * schedules a new consumption task if non is running
-	 * optionally one could force a new task
+	 * Decreases the mana of this shadow item, sends a inventory update schedules a new consumption task if non is running optionally one could force a new task
 	 * @param resetConsumingMana if forces a new consumption task if item is equipped
 	 * @param resetConsumingMana if forces a new consumption task if item is equipped
 	 * @param count how much mana decrease
 	 * @param count how much mana decrease
 	 */
 	 */
@@ -1272,7 +1264,7 @@ public final class L2ItemInstance extends L2Object
 				{
 				{
 					L2ItemInstance[] unequiped = player.getInventory().unEquipItemInSlotAndRecord(getLocationSlot());
 					L2ItemInstance[] unequiped = player.getInventory().unEquipItemInSlotAndRecord(getLocationSlot());
 					InventoryUpdate iu = new InventoryUpdate();
 					InventoryUpdate iu = new InventoryUpdate();
-					for (L2ItemInstance item: unequiped)
+					for (L2ItemInstance item : unequiped)
 					{
 					{
 						player.checkSShotsMatch(null, item);
 						player.checkSShotsMatch(null, item);
 						iu.addModifiedItem(item);
 						iu.addModifiedItem(item);
@@ -1345,7 +1337,7 @@ public final class L2ItemInstance extends L2Object
 	 */
 	 */
 	public int getChargedSoulshot()
 	public int getChargedSoulshot()
 	{
 	{
-		return 	_chargedSoulshot;
+		return _chargedSoulshot;
 	}
 	}
 	
 	
 	/**
 	/**
@@ -1356,6 +1348,7 @@ public final class L2ItemInstance extends L2Object
 	{
 	{
 		return _chargedSpiritshot;
 		return _chargedSpiritshot;
 	}
 	}
+	
 	public boolean getChargedFishshot()
 	public boolean getChargedFishshot()
 	{
 	{
 		return _chargedFishtshot;
 		return _chargedFishtshot;
@@ -1378,16 +1371,14 @@ public final class L2ItemInstance extends L2Object
 	{
 	{
 		_chargedSpiritshot = type;
 		_chargedSpiritshot = type;
 	}
 	}
+	
 	public void setChargedFishshot(boolean type)
 	public void setChargedFishshot(boolean type)
 	{
 	{
 		_chargedFishtshot = type;
 		_chargedFishtshot = type;
 	}
 	}
 	
 	
 	/**
 	/**
-	 * This function basically returns a set of functions from
-	 * L2Item/L2Armor/L2Weapon, but may add additional
-	 * functions, if this particular item instance is enhanched
-	 * for a particular player.
+	 * This function basically returns a set of functions from L2Item/L2Armor/L2Weapon, but may add additional functions, if this particular item instance is enhanched for a particular player.
 	 * @param player : L2Character designating the player
 	 * @param player : L2Character designating the player
 	 * @return Func[]
 	 * @return Func[]
 	 */
 	 */
@@ -1406,7 +1397,6 @@ public final class L2ItemInstance extends L2Object
 	
 	
 	/**
 	/**
 	 * Updates the database.<BR>
 	 * Updates the database.<BR>
-	 * 
 	 * @param force if the update should necessarilly be done.
 	 * @param force if the update should necessarilly be done.
 	 */
 	 */
 	public void updateDatabase(boolean force)
 	public void updateDatabase(boolean force)
@@ -1417,10 +1407,7 @@ public final class L2ItemInstance extends L2Object
 		{
 		{
 			if (_existsInDb)
 			if (_existsInDb)
 			{
 			{
-				if (_ownerId == 0
-						|| _loc == ItemLocation.VOID
-						|| _loc == ItemLocation.REFUND
-						|| (getCount() == 0 && _loc != ItemLocation.LEASE))
+				if (_ownerId == 0 || _loc == ItemLocation.VOID || _loc == ItemLocation.REFUND || (getCount() == 0 && _loc != ItemLocation.LEASE))
 				{
 				{
 					removeFromDb();
 					removeFromDb();
 				}
 				}
@@ -1431,10 +1418,7 @@ public final class L2ItemInstance extends L2Object
 			}
 			}
 			else
 			else
 			{
 			{
-				if (_ownerId == 0
-						|| _loc == ItemLocation.VOID
-						|| _loc == ItemLocation.REFUND
-						|| (getCount() == 0 && _loc != ItemLocation.LEASE))
+				if (_ownerId == 0 || _loc == ItemLocation.VOID || _loc == ItemLocation.REFUND || (getCount() == 0 && _loc != ItemLocation.LEASE))
 				{
 				{
 					return;
 					return;
 				}
 				}
@@ -1450,7 +1434,7 @@ public final class L2ItemInstance extends L2Object
 	/**
 	/**
 	 * Returns a L2ItemInstance stored in database from its objectID
 	 * Returns a L2ItemInstance stored in database from its objectID
 	 * @param ownerId
 	 * @param ownerId
-	 * @param rs 
+	 * @param rs
 	 * @return L2ItemInstance
 	 * @return L2ItemInstance
 	 */
 	 */
 	public static L2ItemInstance restoreFromDb(int ownerId, ResultSet rs)
 	public static L2ItemInstance restoreFromDb(int ownerId, ResultSet rs)
@@ -1467,17 +1451,20 @@ public final class L2ItemInstance extends L2Object
 			loc = ItemLocation.valueOf(rs.getString("loc"));
 			loc = ItemLocation.valueOf(rs.getString("loc"));
 			loc_data = rs.getInt("loc_data");
 			loc_data = rs.getInt("loc_data");
 			enchant_level = rs.getInt("enchant_level");
 			enchant_level = rs.getInt("enchant_level");
-			custom_type1 =  rs.getInt("custom_type1");
-			custom_type2 =  rs.getInt("custom_type2");
+			custom_type1 = rs.getInt("custom_type1");
+			custom_type2 = rs.getInt("custom_type2");
 			manaLeft = rs.getInt("mana_left");
 			manaLeft = rs.getInt("mana_left");
 			time = rs.getLong("time");
 			time = rs.getLong("time");
-		} catch (Exception e) {
-			_log.log(Level.SEVERE, "Could not restore an item owned by "+ownerId+" from DB:", e);
+		}
+		catch (Exception e)
+		{
+			_log.log(Level.SEVERE, "Could not restore an item owned by " + ownerId + " from DB:", e);
 			return null;
 			return null;
 		}
 		}
 		L2Item item = ItemTable.getInstance().getTemplate(item_id);
 		L2Item item = ItemTable.getInstance().getTemplate(item_id);
-		if (item == null) {
-			_log.severe("Item item_id="+item_id+" not known, object_id="+objectId);
+		if (item == null)
+		{
+			_log.severe("Item item_id=" + item_id + " not known, object_id=" + objectId);
 			return null;
 			return null;
 		}
 		}
 		inst = new L2ItemInstance(objectId, item);
 		inst = new L2ItemInstance(objectId, item);
@@ -1495,7 +1482,7 @@ public final class L2ItemInstance extends L2Object
 		inst._mana = manaLeft;
 		inst._mana = manaLeft;
 		inst._time = time;
 		inst._time = time;
 		
 		
-		//load augmentation and elemental enchant
+		// load augmentation and elemental enchant
 		if (inst.isEquipable())
 		if (inst.isEquipable())
 			inst.restoreAttributes();
 			inst.restoreAttributes();
 		
 		
@@ -1503,26 +1490,25 @@ public final class L2ItemInstance extends L2Object
 	}
 	}
 	
 	
 	/**
 	/**
-	 * Init a dropped L2ItemInstance and add it in the world as a visible object.<BR><BR>
-	 *
-	 * <B><U> Actions</U> :</B><BR><BR>
-	 * <li>Set the x,y,z position of the L2ItemInstance dropped and update its _worldregion </li>
-	 * <li>Add the L2ItemInstance dropped to _visibleObjects of its L2WorldRegion</li>
-	 * <li>Add the L2ItemInstance dropped in the world as a <B>visible</B> object</li><BR><BR>
-	 *
-	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : This method DOESN'T ADD the object to _allObjects of L2World </B></FONT><BR><BR>
-	 *
-	 * <B><U> Assert </U> :</B><BR><BR>
-	 * <li> _worldRegion == null <I>(L2Object is invisible at the beginning)</I></li><BR><BR>
-	 *
-	 * <B><U> Example of use </U> :</B><BR><BR>
-	 * <li> Drop item</li>
-	 * <li> Call Pet</li><BR>
-	 *
+	 * Init a dropped L2ItemInstance and add it in the world as a visible object.<BR>
+	 * <BR>
+	 * <B><U> Actions</U> :</B><BR>
+	 * <BR>
+	 * <li>Set the x,y,z position of the L2ItemInstance dropped and update its _worldregion</li> <li>Add the L2ItemInstance dropped to _visibleObjects of its L2WorldRegion</li> <li>Add the L2ItemInstance dropped in the world as a <B>visible</B> object</li><BR>
+	 * <BR>
+	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : This method DOESN'T ADD the object to _allObjects of L2World </B></FONT><BR>
+	 * <BR>
+	 * <B><U> Assert </U> :</B><BR>
+	 * <BR>
+	 * <li>_worldRegion == null <I>(L2Object is invisible at the beginning)</I></li><BR>
+	 * <BR>
+	 * <B><U> Example of use </U> :</B><BR>
+	 * <BR>
+	 * <li>Drop item</li> <li>Call Pet</li><BR>
 	 */
 	 */
 	public class ItemDropTask implements Runnable
 	public class ItemDropTask implements Runnable
 	{
 	{
-		private int _x,_y,_z;
+		private int _x, _y, _z;
 		private final L2Character _dropper;
 		private final L2Character _dropper;
 		private final L2ItemInstance _itm;
 		private final L2ItemInstance _itm;
 		
 		
@@ -1548,16 +1534,16 @@ public final class L2ItemInstance extends L2Object
 				_z = dropDest.getZ();
 				_z = dropDest.getZ();
 			}
 			}
 			
 			
-			if(_dropper != null)
+			if (_dropper != null)
 				setInstanceId(_dropper.getInstanceId()); // Inherit instancezone when dropped in visible world
 				setInstanceId(_dropper.getInstanceId()); // Inherit instancezone when dropped in visible world
 			else
 			else
 				setInstanceId(0); // No dropper? Make it a global item...
 				setInstanceId(0); // No dropper? Make it a global item...
-			
+				
 			synchronized (_itm)
 			synchronized (_itm)
 			{
 			{
 				// Set the x,y,z position of the L2ItemInstance dropped and update its _worldregion
 				// Set the x,y,z position of the L2ItemInstance dropped and update its _worldregion
 				_itm.setIsVisible(true);
 				_itm.setIsVisible(true);
-				_itm.getPosition().setWorldPosition(_x, _y ,_z);
+				_itm.getPosition().setWorldPosition(_x, _y, _z);
 				_itm.getPosition().setWorldRegion(L2World.getInstance().getRegion(getPosition().getWorldPosition()));
 				_itm.getPosition().setWorldRegion(L2World.getInstance().getRegion(getPosition().getWorldPosition()));
 				
 				
 				// Add the L2ItemInstance dropped to _visibleObjects of its L2WorldRegion
 				// Add the L2ItemInstance dropped to _visibleObjects of its L2WorldRegion
@@ -1565,7 +1551,7 @@ public final class L2ItemInstance extends L2Object
 			
 			
 			_itm.getPosition().getWorldRegion().addVisibleObject(_itm);
 			_itm.getPosition().getWorldRegion().addVisibleObject(_itm);
 			_itm.setDropTime(System.currentTimeMillis());
 			_itm.setDropTime(System.currentTimeMillis());
-			_itm.setDropperObjectId(_dropper != null ? _dropper.getObjectId() : 0); //Set the dropper Id for the knownlist packets in sendInfo
+			_itm.setDropperObjectId(_dropper != null ? _dropper.getObjectId() : 0); // Set the dropper Id for the knownlist packets in sendInfo
 			
 			
 			// this can synchronize on others instancies, so it's out of
 			// this can synchronize on others instancies, so it's out of
 			// synchronized, to avoid deadlocks
 			// synchronized, to avoid deadlocks
@@ -1573,7 +1559,7 @@ public final class L2ItemInstance extends L2Object
 			L2World.getInstance().addVisibleObject(_itm, _itm.getPosition().getWorldRegion());
 			L2World.getInstance().addVisibleObject(_itm, _itm.getPosition().getWorldRegion());
 			if (Config.SAVE_DROPPED_ITEM)
 			if (Config.SAVE_DROPPED_ITEM)
 				ItemsOnGroundManager.getInstance().save(_itm);
 				ItemsOnGroundManager.getInstance().save(_itm);
-			_itm.setDropperObjectId(0); //Set the dropper Id back to 0 so it no longer shows the drop packet
+			_itm.setDropperObjectId(0); // Set the dropper Id back to 0 so it no longer shows the drop packet
 		}
 		}
 	}
 	}
 	
 	
@@ -1600,9 +1586,7 @@ public final class L2ItemInstance extends L2Object
 		try
 		try
 		{
 		{
 			con = L2DatabaseFactory.getInstance().getConnection();
 			con = L2DatabaseFactory.getInstance().getConnection();
-			statement = con.prepareStatement(
-					"UPDATE items SET owner_id=?,count=?,loc=?,loc_data=?,enchant_level=?,custom_type1=?,custom_type2=?,mana_left=?,time=? " +
-			"WHERE object_id = ?");
+			statement = con.prepareStatement("UPDATE items SET owner_id=?,count=?,loc=?,loc_data=?,enchant_level=?,custom_type1=?,custom_type2=?,mana_left=?,time=? " + "WHERE object_id = ?");
 			statement.setInt(1, _ownerId);
 			statement.setInt(1, _ownerId);
 			statement.setLong(2, getCount());
 			statement.setLong(2, getCount());
 			statement.setString(3, _loc.name());
 			statement.setString(3, _loc.name());
@@ -1620,7 +1604,7 @@ public final class L2ItemInstance extends L2Object
 		}
 		}
 		catch (Exception e)
 		catch (Exception e)
 		{
 		{
-			_log.log(Level.SEVERE, "Could not update item "+this+" in DB: Reason: "+e.getMessage(), e);
+			_log.log(Level.SEVERE, "Could not update item " + this + " in DB: Reason: " + e.getMessage(), e);
 		}
 		}
 		finally
 		finally
 		{
 		{
@@ -1643,9 +1627,7 @@ public final class L2ItemInstance extends L2Object
 		try
 		try
 		{
 		{
 			con = L2DatabaseFactory.getInstance().getConnection();
 			con = L2DatabaseFactory.getInstance().getConnection();
-			statement = con.prepareStatement(
-					"INSERT INTO items (owner_id,item_id,count,loc,loc_data,enchant_level,object_id,custom_type1,custom_type2,mana_left,time) " +
-			"VALUES (?,?,?,?,?,?,?,?,?,?,?)");
+			statement = con.prepareStatement("INSERT INTO items (owner_id,item_id,count,loc,loc_data,enchant_level,object_id,custom_type1,custom_type2,mana_left,time) " + "VALUES (?,?,?,?,?,?,?,?,?,?,?)");
 			statement.setInt(1, _ownerId);
 			statement.setInt(1, _ownerId);
 			statement.setInt(2, _itemId);
 			statement.setInt(2, _itemId);
 			statement.setLong(3, getCount());
 			statement.setLong(3, getCount());
@@ -1707,7 +1689,7 @@ public final class L2ItemInstance extends L2Object
 		}
 		}
 		catch (Exception e)
 		catch (Exception e)
 		{
 		{
-			_log.log(Level.SEVERE, "Could not delete item "+this+" in DB: "+e.getMessage(), e);
+			_log.log(Level.SEVERE, "Could not delete item " + this + " in DB: " + e.getMessage(), e);
 		}
 		}
 		finally
 		finally
 		{
 		{
@@ -1722,12 +1704,12 @@ public final class L2ItemInstance extends L2Object
 	@Override
 	@Override
 	public String toString()
 	public String toString()
 	{
 	{
-		return _item+"["+getObjectId()+"]";
+		return _item + "[" + getObjectId() + "]";
 	}
 	}
 	
 	
 	public void resetOwnerTimer()
 	public void resetOwnerTimer()
 	{
 	{
-		if(itemLootShedule != null)
+		if (itemLootShedule != null)
 			itemLootShedule.cancel(true);
 			itemLootShedule.cancel(true);
 		itemLootShedule = null;
 		itemLootShedule = null;
 	}
 	}
@@ -1779,7 +1761,7 @@ public final class L2ItemInstance extends L2Object
 	
 	
 	public void restoreInitCount()
 	public void restoreInitCount()
 	{
 	{
-		if(_decrease)
+		if (_decrease)
 			setCount(_initCount);
 			setCount(_initCount);
 	}
 	}
 	
 	
@@ -1811,7 +1793,7 @@ public final class L2ItemInstance extends L2Object
 			{
 			{
 				L2ItemInstance[] unequiped = player.getInventory().unEquipItemInSlotAndRecord(getLocationSlot());
 				L2ItemInstance[] unequiped = player.getInventory().unEquipItemInSlotAndRecord(getLocationSlot());
 				InventoryUpdate iu = new InventoryUpdate();
 				InventoryUpdate iu = new InventoryUpdate();
-				for (L2ItemInstance item: unequiped)
+				for (L2ItemInstance item : unequiped)
 				{
 				{
 					player.checkSShotsMatch(null, item);
 					player.checkSShotsMatch(null, item);
 					iu.addModifiedItem(item);
 					iu.addModifiedItem(item);
@@ -1847,7 +1829,8 @@ public final class L2ItemInstance extends L2Object
 	
 	
 	public void scheduleLifeTimeTask()
 	public void scheduleLifeTimeTask()
 	{
 	{
-		if (!isTimeLimitedItem()) return;
+		if (!isTimeLimitedItem())
+			return;
 		if (getRemainingTime() <= 0)
 		if (getRemainingTime() <= 0)
 			endOfLife();
 			endOfLife();
 		else
 		else
@@ -1927,7 +1910,8 @@ public final class L2ItemInstance extends L2Object
 		_published = true;
 		_published = true;
 	}
 	}
 	
 	
-	/* (non-Javadoc)
+	/*
+	 * (non-Javadoc)
 	 * @see com.l2jserver.gameserver.model.L2Object#decayMe()
 	 * @see com.l2jserver.gameserver.model.L2Object#decayMe()
 	 */
 	 */
 	@Override
 	@Override
@@ -1965,11 +1949,11 @@ public final class L2ItemInstance extends L2Object
 		L2PcInstance player = L2World.getInstance().getPlayer(getOwnerId());
 		L2PcInstance player = L2World.getInstance().getPlayer(getOwnerId());
 		int enchant = getEnchantLevel();
 		int enchant = getEnchantLevel();
 		
 		
-		if(player == null)
+		if (player == null)
 			return enchant;
 			return enchant;
 		
 		
 		if (player.isInOlympiadMode() && Config.ALT_OLY_ENCHANT_LIMIT >= 0 && enchant > Config.ALT_OLY_ENCHANT_LIMIT)
 		if (player.isInOlympiadMode() && Config.ALT_OLY_ENCHANT_LIMIT >= 0 && enchant > Config.ALT_OLY_ENCHANT_LIMIT)
-				enchant = Config.ALT_OLY_ENCHANT_LIMIT;
+			enchant = Config.ALT_OLY_ENCHANT_LIMIT;
 		
 		
 		return enchant;
 		return enchant;
 	}
 	}

+ 1 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/L2Object.java

@@ -320,6 +320,7 @@ public abstract class L2Object
 		assert getPosition().getWorldRegion() != null || _isVisible;
 		assert getPosition().getWorldRegion() != null || _isVisible;
 		return getPosition().getX();
 		return getPosition().getX();
 	}
 	}
+	
 	/**
 	/**
 	 * @return The id of the instance zone the object is in - id 0 is global
 	 * @return The id of the instance zone the object is in - id 0 is global
 	 * since everything like dropped items, mobs, players can be in a instanciated area, it must be in l2object
 	 * since everything like dropped items, mobs, players can be in a instanciated area, it must be in l2object

+ 25 - 14
L2J_Server_BETA/java/com/l2jserver/gameserver/model/L2Spawn.java

@@ -102,13 +102,10 @@ public class L2Spawn
 	/** The task launching the function doSpawn() */
 	/** The task launching the function doSpawn() */
 	class SpawnTask implements Runnable
 	class SpawnTask implements Runnable
 	{
 	{
-		//L2NpcInstance _instance;
-		//int _objId;
-		private L2Npc _oldNpc;
+		private final L2Npc _oldNpc;
 		
 		
-		public SpawnTask(/*int objid*/L2Npc pOldNpc)
+		public SpawnTask(L2Npc pOldNpc)
 		{
 		{
-			//_objId= objid;
 			_oldNpc = pOldNpc;
 			_oldNpc = pOldNpc;
 		}
 		}
 		
 		
@@ -182,6 +179,11 @@ public class L2Spawn
 		return _location;
 		return _location;
 	}
 	}
 	
 	
+	public Location getSpawnLocation()
+	{
+		return new Location(getLocx(), getLocy(), getLocz(), getHeading());
+	}
+	
 	/**
 	/**
 	 * @return the X position of the spwan point.
 	 * @return the X position of the spwan point.
 	 */
 	 */
@@ -254,7 +256,7 @@ public class L2Spawn
 	}
 	}
 	
 	
 	/**
 	/**
-	 * Set the Identifier of the location area where L2NpcInstance can be spwaned.<BR><BR>
+	 * Set the Identifier of the location area where L2NpcInstance can be spawned.<BR><BR>
 	 * @param location 
 	 * @param location 
 	 */
 	 */
 	public void setLocation(int location)
 	public void setLocation(int location)
@@ -278,7 +280,7 @@ public class L2Spawn
 		_respawnMaxDelay = date;
 		_respawnMaxDelay = date;
 	}
 	}
 	/**
 	/**
-	 * Set the X position of the spwan point.<BR><BR>
+	 * Set the X position of the spawn point.<BR><BR>
 	 * @param locx 
 	 * @param locx 
 	 */
 	 */
 	public void setLocx(int locx)
 	public void setLocx(int locx)
@@ -287,7 +289,7 @@ public class L2Spawn
 	}
 	}
 	
 	
 	/**
 	/**
-	 * Set the Y position of the spwan point.<BR><BR>
+	 * Set the Y position of the spawn point.<BR><BR>
 	 * @param locy 
 	 * @param locy 
 	 */
 	 */
 	public void setLocy(int locy)
 	public void setLocy(int locy)
@@ -296,7 +298,7 @@ public class L2Spawn
 	}
 	}
 	
 	
 	/**
 	/**
-	 * Set the Z position of the spwan point.<BR><BR>
+	 * Set the Z position of the spawn point.<BR><BR>
 	 * @param locz 
 	 * @param locz 
 	 */
 	 */
 	public void setLocz(int locz)
 	public void setLocz(int locz)
@@ -304,6 +306,18 @@ public class L2Spawn
 		_locZ = locz;
 		_locZ = locz;
 	}
 	}
 	
 	
+	/**
+	 * Set the XYZ position of the spawn point.<BR><BR>
+	 * @param loc 
+	 */
+	public void setLocation(Location loc)
+	{
+		_locX = loc.getX();
+		_locY = loc.getY();
+		_locZ = loc.getZ();
+		_heading = loc.getHeading();
+	}
+	
 	/**
 	/**
 	 * Set the heading of L2NpcInstance when they are spawned.<BR><BR>
 	 * Set the heading of L2NpcInstance when they are spawned.<BR><BR>
 	 * @param heading 
 	 * @param heading 
@@ -342,7 +356,7 @@ public class L2Spawn
 	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : A respawn is possible ONLY if _doRespawn=True and _scheduledCount + _currentCount < _maximumCount</B></FONT><BR><BR>
 	 * <FONT COLOR=#FF0000><B> <U>Caution</U> : A respawn is possible ONLY if _doRespawn=True and _scheduledCount + _currentCount < _maximumCount</B></FONT><BR><BR>
 	 * @param oldNpc 
 	 * @param oldNpc 
 	 */
 	 */
-	public void decreaseCount(/*int npcId*/L2Npc oldNpc)
+	public void decreaseCount(L2Npc oldNpc)
 	{
 	{
 		// sanity check
 		// sanity check
 		if (_currentCount <= 0)
 		if (_currentCount <= 0)
@@ -624,7 +638,7 @@ public class L2Spawn
 		if (_doRespawn)
 		if (_doRespawn)
 		{
 		{
 			oldNpc.refreshID();
 			oldNpc.refreshID();
-			/*L2NpcInstance instance = */initializeNpcInstance(oldNpc);
+			initializeNpcInstance(oldNpc);
 		}
 		}
 	}
 	}
 	
 	
@@ -643,9 +657,6 @@ public class L2Spawn
 		_instanceId = instanceId;
 		_instanceId = instanceId;
 	}
 	}
 	
 	
-	/* (non-Javadoc)
-	 * @see java.lang.Object#toString()
-	 */
 	@Override
 	@Override
 	public String toString()
 	public String toString()
 	{
 	{

+ 20 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/model/Location.java

@@ -24,11 +24,11 @@ import com.l2jserver.gameserver.model.actor.L2Character;
 
 
 public final class Location
 public final class Location
 {
 {
-	private int _x;
-	private int _y;
-	private int _z;
+	private final int _x;
+	private final int _y;
+	private final int _z;
 	private int _heading;
 	private int _heading;
-	
+	private int _instanceId;
 	
 	
 	public Location(int x, int y, int z)
 	public Location(int x, int y, int z)
 	{
 	{
@@ -42,6 +42,7 @@ public final class Location
 		_x = obj.getX();
 		_x = obj.getX();
 		_y = obj.getY();
 		_y = obj.getY();
 		_z = obj.getZ();
 		_z = obj.getZ();
+		_instanceId = obj.getInstanceId();
 	}
 	}
 	
 	
 	public Location(L2Character obj)
 	public Location(L2Character obj)
@@ -50,6 +51,7 @@ public final class Location
 		_y = obj.getY();
 		_y = obj.getY();
 		_z = obj.getZ();
 		_z = obj.getZ();
 		_heading = obj.getHeading();
 		_heading = obj.getHeading();
+		_instanceId = obj.getInstanceId();
 	}
 	}
 	
 	
 	
 	
@@ -61,6 +63,15 @@ public final class Location
 		_heading = heading;
 		_heading = heading;
 	}
 	}
 	
 	
+	public Location(int x, int y, int z, int heading, int instanceId)
+	{
+		_x = x;
+		_y = y;
+		_z = z;
+		_heading = heading;
+		_instanceId = instanceId;
+	}
+	
 	public int getX()
 	public int getX()
 	{
 	{
 		return _x;
 		return _x;
@@ -80,4 +91,9 @@ public final class Location
 	{
 	{
 		return _heading;
 		return _heading;
 	}
 	}
+	
+	public int getInstanceId()
+	{
+		return _instanceId;
+	}
 }
 }

+ 10 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/L2Character.java

@@ -4218,6 +4218,11 @@ public abstract class L2Character extends L2Object
 		_heading = heading;
 		_heading = heading;
 	}
 	}
 	
 	
+	public Location getLocation()
+	{
+		return new Location(getX(), getY(), getZ(), getHeading(), getInstanceId());
+	}
+	
 	public final int getXdestination()
 	public final int getXdestination()
 	{
 	{
 		MoveData m = _move;
 		MoveData m = _move;
@@ -5175,6 +5180,11 @@ public abstract class L2Character extends L2Object
 		return isInsideRadius(x, y, 0, radius, false, strictCheck);
 		return isInsideRadius(x, y, 0, radius, false, strictCheck);
 	}
 	}
 	
 	
+	public final boolean isInsideRadius(Location loc, int radius, boolean checkZ, boolean strictCheck)
+	{
+		return isInsideRadius(loc.getX(), loc.getY(), loc.getZ(), radius, checkZ, strictCheck);
+	}
+	
 	/**
 	/**
 	 * Check if this object is inside the given radius around the given point.<BR><BR>
 	 * Check if this object is inside the given radius around the given point.<BR><BR>
 	 *
 	 *

+ 11 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/quest/Quest.java

@@ -38,6 +38,7 @@ import com.l2jserver.gameserver.model.L2Object;
 import com.l2jserver.gameserver.model.L2Party;
 import com.l2jserver.gameserver.model.L2Party;
 import com.l2jserver.gameserver.model.L2Skill;
 import com.l2jserver.gameserver.model.L2Skill;
 import com.l2jserver.gameserver.model.L2Spawn;
 import com.l2jserver.gameserver.model.L2Spawn;
+import com.l2jserver.gameserver.model.Location;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.L2Npc;
 import com.l2jserver.gameserver.model.actor.L2Npc;
 import com.l2jserver.gameserver.model.actor.L2Trap;
 import com.l2jserver.gameserver.model.actor.L2Trap;
@@ -1844,11 +1845,21 @@ public class Quest extends ManagedScript
 		return addSpawn(npcId, x, y, z, heading, randomOffSet, despawnDelay, false);
 		return addSpawn(npcId, x, y, z, heading, randomOffSet, despawnDelay, false);
 	}
 	}
 	
 	
+	public L2Npc addSpawn(int npcId, Location loc, boolean randomOffSet, long despawnDelay)
+	{
+		return addSpawn(npcId, loc.getX(), loc.getY(), loc.getZ(), loc.getHeading(), randomOffSet, despawnDelay, false);
+	}
+	
 	public L2Npc addSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffset, long despawnDelay, boolean isSummonSpawn)
 	public L2Npc addSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffset, long despawnDelay, boolean isSummonSpawn)
 	{
 	{
 		return addSpawn(npcId, x, y, z, heading, randomOffset, despawnDelay, isSummonSpawn, 0);
 		return addSpawn(npcId, x, y, z, heading, randomOffset, despawnDelay, isSummonSpawn, 0);
 	}
 	}
 	
 	
+	public L2Npc addSpawn(int npcId, Location loc, boolean randomOffset, long despawnDelay, boolean isSummonSpawn)
+	{
+		return addSpawn(npcId, loc.getX(), loc.getY(), loc.getZ(), loc.getHeading(), randomOffset, despawnDelay, isSummonSpawn, 0);
+	}
+	
 	public L2Npc addSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffset, long despawnDelay, boolean isSummonSpawn, int instanceId)
 	public L2Npc addSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffset, long despawnDelay, boolean isSummonSpawn, int instanceId)
 	{
 	{
 		L2Npc result = null;
 		L2Npc result = null;