Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: java/net/sf/l2j/gameserver/model/L2Object.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/L2Object.java (revision 2)
- +++ java/net/sf/l2j/gameserver/model/L2Object.java (working copy)
- @@ -26,6 +26,8 @@
- import net.sf.l2j.gameserver.idfactory.IdFactory;
- import net.sf.l2j.gameserver.model.actor.L2Character;
- import net.sf.l2j.gameserver.model.actor.L2Npc;
- +import net.sf.l2j.gameserver.model.actor.instance.L2DoorInstance;
- +import net.sf.l2j.gameserver.model.actor.instance.L2FenceInstance;
- import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
- import net.sf.l2j.gameserver.model.zone.ZoneId;
- @@ -55,6 +57,7 @@
- private SpawnLocation _position = new SpawnLocation(0, 0, 0, 0);
- private WorldRegion _region;
- + private int _instance = 0;
- private boolean _isVisible;
- @@ -223,6 +226,18 @@
- return null;
- }
- + public void setInstanceId(int val)
- + {
- + _instance = val;
- + decayMe();
- + spawnMe();
- + }
- +
- + public int getInstanceId()
- + {
- + return _instance;
- + }
- +
- /**
- * Sends the Server->Client info packet for the object. Is Overridden in:
- * <li>L2BoatInstance</li>
- @@ -409,6 +424,12 @@
- }
- _region = newRegion;
- +
- + for (L2Object object : getDifferentInstanceObjects())
- + {
- + object.removeKnownObject(this);
- + removeKnownObject(object);
- + }
- }
- /**
- @@ -427,6 +448,28 @@
- {
- }
- + private final List<L2Object> getDifferentInstanceObjects()
- + {
- + final WorldRegion region = _region;
- + if (region == null)
- + return Collections.emptyList();
- +
- + final List<L2Object> result = new ArrayList<>();
- +
- + for (WorldRegion reg : region.getSurroundingRegions())
- + {
- + for (L2Object obj : reg.getObjects())
- + {
- + if (obj == this || obj.getInstanceId() == getInstanceId() || obj instanceof L2DoorInstance || obj instanceof L2FenceInstance)
- + continue;
- +
- + result.add(obj);
- + }
- + }
- +
- + return result;
- + }
- +
- /**
- * Return the known list of given object type.
- * @param <A> : Object type must be instance of {@link L2Object}.
- @@ -449,6 +492,9 @@
- if (obj == this || !type.isAssignableFrom(obj.getClass()))
- continue;
- + if (obj.getInstanceId() != getInstanceId() && !(obj instanceof L2DoorInstance || obj instanceof L2FenceInstance))
- + continue;
- +
- result.add((A) obj);
- }
- }
- @@ -479,6 +525,9 @@
- if (obj == this || !type.isAssignableFrom(obj.getClass()) || !Util.checkIfInRange(radius, this, obj, true))
- continue;
- + if (obj.getInstanceId() != getInstanceId() && !(obj instanceof L2DoorInstance || obj instanceof L2FenceInstance))
- + continue;
- +
- result.add((A) obj);
- }
- }
- Index: java/net/sf/l2j/gameserver/model/actor/L2Attackable.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/L2Attackable.java (revision 3)
- +++ java/net/sf/l2j/gameserver/model/actor/L2Attackable.java (working copy)
- @@ -970,6 +970,7 @@
- {
- // Init the dropped ItemInstance and add it in the world as a visible object at the position where mob was last
- item = ItemTable.getInstance().createItem("Loot", holder.getId(), holder.getValue(), mainDamageDealer, this);
- + item.setInstanceId(getInstanceId());
- item.dropMe(this, getX() + Rnd.get(-70, 70), getY() + Rnd.get(-70, 70), Math.max(getZ(), mainDamageDealer.getZ()) + 20);
- // If stackable, end loop as entire count is included in 1 instance of item
- Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 17)
- +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
- @@ -2654,6 +2654,8 @@
- return null;
- }
- + item.setInstanceId(getInstanceId());
- +
- item.dropMe(this, x, y, z);
- // Send inventory update packet
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement