From 711581a2bc3912f2989ca9b2de994a6c1a38bb61 Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Mon, 2 Apr 2018 13:43:29 +0000 Subject: [PATCH] Fixed spawn protection. --- .../model/actor/instance/L2PcInstance.java | 15 +++++---------- .../clientpackets/MoveBackwardToLocation.java | 6 ++++++ .../model/actor/instance/L2PcInstance.java | 15 +++++---------- .../clientpackets/MoveBackwardToLocation.java | 6 ++++++ .../model/actor/instance/L2PcInstance.java | 15 +++++---------- .../clientpackets/MoveBackwardToLocation.java | 6 ++++++ .../model/actor/instance/L2PcInstance.java | 15 +++++---------- .../clientpackets/MoveBackwardToLocation.java | 6 ++++++ .../model/actor/instance/L2PcInstance.java | 15 +++++---------- .../clientpackets/MoveBackwardToLocation.java | 6 ++++++ .../model/actor/instance/L2PcInstance.java | 15 +++++---------- .../clientpackets/MoveBackwardToLocation.java | 6 ++++++ 12 files changed, 66 insertions(+), 60 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 42b389ab58..bbb05d8c61 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -678,7 +678,7 @@ public final class L2PcInstance extends L2Playable public boolean isSpawnProtected() { - return false; // TODO this is bugged. _protectEndTime > GameTimeController.getInstance().getGameTicks(); + return _protectEndTime > GameTimeController.getInstance().getGameTicks(); } private long _teleportProtectEndTime = 0; @@ -3873,10 +3873,6 @@ public final class L2PcInstance extends L2Playable return item; } - /** - * Set _protectEndTime according settings. - * @param protect - */ public void setProtection(boolean protect) { if (Config.DEVELOPER && (protect || (_protectEndTime > 0))) @@ -3898,7 +3894,7 @@ public final class L2PcInstance extends L2Playable } /** - * Set protection from agro mobs when getting up from fake death, according settings. + * Set protection from aggro mobs when getting up from fake death, according settings. * @param protect */ public void setRecentFakeDeath(boolean protect) @@ -6179,7 +6175,7 @@ public final class L2PcInstance extends L2Playable @Override public boolean isInvul() { - return super.isInvul() || (_teleportProtectEndTime > GameTimeController.getInstance().getGameTicks()); + return super.isInvul() || isTeleportProtected(); } /** @@ -10269,8 +10265,8 @@ public final class L2PcInstance extends L2Playable { if (isSpawnProtected()) { + setProtection(false); sendPacket(SystemMessageId.YOU_ARE_NO_LONGER_PROTECTED_FROM_AGGRESSIVE_MONSTERS); - if (Config.RESTORE_SERVITOR_ON_RECONNECT && !hasSummon() && CharSummonTable.getInstance().getServitors().containsKey(getObjectId())) { CharSummonTable.getInstance().restoreServitor(this); @@ -10282,10 +10278,9 @@ public final class L2PcInstance extends L2Playable } if (isTeleportProtected()) { + setTeleportProtection(false); sendMessage("Teleport spawn protection ended."); } - setProtection(false); - setTeleportProtection(false); } /** diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java index 7852d7b75e..5bb705bc3b 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java @@ -157,5 +157,11 @@ public class MoveBackwardToLocation implements IClientIncomingPacket break; } } + + // Mobius: Check spawn protections. + if (activeChar.isSpawnProtected() || activeChar.isTeleportProtected()) + { + activeChar.onActionRequest(); + } } } diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 2ea39a419b..b42de1d3f7 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -680,7 +680,7 @@ public final class L2PcInstance extends L2Playable public boolean isSpawnProtected() { - return false; // TODO this is bugged. _protectEndTime > GameTimeController.getInstance().getGameTicks(); + return _protectEndTime > GameTimeController.getInstance().getGameTicks(); } private long _teleportProtectEndTime = 0; @@ -3879,10 +3879,6 @@ public final class L2PcInstance extends L2Playable return item; } - /** - * Set _protectEndTime according settings. - * @param protect - */ public void setProtection(boolean protect) { if (Config.DEVELOPER && (protect || (_protectEndTime > 0))) @@ -3904,7 +3900,7 @@ public final class L2PcInstance extends L2Playable } /** - * Set protection from agro mobs when getting up from fake death, according settings. + * Set protection from aggro mobs when getting up from fake death, according settings. * @param protect */ public void setRecentFakeDeath(boolean protect) @@ -6185,7 +6181,7 @@ public final class L2PcInstance extends L2Playable @Override public boolean isInvul() { - return super.isInvul() || (_teleportProtectEndTime > GameTimeController.getInstance().getGameTicks()); + return super.isInvul() || isTeleportProtected(); } /** @@ -10276,8 +10272,8 @@ public final class L2PcInstance extends L2Playable { if (isSpawnProtected()) { + setProtection(false); sendPacket(SystemMessageId.YOU_ARE_NO_LONGER_PROTECTED_FROM_AGGRESSIVE_MONSTERS); - if (Config.RESTORE_SERVITOR_ON_RECONNECT && !hasSummon() && CharSummonTable.getInstance().getServitors().containsKey(getObjectId())) { CharSummonTable.getInstance().restoreServitor(this); @@ -10289,10 +10285,9 @@ public final class L2PcInstance extends L2Playable } if (isTeleportProtected()) { + setTeleportProtection(false); sendMessage("Teleport spawn protection ended."); } - setProtection(false); - setTeleportProtection(false); } /** diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java index 7852d7b75e..5bb705bc3b 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java @@ -157,5 +157,11 @@ public class MoveBackwardToLocation implements IClientIncomingPacket break; } } + + // Mobius: Check spawn protections. + if (activeChar.isSpawnProtected() || activeChar.isTeleportProtected()) + { + activeChar.onActionRequest(); + } } } diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 93464e1cb6..40e9d7e6cb 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -682,7 +682,7 @@ public final class L2PcInstance extends L2Playable public boolean isSpawnProtected() { - return false; // TODO this is bugged. _protectEndTime > GameTimeController.getInstance().getGameTicks(); + return _protectEndTime > GameTimeController.getInstance().getGameTicks(); } private long _teleportProtectEndTime = 0; @@ -3881,10 +3881,6 @@ public final class L2PcInstance extends L2Playable return item; } - /** - * Set _protectEndTime according settings. - * @param protect - */ public void setProtection(boolean protect) { if (Config.DEVELOPER && (protect || (_protectEndTime > 0))) @@ -3906,7 +3902,7 @@ public final class L2PcInstance extends L2Playable } /** - * Set protection from agro mobs when getting up from fake death, according settings. + * Set protection from aggro mobs when getting up from fake death, according settings. * @param protect */ public void setRecentFakeDeath(boolean protect) @@ -6187,7 +6183,7 @@ public final class L2PcInstance extends L2Playable @Override public boolean isInvul() { - return super.isInvul() || (_teleportProtectEndTime > GameTimeController.getInstance().getGameTicks()); + return super.isInvul() || isTeleportProtected(); } /** @@ -10286,8 +10282,8 @@ public final class L2PcInstance extends L2Playable { if (isSpawnProtected()) { + setProtection(false); sendPacket(SystemMessageId.YOU_ARE_NO_LONGER_PROTECTED_FROM_AGGRESSIVE_MONSTERS); - if (Config.RESTORE_SERVITOR_ON_RECONNECT && !hasSummon() && CharSummonTable.getInstance().getServitors().containsKey(getObjectId())) { CharSummonTable.getInstance().restoreServitor(this); @@ -10299,10 +10295,9 @@ public final class L2PcInstance extends L2Playable } if (isTeleportProtected()) { + setTeleportProtection(false); sendMessage("Teleport spawn protection ended."); } - setProtection(false); - setTeleportProtection(false); } /** diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java index 7852d7b75e..5bb705bc3b 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java @@ -157,5 +157,11 @@ public class MoveBackwardToLocation implements IClientIncomingPacket break; } } + + // Mobius: Check spawn protections. + if (activeChar.isSpawnProtected() || activeChar.isTeleportProtected()) + { + activeChar.onActionRequest(); + } } } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 77bb12a655..e363667a77 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -685,7 +685,7 @@ public final class L2PcInstance extends L2Playable public boolean isSpawnProtected() { - return false; // TODO this is bugged. _protectEndTime > GameTimeController.getInstance().getGameTicks(); + return _protectEndTime > GameTimeController.getInstance().getGameTicks(); } private long _teleportProtectEndTime = 0; @@ -3872,10 +3872,6 @@ public final class L2PcInstance extends L2Playable return item; } - /** - * Set _protectEndTime according settings. - * @param protect - */ public void setProtection(boolean protect) { if (Config.DEVELOPER && (protect || (_protectEndTime > 0))) @@ -3897,7 +3893,7 @@ public final class L2PcInstance extends L2Playable } /** - * Set protection from agro mobs when getting up from fake death, according settings. + * Set protection from aggro mobs when getting up from fake death, according settings. * @param protect */ public void setRecentFakeDeath(boolean protect) @@ -6184,7 +6180,7 @@ public final class L2PcInstance extends L2Playable @Override public boolean isInvul() { - return super.isInvul() || (_teleportProtectEndTime > GameTimeController.getInstance().getGameTicks()); + return super.isInvul() || isTeleportProtected(); } /** @@ -10279,8 +10275,8 @@ public final class L2PcInstance extends L2Playable { if (isSpawnProtected()) { + setProtection(false); sendPacket(SystemMessageId.YOU_ARE_NO_LONGER_PROTECTED_FROM_AGGRESSIVE_MONSTERS); - if (Config.RESTORE_SERVITOR_ON_RECONNECT && !hasSummon() && CharSummonTable.getInstance().getServitors().containsKey(getObjectId())) { CharSummonTable.getInstance().restoreServitor(this); @@ -10292,10 +10288,9 @@ public final class L2PcInstance extends L2Playable } if (isTeleportProtected()) { + setTeleportProtection(false); sendMessage("Teleport spawn protection ended."); } - setProtection(false); - setTeleportProtection(false); } /** diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java index 7852d7b75e..5bb705bc3b 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java @@ -157,5 +157,11 @@ public class MoveBackwardToLocation implements IClientIncomingPacket break; } } + + // Mobius: Check spawn protections. + if (activeChar.isSpawnProtected() || activeChar.isTeleportProtected()) + { + activeChar.onActionRequest(); + } } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 03ef855b98..279cac72dd 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -677,7 +677,7 @@ public final class L2PcInstance extends L2Playable public boolean isSpawnProtected() { - return false; // TODO this is bugged. _protectEndTime > GameTimeController.getInstance().getGameTicks(); + return _protectEndTime > GameTimeController.getInstance().getGameTicks(); } private long _teleportProtectEndTime = 0; @@ -3849,10 +3849,6 @@ public final class L2PcInstance extends L2Playable return item; } - /** - * Set _protectEndTime according settings. - * @param protect - */ public void setProtection(boolean protect) { if (Config.DEVELOPER && (protect || (_protectEndTime > 0))) @@ -3874,7 +3870,7 @@ public final class L2PcInstance extends L2Playable } /** - * Set protection from agro mobs when getting up from fake death, according settings. + * Set protection from aggro mobs when getting up from fake death, according settings. * @param protect */ public void setRecentFakeDeath(boolean protect) @@ -6155,7 +6151,7 @@ public final class L2PcInstance extends L2Playable @Override public boolean isInvul() { - return super.isInvul() || (_teleportProtectEndTime > GameTimeController.getInstance().getGameTicks()); + return super.isInvul() || isTeleportProtected(); } /** @@ -10214,8 +10210,8 @@ public final class L2PcInstance extends L2Playable { if (isSpawnProtected()) { + setProtection(false); sendPacket(SystemMessageId.YOU_ARE_NO_LONGER_PROTECTED_FROM_AGGRESSIVE_MONSTERS); - if (Config.RESTORE_SERVITOR_ON_RECONNECT && !hasSummon() && CharSummonTable.getInstance().getServitors().containsKey(getObjectId())) { CharSummonTable.getInstance().restoreServitor(this); @@ -10227,10 +10223,9 @@ public final class L2PcInstance extends L2Playable } if (isTeleportProtected()) { + setTeleportProtection(false); sendMessage("Teleport spawn protection ended."); } - setProtection(false); - setTeleportProtection(false); } /** diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java index 7852d7b75e..5bb705bc3b 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java @@ -157,5 +157,11 @@ public class MoveBackwardToLocation implements IClientIncomingPacket break; } } + + // Mobius: Check spawn protections. + if (activeChar.isSpawnProtected() || activeChar.isTeleportProtected()) + { + activeChar.onActionRequest(); + } } } diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 019cbeb7d0..8480eb6074 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -677,7 +677,7 @@ public final class L2PcInstance extends L2Playable public boolean isSpawnProtected() { - return false; // TODO this is bugged. _protectEndTime > GameTimeController.getInstance().getGameTicks(); + return _protectEndTime > GameTimeController.getInstance().getGameTicks(); } private long _teleportProtectEndTime = 0; @@ -3849,10 +3849,6 @@ public final class L2PcInstance extends L2Playable return item; } - /** - * Set _protectEndTime according settings. - * @param protect - */ public void setProtection(boolean protect) { if (Config.DEVELOPER && (protect || (_protectEndTime > 0))) @@ -3874,7 +3870,7 @@ public final class L2PcInstance extends L2Playable } /** - * Set protection from agro mobs when getting up from fake death, according settings. + * Set protection from aggro mobs when getting up from fake death, according settings. * @param protect */ public void setRecentFakeDeath(boolean protect) @@ -6155,7 +6151,7 @@ public final class L2PcInstance extends L2Playable @Override public boolean isInvul() { - return super.isInvul() || (_teleportProtectEndTime > GameTimeController.getInstance().getGameTicks()); + return super.isInvul() || isTeleportProtected(); } /** @@ -10214,8 +10210,8 @@ public final class L2PcInstance extends L2Playable { if (isSpawnProtected()) { + setProtection(false); sendPacket(SystemMessageId.YOU_ARE_NO_LONGER_PROTECTED_FROM_AGGRESSIVE_MONSTERS); - if (Config.RESTORE_SERVITOR_ON_RECONNECT && !hasSummon() && CharSummonTable.getInstance().getServitors().containsKey(getObjectId())) { CharSummonTable.getInstance().restoreServitor(this); @@ -10227,10 +10223,9 @@ public final class L2PcInstance extends L2Playable } if (isTeleportProtected()) { + setTeleportProtection(false); sendMessage("Teleport spawn protection ended."); } - setProtection(false); - setTeleportProtection(false); } /** diff --git a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java index 7852d7b75e..5bb705bc3b 100644 --- a/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java +++ b/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/MoveBackwardToLocation.java @@ -157,5 +157,11 @@ public class MoveBackwardToLocation implements IClientIncomingPacket break; } } + + // Mobius: Check spawn protections. + if (activeChar.isSpawnProtected() || activeChar.isTeleportProtected()) + { + activeChar.onActionRequest(); + } } }