Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: java/com/l2jserver/gameserver/model/zone/L2ZoneType.java
- ===================================================================
- --- java/com/l2jserver/gameserver/model/zone/L2ZoneType.java (revision 4663)
- +++ java/com/l2jserver/gameserver/model/zone/L2ZoneType.java (working copy)
- @@ -45,6 +45,7 @@
- private boolean _checkAffected = false;
- private String _name = null;
- + private int _instanceId = -1;
- private int _minLvl;
- private int _maxLvl;
- private int[] _race;
- @@ -89,6 +90,10 @@
- {
- _name = value;
- }
- + else if (name.equals("instanceId"))
- + {
- + _instanceId = Integer.parseInt(value);
- + }
- // Minimum level
- else if (name.equals("affectedLvlMin"))
- {
- @@ -269,6 +274,24 @@
- {
- return _name;
- }
- +
- + /**
- + * Set the zone instanceId.
- + * @param instanceId
- + */
- + public void setInstanceId(int instanceId)
- + {
- + _instanceId = instanceId;
- + }
- +
- + /**
- + * Returns zone instanceId
- + * @return
- + */
- + public int getInstanceId()
- + {
- + return _instanceId;
- + }
- /**
- * Checks if the given coordinates are within zone's plane
- @@ -281,7 +304,7 @@
- }
- /**
- - * Checks if the given coordinates are within the zone
- + * Checks if the given coordinates are within the zone, ignores instanceId check
- * @param x
- * @param y
- * @param z
- @@ -292,13 +315,31 @@
- }
- /**
- + * Checks if the given coordinates are within the zone and the instanceId used
- + * matched the zone's instanceId
- + * @param x
- + * @param y
- + * @param z
- + * @param instanceId
- + */
- + public boolean isInsideZone(int x, int y, int z, int instanceId)
- + {
- + // It will check if coords are within the zone if the given instanceId or
- + // the zone's _instanceId are in the multiverse or they match
- + if (_instanceId == -1 || instanceId == -1 || _instanceId == instanceId)
- + return _zone.isInsideZone(x, y, z);
- + else
- + return false;
- + }
- +
- + /**
- * Checks if the given object is inside the zone.
- *
- * @param object
- */
- public boolean isInsideZone(L2Object object)
- {
- - return isInsideZone(object.getX(), object.getY(), object.getZ());
- + return isInsideZone(object.getX(), object.getY(), object.getZ(), object.getInstanceId());
- }
- public double getDistanceToZone(int x, int y)
- @@ -321,7 +362,7 @@
- }
- // If the object is inside the zone...
- - if (isInsideZone(character.getX(), character.getY(), character.getZ()))
- + if (isInsideZone(character))
- {
- // Was the character not yet inside this zone?
- if (!_characterList.containsKey(character.getObjectId()))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement