Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: java/com/l2jserver/gameserver/model/olympiad/AbstractOlympiadGame.java
- ===================================================================
- --- java/com/l2jserver/gameserver/model/olympiad/AbstractOlympiadGame.java (revision 7)
- +++ java/com/l2jserver/gameserver/model/olympiad/AbstractOlympiadGame.java (working copy)
- @@ -26,9 +26,9 @@
- import com.l2jserver.gameserver.instancemanager.FortManager;
- import com.l2jserver.gameserver.model.L2ItemInstance;
- import com.l2jserver.gameserver.model.L2Party;
- +import com.l2jserver.gameserver.model.L2Party.messageType;
- import com.l2jserver.gameserver.model.L2Skill;
- import com.l2jserver.gameserver.model.Location;
- -import com.l2jserver.gameserver.model.L2Party.messageType;
- import com.l2jserver.gameserver.model.actor.L2Character;
- import com.l2jserver.gameserver.model.actor.L2Summon;
- import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
- @@ -171,7 +171,7 @@
- player.setIsOlympiadStart(false);
- player.setOlympiadSide(par.side);
- player.olyBuff = 5;
- - player.setInstanceId(0);
- + player.setInstanceId(OlympiadGameManager.getInstance().getOlympiadTask(id).getZone().getInstanceId());
- player.teleToLocation(loc, false);
- player.sendPacket(new ExOlympiadMode(2));
- }
- Index: java/com/l2jserver/gameserver/model/zone/L2ZoneType.java
- ===================================================================
- --- java/com/l2jserver/gameserver/model/zone/L2ZoneType.java (revision 7)
- +++ java/com/l2jserver/gameserver/model/zone/L2ZoneType.java (working copy)
- @@ -22,6 +22,7 @@
- import javolution.util.FastList;
- import javolution.util.FastMap;
- +import com.l2jserver.gameserver.instancemanager.InstanceManager;
- import com.l2jserver.gameserver.model.L2Object;
- import com.l2jserver.gameserver.model.L2Object.InstanceType;
- import com.l2jserver.gameserver.model.actor.L2Character;
- @@ -48,6 +49,8 @@
- private boolean _checkAffected = false;
- private String _name = null;
- + private int _instanceId = -1;
- + private String _instanceTemplate = "";
- private int _minLvl;
- private int _maxLvl;
- private int[] _race;
- @@ -92,6 +95,15 @@
- {
- _name = value;
- }
- + else if (name.equals("instanceId"))
- + {
- + _instanceId = Integer.parseInt(value);
- + }
- + else if (name.equals("instanceTemplate"))
- + {
- + _instanceTemplate = value;
- + _instanceId = InstanceManager.getInstance().createDynamicInstance(value);
- + }
- // Minimum level
- else if (name.equals("affectedLvlMin"))
- {
- @@ -272,8 +284,35 @@
- {
- return _name;
- }
- +
- + /**
- + * Set the zone instanceId.
- + * @param instanceId
- + */
- + public void setInstanceId(int instanceId)
- + {
- + _instanceId = instanceId;
- + }
- /**
- + * Returns zone instanceId
- + * @return
- + */
- + public int getInstanceId()
- + {
- + return _instanceId;
- + }
- +
- + /**
- + * Returns zone instanceTemplate
- + * @return
- + */
- + public String getInstanceTemplate()
- + {
- + return _instanceTemplate;
- + }
- +
- + /**
- * Checks if the given coordinates are within zone's plane
- * @param x
- * @param y
- @@ -284,7 +323,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
- @@ -295,13 +334,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)
- @@ -324,7 +381,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()))
- Index: java/com/l2jserver/gameserver/model/zone/type/L2OlympiadStadiumZone.java
- ===================================================================
- --- java/com/l2jserver/gameserver/model/zone/type/L2OlympiadStadiumZone.java (revision 7)
- +++ java/com/l2jserver/gameserver/model/zone/type/L2OlympiadStadiumZone.java (working copy)
- @@ -18,6 +18,7 @@
- import java.util.List;
- import com.l2jserver.gameserver.ThreadPoolManager;
- +import com.l2jserver.gameserver.instancemanager.InstanceManager;
- import com.l2jserver.gameserver.instancemanager.MapRegionManager;
- import com.l2jserver.gameserver.model.L2Spawn;
- import com.l2jserver.gameserver.model.actor.L2Character;
- @@ -41,7 +42,6 @@
- */
- public class L2OlympiadStadiumZone extends L2ZoneRespawn
- {
- - private final List<L2DoorInstance> _doors;
- private final List<L2Spawn> _buffers;
- OlympiadGameTask _task = null;
- @@ -50,7 +50,6 @@
- {
- super(id);
- _buffers = new ArrayList<L2Spawn>(2);
- - _doors = new ArrayList<L2DoorInstance>(2);
- }
- public final void registerTask(OlympiadGameTask task)
- @@ -60,7 +59,7 @@
- public final void openDoors()
- {
- - for (L2DoorInstance door : _doors)
- + for (L2DoorInstance door : InstanceManager.getInstance().getInstance(getInstanceId()).getDoors())
- {
- if (door != null && !door.getOpen())
- door.openMe();
- @@ -69,7 +68,7 @@
- public final void closeDoors()
- {
- - for (L2DoorInstance door : _doors)
- + for (L2DoorInstance door : InstanceManager.getInstance().getInstance(getInstanceId()).getDoors())
- {
- if (door != null && door.getOpen())
- door.closeMe();
- @@ -157,18 +156,6 @@
- character.deleteMe();
- }
- }
- - else if (character instanceof L2DoorInstance)
- - {
- - for (L2DoorInstance door: _doors)
- - {
- - if (door.getDoorId() == ((L2DoorInstance)character).getDoorId())
- - {
- - _doors.remove(door);
- - break;
- - }
- - }
- - _doors.add((L2DoorInstance)character);
- - }
- }
- @Override
- @@ -188,9 +175,6 @@
- }
- }
- }
- -
- - if (character instanceof L2DoorInstance)
- - _doors.remove(character);
- }
- public final void updateZoneStatusForCharactersInside()
- @@ -256,6 +240,7 @@
- summon.unSummon(_player);
- _player.teleToLocation(MapRegionManager.TeleportWhereType.Town);
- + _player.setInstanceId(0);
- _player = null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement