On Essence auto attack is enabled via the Auto Attack action.

This commit is contained in:
MobiusDevelopment 2021-10-12 21:25:08 +00:00
parent 19fa9a724e
commit a47d1bf797
8 changed files with 30 additions and 26 deletions

View File

@ -666,6 +666,10 @@ EnableAutoSkill = True
# Default: True # Default: True
EnableAutoItem = True EnableAutoItem = True
# Enable auto attack via the Auto Attack action.
# Retail: True
AutoPlayAttackAction = True
# Resume auto play upon enter game. # Resume auto play upon enter game.
# Retail: False # Retail: False
ResumeAutoPlay = False ResumeAutoPlay = False

View File

@ -610,6 +610,7 @@ public class Config
public static boolean ENABLE_AUTO_POTION; public static boolean ENABLE_AUTO_POTION;
public static boolean ENABLE_AUTO_SKILL; public static boolean ENABLE_AUTO_SKILL;
public static boolean ENABLE_AUTO_ITEM; public static boolean ENABLE_AUTO_ITEM;
public static boolean AUTO_PLAY_ATTACK_ACTION;
public static boolean RESUME_AUTO_PLAY; public static boolean RESUME_AUTO_PLAY;
public static int SHARING_LOCATION_COST; public static int SHARING_LOCATION_COST;
public static int TELEPORT_SHARE_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_POTION = General.getBoolean("EnableAutoPotion", true);
ENABLE_AUTO_SKILL = General.getBoolean("EnableAutoSkill", true); ENABLE_AUTO_SKILL = General.getBoolean("EnableAutoSkill", true);
ENABLE_AUTO_ITEM = General.getBoolean("EnableAutoItem", true); ENABLE_AUTO_ITEM = General.getBoolean("EnableAutoItem", true);
AUTO_PLAY_ATTACK_ACTION = General.getBoolean("AutoPlayAttackAction", true);
RESUME_AUTO_PLAY = General.getBoolean("ResumeAutoPlay", false); RESUME_AUTO_PLAY = General.getBoolean("ResumeAutoPlay", false);
SHARING_LOCATION_COST = General.getInt("ShareLocationLcoinCost", 1); SHARING_LOCATION_COST = General.getInt("ShareLocationLcoinCost", 1);
TELEPORT_SHARE_LOCATION_COST = General.getInt("ShareLocationLcoinCost", 1); TELEPORT_SHARE_LOCATION_COST = General.getInt("ShareLocationLcoinCost", 1);

View File

@ -18,10 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets.autoplay;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketReader; 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.ShortCuts;
import org.l2jmobius.gameserver.model.Shortcut; import org.l2jmobius.gameserver.model.Shortcut;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
@ -149,15 +145,7 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket
return; return;
} }
// action // action
final ActionDataHolder actionHolder = ActionData.getInstance().getActionData(shortcut.getId()); AutoUseTaskManager.getInstance().addAutoAction(player, shortcut.getId());
if (actionHolder != null)
{
final IPlayerActionHandler actionHandler = PlayerActionHandler.getInstance().getHandler(actionHolder.getHandler());
if (actionHandler != null)
{
AutoUseTaskManager.getInstance().addAutoAction(player, shortcut.getId());
}
}
} }
} }
} }

View File

@ -37,6 +37,7 @@ import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExAutoPlayDoMacro
public class AutoPlayTaskManager implements Runnable public class AutoPlayTaskManager implements Runnable
{ {
private static final Set<PlayerInstance> PLAYERS = ConcurrentHashMap.newKeySet(); private static final Set<PlayerInstance> PLAYERS = ConcurrentHashMap.newKeySet();
private static final Integer AUTO_ATTACK_ACTION = 2;
private static boolean _working = false; private static boolean _working = false;
protected AutoPlayTaskManager() protected AutoPlayTaskManager()
@ -192,6 +193,13 @@ public class AutoPlayTaskManager implements Runnable
private boolean isMageCaster(PlayerInstance player) 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); return player.isMageClass() && (player.getRace() != Race.ORC);
} }

View File

@ -666,6 +666,10 @@ EnableAutoSkill = True
# Default: True # Default: True
EnableAutoItem = True EnableAutoItem = True
# Enable auto attack via the Auto Attack action.
# Retail: True
AutoPlayAttackAction = True
# Resume auto play upon enter game. # Resume auto play upon enter game.
# Retail: False # Retail: False
ResumeAutoPlay = False ResumeAutoPlay = False

View File

@ -610,6 +610,7 @@ public class Config
public static boolean ENABLE_AUTO_POTION; public static boolean ENABLE_AUTO_POTION;
public static boolean ENABLE_AUTO_SKILL; public static boolean ENABLE_AUTO_SKILL;
public static boolean ENABLE_AUTO_ITEM; public static boolean ENABLE_AUTO_ITEM;
public static boolean AUTO_PLAY_ATTACK_ACTION;
public static boolean RESUME_AUTO_PLAY; public static boolean RESUME_AUTO_PLAY;
public static int SHARING_LOCATION_COST; public static int SHARING_LOCATION_COST;
public static int TELEPORT_SHARE_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_POTION = General.getBoolean("EnableAutoPotion", true);
ENABLE_AUTO_SKILL = General.getBoolean("EnableAutoSkill", true); ENABLE_AUTO_SKILL = General.getBoolean("EnableAutoSkill", true);
ENABLE_AUTO_ITEM = General.getBoolean("EnableAutoItem", true); ENABLE_AUTO_ITEM = General.getBoolean("EnableAutoItem", true);
AUTO_PLAY_ATTACK_ACTION = General.getBoolean("AutoPlayAttackAction", true);
RESUME_AUTO_PLAY = General.getBoolean("ResumeAutoPlay", false); 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_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"); SUBJUGATION_TOPIC_HEADER = General.getString("SubjugationTopicHeader", "Purge reward");

View File

@ -18,10 +18,6 @@ package org.l2jmobius.gameserver.network.clientpackets.autoplay;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketReader; 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.ShortCuts;
import org.l2jmobius.gameserver.model.Shortcut; import org.l2jmobius.gameserver.model.Shortcut;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
@ -149,15 +145,7 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket
return; return;
} }
// action // action
final ActionDataHolder actionHolder = ActionData.getInstance().getActionData(shortcut.getId()); AutoUseTaskManager.getInstance().addAutoAction(player, shortcut.getId());
if (actionHolder != null)
{
final IPlayerActionHandler actionHandler = PlayerActionHandler.getInstance().getHandler(actionHolder.getHandler());
if (actionHandler != null)
{
AutoUseTaskManager.getInstance().addAutoAction(player, shortcut.getId());
}
}
} }
} }
} }

View File

@ -37,6 +37,7 @@ import org.l2jmobius.gameserver.network.serverpackets.autoplay.ExAutoPlayDoMacro
public class AutoPlayTaskManager implements Runnable public class AutoPlayTaskManager implements Runnable
{ {
private static final Set<PlayerInstance> PLAYERS = ConcurrentHashMap.newKeySet(); private static final Set<PlayerInstance> PLAYERS = ConcurrentHashMap.newKeySet();
private static final Integer AUTO_ATTACK_ACTION = 2;
private static boolean _working = false; private static boolean _working = false;
protected AutoPlayTaskManager() protected AutoPlayTaskManager()
@ -192,6 +193,13 @@ public class AutoPlayTaskManager implements Runnable
private boolean isMageCaster(PlayerInstance player) 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); return player.isMageClass() && (player.getRace() != Race.ORC);
} }