diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Summon.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Summon.java index 2f121facf7..7570bd494b 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Summon.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/L2Summon.java @@ -27,6 +27,7 @@ import com.l2jmobius.gameserver.datatables.ItemTable; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.enums.Race; import com.l2jmobius.gameserver.enums.Team; +import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.handler.IItemHandler; import com.l2jmobius.gameserver.handler.ItemHandler; import com.l2jmobius.gameserver.instancemanager.ZoneManager; @@ -34,6 +35,7 @@ import com.l2jmobius.gameserver.model.AggroInfo; import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2Party; import com.l2jmobius.gameserver.model.L2World; +import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.stat.SummonStat; import com.l2jmobius.gameserver.model.actor.status.SummonStatus; @@ -96,7 +98,12 @@ public abstract class L2Summon extends L2Playable _owner = owner; getAI(); - setXYZInvisible(owner.getX() + Rnd.get(-100, 100), owner.getY() + Rnd.get(-100, 100), owner.getZ()); + // Make sure summon does not spawn in a wall. + final int x = owner.getX(); + final int y = owner.getY(); + final int z = owner.getZ(); + final Location location = GeoEngine.getInstance().canMoveToTargetLoc(x, y, z, x + Rnd.get(-100, 100), y + Rnd.get(-100, 100), z, owner.getInstanceWorld()); + setXYZInvisible(location.getX(), location.getY(), location.getZ()); } @Override diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Summon.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Summon.java index 2f121facf7..7570bd494b 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Summon.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/L2Summon.java @@ -27,6 +27,7 @@ import com.l2jmobius.gameserver.datatables.ItemTable; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.enums.Race; import com.l2jmobius.gameserver.enums.Team; +import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.handler.IItemHandler; import com.l2jmobius.gameserver.handler.ItemHandler; import com.l2jmobius.gameserver.instancemanager.ZoneManager; @@ -34,6 +35,7 @@ import com.l2jmobius.gameserver.model.AggroInfo; import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2Party; import com.l2jmobius.gameserver.model.L2World; +import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.stat.SummonStat; import com.l2jmobius.gameserver.model.actor.status.SummonStatus; @@ -96,7 +98,12 @@ public abstract class L2Summon extends L2Playable _owner = owner; getAI(); - setXYZInvisible(owner.getX() + Rnd.get(-100, 100), owner.getY() + Rnd.get(-100, 100), owner.getZ()); + // Make sure summon does not spawn in a wall. + final int x = owner.getX(); + final int y = owner.getY(); + final int z = owner.getZ(); + final Location location = GeoEngine.getInstance().canMoveToTargetLoc(x, y, z, x + Rnd.get(-100, 100), y + Rnd.get(-100, 100), z, owner.getInstanceWorld()); + setXYZInvisible(location.getX(), location.getY(), location.getZ()); } @Override diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Summon.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Summon.java index 673d6a36aa..a103c9edc4 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Summon.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/L2Summon.java @@ -27,6 +27,7 @@ import com.l2jmobius.gameserver.datatables.ItemTable; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.enums.Race; import com.l2jmobius.gameserver.enums.Team; +import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.handler.IItemHandler; import com.l2jmobius.gameserver.handler.ItemHandler; import com.l2jmobius.gameserver.instancemanager.ZoneManager; @@ -34,6 +35,7 @@ import com.l2jmobius.gameserver.model.AggroInfo; import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2Party; import com.l2jmobius.gameserver.model.L2World; +import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.stat.SummonStat; import com.l2jmobius.gameserver.model.actor.status.SummonStatus; @@ -96,7 +98,12 @@ public abstract class L2Summon extends L2Playable _owner = owner; getAI(); - setXYZInvisible(owner.getX() + Rnd.get(-100, 100), owner.getY() + Rnd.get(-100, 100), owner.getZ()); + // Make sure summon does not spawn in a wall. + final int x = owner.getX(); + final int y = owner.getY(); + final int z = owner.getZ(); + final Location location = GeoEngine.getInstance().canMoveToTargetLoc(x, y, z, x + Rnd.get(-100, 100), y + Rnd.get(-100, 100), z, owner.getInstanceWorld()); + setXYZInvisible(location.getX(), location.getY(), location.getZ()); } @Override diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/L2Summon.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/L2Summon.java index 673d6a36aa..a103c9edc4 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/L2Summon.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/L2Summon.java @@ -27,6 +27,7 @@ import com.l2jmobius.gameserver.datatables.ItemTable; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.enums.Race; import com.l2jmobius.gameserver.enums.Team; +import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.handler.IItemHandler; import com.l2jmobius.gameserver.handler.ItemHandler; import com.l2jmobius.gameserver.instancemanager.ZoneManager; @@ -34,6 +35,7 @@ import com.l2jmobius.gameserver.model.AggroInfo; import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2Party; import com.l2jmobius.gameserver.model.L2World; +import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.stat.SummonStat; import com.l2jmobius.gameserver.model.actor.status.SummonStatus; @@ -96,7 +98,12 @@ public abstract class L2Summon extends L2Playable _owner = owner; getAI(); - setXYZInvisible(owner.getX() + Rnd.get(-100, 100), owner.getY() + Rnd.get(-100, 100), owner.getZ()); + // Make sure summon does not spawn in a wall. + final int x = owner.getX(); + final int y = owner.getY(); + final int z = owner.getZ(); + final Location location = GeoEngine.getInstance().canMoveToTargetLoc(x, y, z, x + Rnd.get(-100, 100), y + Rnd.get(-100, 100), z, owner.getInstanceWorld()); + setXYZInvisible(location.getX(), location.getY(), location.getZ()); } @Override diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/L2Summon.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/L2Summon.java index 264662c5c6..86f511530f 100644 --- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/L2Summon.java +++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/L2Summon.java @@ -17,6 +17,7 @@ package com.l2jmobius.gameserver.model.actor; import com.l2jmobius.Config; +import com.l2jmobius.commons.util.Rnd; import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.ai.L2CharacterAI; import com.l2jmobius.gameserver.ai.L2SummonAI; @@ -35,6 +36,7 @@ import com.l2jmobius.gameserver.model.actor.instance.L2ItemInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2SiegeSummonInstance; import com.l2jmobius.gameserver.model.actor.knownlist.SummonKnownList; +import com.l2jmobius.gameserver.model.actor.position.Location; import com.l2jmobius.gameserver.model.actor.stat.SummonStat; import com.l2jmobius.gameserver.model.actor.status.SummonStatus; import com.l2jmobius.gameserver.network.SystemMessageId; @@ -104,7 +106,12 @@ public abstract class L2Summon extends L2Playable _owner = owner; _ai = new L2SummonAI(new L2Summon.AIAccessor()); - setXYZInvisible(owner.getX() + 50, owner.getY() + 100, owner.getZ() + 100); + // Make sure summon does not spawn in a wall. + final int x = owner.getX(); + final int y = owner.getY(); + final int z = owner.getZ(); + final Location location = GeoData.getInstance().moveCheck(x, y, z, x + Rnd.get(-100, 100), y + Rnd.get(-100, 100), z); + setXYZInvisible(location.getX(), location.getY(), location.getZ()); } @Override @@ -635,24 +642,24 @@ public abstract class L2Summon extends L2Playable switch (skill.getTargetType()) { // OWNER_PET should be cast even if no target has been found - case TARGET_OWNER_PET: + case TARGET_OWNER_PET: { target = getOwner(); - break; + break; } // PARTY, AURA, SELF should be cast even if no target has been found case TARGET_PARTY: case TARGET_AURA: - case TARGET_SELF: + case TARGET_SELF: { target = this; - break; + break; } - default: + default: { // Get the first target of the list target = skill.getFirstOfTargetList(this); - break; + break; } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Summon.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Summon.java index c9e96038a6..73017d0165 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Summon.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Summon.java @@ -37,6 +37,7 @@ import com.l2jmobius.gameserver.model.AggroInfo; import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2Party; import com.l2jmobius.gameserver.model.L2World; +import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.actor.instance.L2NpcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.stat.SummonStat; @@ -103,7 +104,12 @@ public abstract class L2Summon extends L2Playable _owner = owner; getAI(); - setXYZInvisible(owner.getX() + Rnd.get(-100, 100), owner.getY() + Rnd.get(-100, 100), owner.getZ()); + // Make sure summon does not spawn in a wall. + final int x = owner.getX(); + final int y = owner.getY(); + final int z = owner.getZ(); + final Location location = GeoEngine.getInstance().canMoveToTargetLoc(x, y, z, x + Rnd.get(-100, 100), y + Rnd.get(-100, 100), z, owner.getInstanceId()); + setXYZInvisible(location.getX(), location.getY(), location.getZ()); } @Override diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Summon.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Summon.java index 575bc38cdd..67b1130e8f 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Summon.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/L2Summon.java @@ -27,6 +27,7 @@ import com.l2jmobius.gameserver.datatables.ItemTable; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.enums.Race; import com.l2jmobius.gameserver.enums.Team; +import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.handler.IItemHandler; import com.l2jmobius.gameserver.handler.ItemHandler; import com.l2jmobius.gameserver.instancemanager.ZoneManager; @@ -34,6 +35,7 @@ import com.l2jmobius.gameserver.model.AggroInfo; import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2Party; import com.l2jmobius.gameserver.model.L2World; +import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.stat.SummonStat; import com.l2jmobius.gameserver.model.actor.status.SummonStatus; @@ -96,7 +98,12 @@ public abstract class L2Summon extends L2Playable _owner = owner; getAI(); - setXYZInvisible(owner.getX() + Rnd.get(-100, 100), owner.getY() + Rnd.get(-100, 100), owner.getZ()); + // Make sure summon does not spawn in a wall. + final int x = owner.getX(); + final int y = owner.getY(); + final int z = owner.getZ(); + final Location location = GeoEngine.getInstance().canMoveToTargetLoc(x, y, z, x + Rnd.get(-100, 100), y + Rnd.get(-100, 100), z, owner.getInstanceWorld()); + setXYZInvisible(location.getX(), location.getY(), location.getZ()); } @Override diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/L2Summon.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/L2Summon.java index 575bc38cdd..67b1130e8f 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/L2Summon.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/L2Summon.java @@ -27,6 +27,7 @@ import com.l2jmobius.gameserver.datatables.ItemTable; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.enums.Race; import com.l2jmobius.gameserver.enums.Team; +import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.handler.IItemHandler; import com.l2jmobius.gameserver.handler.ItemHandler; import com.l2jmobius.gameserver.instancemanager.ZoneManager; @@ -34,6 +35,7 @@ import com.l2jmobius.gameserver.model.AggroInfo; import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2Party; import com.l2jmobius.gameserver.model.L2World; +import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.stat.SummonStat; import com.l2jmobius.gameserver.model.actor.status.SummonStatus; @@ -96,7 +98,12 @@ public abstract class L2Summon extends L2Playable _owner = owner; getAI(); - setXYZInvisible(owner.getX() + Rnd.get(-100, 100), owner.getY() + Rnd.get(-100, 100), owner.getZ()); + // Make sure summon does not spawn in a wall. + final int x = owner.getX(); + final int y = owner.getY(); + final int z = owner.getZ(); + final Location location = GeoEngine.getInstance().canMoveToTargetLoc(x, y, z, x + Rnd.get(-100, 100), y + Rnd.get(-100, 100), z, owner.getInstanceWorld()); + setXYZInvisible(location.getX(), location.getY(), location.getZ()); } @Override diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/L2Summon.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/L2Summon.java index 575bc38cdd..67b1130e8f 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/L2Summon.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/L2Summon.java @@ -27,6 +27,7 @@ import com.l2jmobius.gameserver.datatables.ItemTable; import com.l2jmobius.gameserver.enums.InstanceType; import com.l2jmobius.gameserver.enums.Race; import com.l2jmobius.gameserver.enums.Team; +import com.l2jmobius.gameserver.geoengine.GeoEngine; import com.l2jmobius.gameserver.handler.IItemHandler; import com.l2jmobius.gameserver.handler.ItemHandler; import com.l2jmobius.gameserver.instancemanager.ZoneManager; @@ -34,6 +35,7 @@ import com.l2jmobius.gameserver.model.AggroInfo; import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2Party; import com.l2jmobius.gameserver.model.L2World; +import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.stat.SummonStat; import com.l2jmobius.gameserver.model.actor.status.SummonStatus; @@ -96,7 +98,12 @@ public abstract class L2Summon extends L2Playable _owner = owner; getAI(); - setXYZInvisible(owner.getX() + Rnd.get(-100, 100), owner.getY() + Rnd.get(-100, 100), owner.getZ()); + // Make sure summon does not spawn in a wall. + final int x = owner.getX(); + final int y = owner.getY(); + final int z = owner.getZ(); + final Location location = GeoEngine.getInstance().canMoveToTargetLoc(x, y, z, x + Rnd.get(-100, 100), y + Rnd.get(-100, 100), z, owner.getInstanceWorld()); + setXYZInvisible(location.getX(), location.getY(), location.getZ()); } @Override