From a47d1bf797a1ec084ae02eec75a37a013a6ce41e Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Tue, 12 Oct 2021 21:25:08 +0000 Subject: [PATCH] On Essence auto attack is enabled via the Auto Attack action. --- .../dist/game/config/General.ini | 4 ++++ .../java/org/l2jmobius/Config.java | 2 ++ .../autoplay/ExRequestActivateAutoShortcut.java | 14 +------------- .../taskmanager/AutoPlayTaskManager.java | 8 ++++++++ .../dist/game/config/General.ini | 4 ++++ .../java/org/l2jmobius/Config.java | 2 ++ .../autoplay/ExRequestActivateAutoShortcut.java | 14 +------------- .../taskmanager/AutoPlayTaskManager.java | 8 ++++++++ 8 files changed, 30 insertions(+), 26 deletions(-) diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/config/General.ini b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/config/General.ini index af3872ec34..e56aaf622f 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/config/General.ini +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/config/General.ini @@ -666,6 +666,10 @@ EnableAutoSkill = True # Default: True EnableAutoItem = True +# Enable auto attack via the Auto Attack action. +# Retail: True +AutoPlayAttackAction = True + # Resume auto play upon enter game. # Retail: False ResumeAutoPlay = False diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/Config.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/Config.java index b777468e6b..90110ad89c 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/Config.java @@ -610,6 +610,7 @@ public class Config public static boolean ENABLE_AUTO_POTION; public static boolean ENABLE_AUTO_SKILL; public static boolean ENABLE_AUTO_ITEM; + public static boolean AUTO_PLAY_ATTACK_ACTION; public static boolean RESUME_AUTO_PLAY; public static int SHARING_LOCATION_COST; public static int TELEPORT_SHARE_LOCATION_COST; @@ -2109,6 +2110,7 @@ public class Config ENABLE_AUTO_POTION = General.getBoolean("EnableAutoPotion", true); ENABLE_AUTO_SKILL = General.getBoolean("EnableAutoSkill", true); ENABLE_AUTO_ITEM = General.getBoolean("EnableAutoItem", true); + AUTO_PLAY_ATTACK_ACTION = General.getBoolean("AutoPlayAttackAction", true); RESUME_AUTO_PLAY = General.getBoolean("ResumeAutoPlay", false); SHARING_LOCATION_COST = General.getInt("ShareLocationLcoinCost", 1); TELEPORT_SHARE_LOCATION_COST = General.getInt("ShareLocationLcoinCost", 1); diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/autoplay/ExRequestActivateAutoShortcut.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/autoplay/ExRequestActivateAutoShortcut.java index 18ff1f6959..7d40db0d62 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/autoplay/ExRequestActivateAutoShortcut.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/autoplay/ExRequestActivateAutoShortcut.java @@ -18,10 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets.autoplay; import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketReader; -import org.l2jmobius.gameserver.data.xml.ActionData; -import org.l2jmobius.gameserver.handler.IPlayerActionHandler; -import org.l2jmobius.gameserver.handler.PlayerActionHandler; -import org.l2jmobius.gameserver.model.ActionDataHolder; import org.l2jmobius.gameserver.model.ShortCuts; import org.l2jmobius.gameserver.model.Shortcut; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -149,15 +145,7 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket return; } // action - final ActionDataHolder actionHolder = ActionData.getInstance().getActionData(shortcut.getId()); - if (actionHolder != null) - { - final IPlayerActionHandler actionHandler = PlayerActionHandler.getInstance().getHandler(actionHolder.getHandler()); - if (actionHandler != null) - { - AutoUseTaskManager.getInstance().addAutoAction(player, shortcut.getId()); - } - } + AutoUseTaskManager.getInstance().addAutoAction(player, shortcut.getId()); } } } diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/taskmanager/AutoPlayTaskManager.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/taskmanager/AutoPlayTaskManager.java index 34b66845af..2c66a1c4c9 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/taskmanager/AutoPlayTaskManager.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/taskmanager/AutoPlayTaskManager.java @@ -37,6 +37,7 @@ import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExAutoPlayDoMacro public class AutoPlayTaskManager implements Runnable { private static final Set PLAYERS = ConcurrentHashMap.newKeySet(); + private static final Integer AUTO_ATTACK_ACTION = 2; private static boolean _working = false; protected AutoPlayTaskManager() @@ -192,6 +193,13 @@ public class AutoPlayTaskManager implements Runnable private boolean isMageCaster(PlayerInstance player) { + // On Essence auto attack is enabled via the Auto Attack action. + if (Config.AUTO_PLAY_ATTACK_ACTION) + { + return !player.getAutoUseSettings().getAutoActions().contains(AUTO_ATTACK_ACTION); + } + + // Non Essence like. return player.isMageClass() && (player.getRace() != Race.ORC); } diff --git a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/config/General.ini b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/config/General.ini index b60a49a76f..5da39901ac 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/config/General.ini +++ b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/config/General.ini @@ -666,6 +666,10 @@ EnableAutoSkill = True # Default: True EnableAutoItem = True +# Enable auto attack via the Auto Attack action. +# Retail: True +AutoPlayAttackAction = True + # Resume auto play upon enter game. # Retail: False ResumeAutoPlay = False diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/Config.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/Config.java index b12e929db7..1b3d1e1bb0 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/Config.java @@ -610,6 +610,7 @@ public class Config public static boolean ENABLE_AUTO_POTION; public static boolean ENABLE_AUTO_SKILL; public static boolean ENABLE_AUTO_ITEM; + public static boolean AUTO_PLAY_ATTACK_ACTION; public static boolean RESUME_AUTO_PLAY; public static int SHARING_LOCATION_COST; public static int TELEPORT_SHARE_LOCATION_COST; @@ -2112,6 +2113,7 @@ public class Config ENABLE_AUTO_POTION = General.getBoolean("EnableAutoPotion", true); ENABLE_AUTO_SKILL = General.getBoolean("EnableAutoSkill", true); ENABLE_AUTO_ITEM = General.getBoolean("EnableAutoItem", true); + AUTO_PLAY_ATTACK_ACTION = General.getBoolean("AutoPlayAttackAction", true); RESUME_AUTO_PLAY = General.getBoolean("ResumeAutoPlay", false); SUBJUGATION_TOPIC_BODY = General.getString("SubjugationTopicBody", "Reward for being in the top of the best players in clearing the lands of Aden"); SUBJUGATION_TOPIC_HEADER = General.getString("SubjugationTopicHeader", "Purge reward"); diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/autoplay/ExRequestActivateAutoShortcut.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/autoplay/ExRequestActivateAutoShortcut.java index 18ff1f6959..7d40db0d62 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/autoplay/ExRequestActivateAutoShortcut.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/autoplay/ExRequestActivateAutoShortcut.java @@ -18,10 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets.autoplay; import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketReader; -import org.l2jmobius.gameserver.data.xml.ActionData; -import org.l2jmobius.gameserver.handler.IPlayerActionHandler; -import org.l2jmobius.gameserver.handler.PlayerActionHandler; -import org.l2jmobius.gameserver.model.ActionDataHolder; import org.l2jmobius.gameserver.model.ShortCuts; import org.l2jmobius.gameserver.model.Shortcut; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; @@ -149,15 +145,7 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket return; } // action - final ActionDataHolder actionHolder = ActionData.getInstance().getActionData(shortcut.getId()); - if (actionHolder != null) - { - final IPlayerActionHandler actionHandler = PlayerActionHandler.getInstance().getHandler(actionHolder.getHandler()); - if (actionHandler != null) - { - AutoUseTaskManager.getInstance().addAutoAction(player, shortcut.getId()); - } - } + AutoUseTaskManager.getInstance().addAutoAction(player, shortcut.getId()); } } } diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/taskmanager/AutoPlayTaskManager.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/taskmanager/AutoPlayTaskManager.java index 34b66845af..2c66a1c4c9 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/taskmanager/AutoPlayTaskManager.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/taskmanager/AutoPlayTaskManager.java @@ -37,6 +37,7 @@ import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExAutoPlayDoMacro public class AutoPlayTaskManager implements Runnable { private static final Set PLAYERS = ConcurrentHashMap.newKeySet(); + private static final Integer AUTO_ATTACK_ACTION = 2; private static boolean _working = false; protected AutoPlayTaskManager() @@ -192,6 +193,13 @@ public class AutoPlayTaskManager implements Runnable private boolean isMageCaster(PlayerInstance player) { + // On Essence auto attack is enabled via the Auto Attack action. + if (Config.AUTO_PLAY_ATTACK_ACTION) + { + return !player.getAutoUseSettings().getAutoActions().contains(AUTO_ATTACK_ACTION); + } + + // Non Essence like. return player.isMageClass() && (player.getRace() != Race.ORC); }