From 4f9bf81f744c214e9a9b43a34685d31718747c3c Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Sat, 16 Jun 2018 22:44:33 +0000 Subject: [PATCH] Stop attacking admin when using invisible. Contributed by facab. --- .../admincommandhandlers/AdminEffects.java | 21 ++++++++++++++++ .../admincommandhandlers/AdminEffects.java | 21 ++++++++++++++++ .../admincommandhandlers/AdminEffects.java | 21 ++++++++++++++++ .../admincommandhandlers/AdminEffects.java | 21 ++++++++++++++++ .../admincommandhandlers/AdminEffects.java | 25 ++++++++++++++++--- .../admincommandhandlers/AdminEffects.java | 21 ++++++++++++++++ .../admincommandhandlers/AdminEffects.java | 21 ++++++++++++++++ .../admincommandhandlers/AdminEffects.java | 21 ++++++++++++++++ 8 files changed, 168 insertions(+), 4 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java index 4d49efa2f6..70a1570892 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java @@ -19,6 +19,7 @@ package handlers.admincommandhandlers; import java.util.Arrays; import java.util.StringTokenizer; +import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.enums.Movie; import com.l2jmobius.gameserver.enums.Team; import com.l2jmobius.gameserver.handler.IAdminCommandHandler; @@ -125,6 +126,16 @@ public class AdminEffects implements IAdminCommandHandler activeChar.setInvisible(true); activeChar.broadcastUserInfo(); activeChar.sendPacket(new ExUserInfoAbnormalVisualEffect(activeChar)); + L2World.getInstance().forEachVisibleObject(activeChar, L2Character.class, target -> + { + if ((target != null) && (target.getTarget() == activeChar)) + { + target.setTarget(null); + target.abortAttack(); + target.abortCast(); + target.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); + } + }); BuilderUtil.sendSysMessage(activeChar, "Now, you cannot be seen."); } else @@ -144,6 +155,16 @@ public class AdminEffects implements IAdminCommandHandler activeChar.setInvisible(true); activeChar.broadcastUserInfo(); activeChar.sendPacket(new ExUserInfoAbnormalVisualEffect(activeChar)); + L2World.getInstance().forEachVisibleObject(activeChar, L2Character.class, target -> + { + if ((target != null) && (target.getTarget() == activeChar)) + { + target.setTarget(null); + target.abortAttack(); + target.abortCast(); + target.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); + } + }); BuilderUtil.sendSysMessage(activeChar, "Now, you cannot be seen."); } else if (command.startsWith("admin_vis")) diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java index 4d49efa2f6..70a1570892 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java @@ -19,6 +19,7 @@ package handlers.admincommandhandlers; import java.util.Arrays; import java.util.StringTokenizer; +import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.enums.Movie; import com.l2jmobius.gameserver.enums.Team; import com.l2jmobius.gameserver.handler.IAdminCommandHandler; @@ -125,6 +126,16 @@ public class AdminEffects implements IAdminCommandHandler activeChar.setInvisible(true); activeChar.broadcastUserInfo(); activeChar.sendPacket(new ExUserInfoAbnormalVisualEffect(activeChar)); + L2World.getInstance().forEachVisibleObject(activeChar, L2Character.class, target -> + { + if ((target != null) && (target.getTarget() == activeChar)) + { + target.setTarget(null); + target.abortAttack(); + target.abortCast(); + target.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); + } + }); BuilderUtil.sendSysMessage(activeChar, "Now, you cannot be seen."); } else @@ -144,6 +155,16 @@ public class AdminEffects implements IAdminCommandHandler activeChar.setInvisible(true); activeChar.broadcastUserInfo(); activeChar.sendPacket(new ExUserInfoAbnormalVisualEffect(activeChar)); + L2World.getInstance().forEachVisibleObject(activeChar, L2Character.class, target -> + { + if ((target != null) && (target.getTarget() == activeChar)) + { + target.setTarget(null); + target.abortAttack(); + target.abortCast(); + target.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); + } + }); BuilderUtil.sendSysMessage(activeChar, "Now, you cannot be seen."); } else if (command.startsWith("admin_vis")) diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java index 4d49efa2f6..70a1570892 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java @@ -19,6 +19,7 @@ package handlers.admincommandhandlers; import java.util.Arrays; import java.util.StringTokenizer; +import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.enums.Movie; import com.l2jmobius.gameserver.enums.Team; import com.l2jmobius.gameserver.handler.IAdminCommandHandler; @@ -125,6 +126,16 @@ public class AdminEffects implements IAdminCommandHandler activeChar.setInvisible(true); activeChar.broadcastUserInfo(); activeChar.sendPacket(new ExUserInfoAbnormalVisualEffect(activeChar)); + L2World.getInstance().forEachVisibleObject(activeChar, L2Character.class, target -> + { + if ((target != null) && (target.getTarget() == activeChar)) + { + target.setTarget(null); + target.abortAttack(); + target.abortCast(); + target.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); + } + }); BuilderUtil.sendSysMessage(activeChar, "Now, you cannot be seen."); } else @@ -144,6 +155,16 @@ public class AdminEffects implements IAdminCommandHandler activeChar.setInvisible(true); activeChar.broadcastUserInfo(); activeChar.sendPacket(new ExUserInfoAbnormalVisualEffect(activeChar)); + L2World.getInstance().forEachVisibleObject(activeChar, L2Character.class, target -> + { + if ((target != null) && (target.getTarget() == activeChar)) + { + target.setTarget(null); + target.abortAttack(); + target.abortCast(); + target.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); + } + }); BuilderUtil.sendSysMessage(activeChar, "Now, you cannot be seen."); } else if (command.startsWith("admin_vis")) diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java index 4d49efa2f6..70a1570892 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java @@ -19,6 +19,7 @@ package handlers.admincommandhandlers; import java.util.Arrays; import java.util.StringTokenizer; +import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.enums.Movie; import com.l2jmobius.gameserver.enums.Team; import com.l2jmobius.gameserver.handler.IAdminCommandHandler; @@ -125,6 +126,16 @@ public class AdminEffects implements IAdminCommandHandler activeChar.setInvisible(true); activeChar.broadcastUserInfo(); activeChar.sendPacket(new ExUserInfoAbnormalVisualEffect(activeChar)); + L2World.getInstance().forEachVisibleObject(activeChar, L2Character.class, target -> + { + if ((target != null) && (target.getTarget() == activeChar)) + { + target.setTarget(null); + target.abortAttack(); + target.abortCast(); + target.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); + } + }); BuilderUtil.sendSysMessage(activeChar, "Now, you cannot be seen."); } else @@ -144,6 +155,16 @@ public class AdminEffects implements IAdminCommandHandler activeChar.setInvisible(true); activeChar.broadcastUserInfo(); activeChar.sendPacket(new ExUserInfoAbnormalVisualEffect(activeChar)); + L2World.getInstance().forEachVisibleObject(activeChar, L2Character.class, target -> + { + if ((target != null) && (target.getTarget() == activeChar)) + { + target.setTarget(null); + target.abortAttack(); + target.abortCast(); + target.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); + } + }); BuilderUtil.sendSysMessage(activeChar, "Now, you cannot be seen."); } else if (command.startsWith("admin_vis")) diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java index cfb69eae6e..f6ec5a1a96 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java @@ -18,6 +18,7 @@ package handlers.admincommandhandlers; import java.util.StringTokenizer; +import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.enums.Team; import com.l2jmobius.gameserver.handler.IAdminCommandHandler; import com.l2jmobius.gameserver.model.L2Object; @@ -114,8 +115,16 @@ public class AdminEffects implements IAdminCommandHandler { activeChar.setInvisible(true); activeChar.broadcastUserInfo(); - activeChar.decayMe(); - activeChar.spawnMe(); + L2World.getInstance().forEachVisibleObject(activeChar, L2Character.class, target -> + { + if ((target != null) && (target.getTarget() == activeChar)) + { + target.setTarget(null); + target.abortAttack(); + target.abortCast(); + target.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); + } + }); BuilderUtil.sendSysMessage(activeChar, "Now, you cannot be seen."); } else @@ -132,8 +141,16 @@ public class AdminEffects implements IAdminCommandHandler { activeChar.setInvisible(true); activeChar.broadcastUserInfo(); - activeChar.decayMe(); - activeChar.spawnMe(); + L2World.getInstance().forEachVisibleObject(activeChar, L2Character.class, target -> + { + if ((target != null) && (target.getTarget() == activeChar)) + { + target.setTarget(null); + target.abortAttack(); + target.abortCast(); + target.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); + } + }); BuilderUtil.sendSysMessage(activeChar, "Now, you cannot be seen."); } else if (command.startsWith("admin_vis")) diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java index 4d49efa2f6..70a1570892 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java @@ -19,6 +19,7 @@ package handlers.admincommandhandlers; import java.util.Arrays; import java.util.StringTokenizer; +import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.enums.Movie; import com.l2jmobius.gameserver.enums.Team; import com.l2jmobius.gameserver.handler.IAdminCommandHandler; @@ -125,6 +126,16 @@ public class AdminEffects implements IAdminCommandHandler activeChar.setInvisible(true); activeChar.broadcastUserInfo(); activeChar.sendPacket(new ExUserInfoAbnormalVisualEffect(activeChar)); + L2World.getInstance().forEachVisibleObject(activeChar, L2Character.class, target -> + { + if ((target != null) && (target.getTarget() == activeChar)) + { + target.setTarget(null); + target.abortAttack(); + target.abortCast(); + target.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); + } + }); BuilderUtil.sendSysMessage(activeChar, "Now, you cannot be seen."); } else @@ -144,6 +155,16 @@ public class AdminEffects implements IAdminCommandHandler activeChar.setInvisible(true); activeChar.broadcastUserInfo(); activeChar.sendPacket(new ExUserInfoAbnormalVisualEffect(activeChar)); + L2World.getInstance().forEachVisibleObject(activeChar, L2Character.class, target -> + { + if ((target != null) && (target.getTarget() == activeChar)) + { + target.setTarget(null); + target.abortAttack(); + target.abortCast(); + target.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); + } + }); BuilderUtil.sendSysMessage(activeChar, "Now, you cannot be seen."); } else if (command.startsWith("admin_vis")) diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java index 4d49efa2f6..70a1570892 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java @@ -19,6 +19,7 @@ package handlers.admincommandhandlers; import java.util.Arrays; import java.util.StringTokenizer; +import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.enums.Movie; import com.l2jmobius.gameserver.enums.Team; import com.l2jmobius.gameserver.handler.IAdminCommandHandler; @@ -125,6 +126,16 @@ public class AdminEffects implements IAdminCommandHandler activeChar.setInvisible(true); activeChar.broadcastUserInfo(); activeChar.sendPacket(new ExUserInfoAbnormalVisualEffect(activeChar)); + L2World.getInstance().forEachVisibleObject(activeChar, L2Character.class, target -> + { + if ((target != null) && (target.getTarget() == activeChar)) + { + target.setTarget(null); + target.abortAttack(); + target.abortCast(); + target.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); + } + }); BuilderUtil.sendSysMessage(activeChar, "Now, you cannot be seen."); } else @@ -144,6 +155,16 @@ public class AdminEffects implements IAdminCommandHandler activeChar.setInvisible(true); activeChar.broadcastUserInfo(); activeChar.sendPacket(new ExUserInfoAbnormalVisualEffect(activeChar)); + L2World.getInstance().forEachVisibleObject(activeChar, L2Character.class, target -> + { + if ((target != null) && (target.getTarget() == activeChar)) + { + target.setTarget(null); + target.abortAttack(); + target.abortCast(); + target.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); + } + }); BuilderUtil.sendSysMessage(activeChar, "Now, you cannot be seen."); } else if (command.startsWith("admin_vis")) diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java index 4d49efa2f6..70a1570892 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminEffects.java @@ -19,6 +19,7 @@ package handlers.admincommandhandlers; import java.util.Arrays; import java.util.StringTokenizer; +import com.l2jmobius.gameserver.ai.CtrlIntention; import com.l2jmobius.gameserver.enums.Movie; import com.l2jmobius.gameserver.enums.Team; import com.l2jmobius.gameserver.handler.IAdminCommandHandler; @@ -125,6 +126,16 @@ public class AdminEffects implements IAdminCommandHandler activeChar.setInvisible(true); activeChar.broadcastUserInfo(); activeChar.sendPacket(new ExUserInfoAbnormalVisualEffect(activeChar)); + L2World.getInstance().forEachVisibleObject(activeChar, L2Character.class, target -> + { + if ((target != null) && (target.getTarget() == activeChar)) + { + target.setTarget(null); + target.abortAttack(); + target.abortCast(); + target.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); + } + }); BuilderUtil.sendSysMessage(activeChar, "Now, you cannot be seen."); } else @@ -144,6 +155,16 @@ public class AdminEffects implements IAdminCommandHandler activeChar.setInvisible(true); activeChar.broadcastUserInfo(); activeChar.sendPacket(new ExUserInfoAbnormalVisualEffect(activeChar)); + L2World.getInstance().forEachVisibleObject(activeChar, L2Character.class, target -> + { + if ((target != null) && (target.getTarget() == activeChar)) + { + target.setTarget(null); + target.abortAttack(); + target.abortCast(); + target.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); + } + }); BuilderUtil.sendSysMessage(activeChar, "Now, you cannot be seen."); } else if (command.startsWith("admin_vis"))