Addition of auto play configurations.

This commit is contained in:
MobiusDevelopment 2020-03-21 08:22:14 +00:00
parent ec51b21f9d
commit ab7b3863c2
10 changed files with 150 additions and 54 deletions

View File

@ -576,6 +576,7 @@ CustomMultisellLoad = True
# Default: False # Default: False
CustomBuyListLoad = True CustomBuyListLoad = True
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Birthday Event Settings # Birthday Event Settings
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@ -592,6 +593,7 @@ AltBirthdayMailSubject = Happy Birthday!
# $s1: Age # $s1: Age
AltBirthdayMailText = Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day.\n\nSincerely, Alegria AltBirthdayMailText = Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day.\n\nSincerely, Alegria
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Handy's Block Checker Event Settings # Handy's Block Checker Event Settings
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@ -613,6 +615,7 @@ BlockCheckerMinTeamMembers = 2
# balanced in the teleport to the arena # balanced in the teleport to the arena
HBCEFairPlay = True HBCEFairPlay = True
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Bot Report Button settings # Bot Report Button settings
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@ -633,6 +636,24 @@ BotReportDelay = 30
# Default: False # Default: False
AllowReportsFromSameClanMembers = False AllowReportsFromSameClanMembers = False
# ---------------------------------------------------------------------------
# Auto Play Settings
# ---------------------------------------------------------------------------
# Default: True
EnableAutoPlay = True
# Default: True
EnableAutoPotion = True
# Default: True
EnableAutoBuff = True
# Default: True
EnableAutoItem = True
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Developer Settings # Developer Settings
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------

View File

@ -573,6 +573,10 @@ public class Config
public static String[] BOTREPORT_RESETPOINT_HOUR; public static String[] BOTREPORT_RESETPOINT_HOUR;
public static long BOTREPORT_REPORT_DELAY; public static long BOTREPORT_REPORT_DELAY;
public static boolean BOTREPORT_ALLOW_REPORTS_FROM_SAME_CLAN_MEMBERS; public static boolean BOTREPORT_ALLOW_REPORTS_FROM_SAME_CLAN_MEMBERS;
public static boolean ENABLE_AUTO_PLAY;
public static boolean ENABLE_AUTO_POTION;
public static boolean ENABLE_AUTO_BUFF;
public static boolean ENABLE_AUTO_ITEM;
// -------------------------------------------------- // --------------------------------------------------
// FloodProtector Settings // FloodProtector Settings
@ -2033,6 +2037,7 @@ public class Config
GRIDS_ALWAYS_ON = General.getBoolean("GridsAlwaysOn", false); GRIDS_ALWAYS_ON = General.getBoolean("GridsAlwaysOn", false);
GRID_NEIGHBOR_TURNON_TIME = General.getInt("GridNeighborTurnOnTime", 1); GRID_NEIGHBOR_TURNON_TIME = General.getInt("GridNeighborTurnOnTime", 1);
GRID_NEIGHBOR_TURNOFF_TIME = General.getInt("GridNeighborTurnOffTime", 90); GRID_NEIGHBOR_TURNOFF_TIME = General.getInt("GridNeighborTurnOffTime", 90);
ENABLE_FALLING_DAMAGE = General.getBoolean("EnableFallingDamage", true);
PEACE_ZONE_MODE = General.getInt("PeaceZoneMode", 0); PEACE_ZONE_MODE = General.getInt("PeaceZoneMode", 0);
DEFAULT_GLOBAL_CHAT = General.getString("GlobalChat", "ON"); DEFAULT_GLOBAL_CHAT = General.getString("GlobalChat", "ON");
DEFAULT_TRADE_CHAT = General.getString("TradeChat", "ON"); DEFAULT_TRADE_CHAT = General.getString("TradeChat", "ON");
@ -2118,7 +2123,10 @@ public class Config
BOTREPORT_RESETPOINT_HOUR = General.getString("BotReportPointsResetHour", "00:00").split(":"); BOTREPORT_RESETPOINT_HOUR = General.getString("BotReportPointsResetHour", "00:00").split(":");
BOTREPORT_REPORT_DELAY = General.getInt("BotReportDelay", 30) * 60000; BOTREPORT_REPORT_DELAY = General.getInt("BotReportDelay", 30) * 60000;
BOTREPORT_ALLOW_REPORTS_FROM_SAME_CLAN_MEMBERS = General.getBoolean("AllowReportsFromSameClanMembers", false); BOTREPORT_ALLOW_REPORTS_FROM_SAME_CLAN_MEMBERS = General.getBoolean("AllowReportsFromSameClanMembers", false);
ENABLE_FALLING_DAMAGE = General.getBoolean("EnableFallingDamage", true); ENABLE_AUTO_PLAY = General.getBoolean("EnableAutoPlay", true);
ENABLE_AUTO_POTION = General.getBoolean("EnableAutoPotion", true);
ENABLE_AUTO_BUFF = General.getBoolean("EnableAutoBuff", true);
ENABLE_AUTO_ITEM = General.getBoolean("EnableAutoItem", true);
// Load FloodProtector config file // Load FloodProtector config file
final PropertiesParser FloodProtectors = new PropertiesParser(FLOOD_PROTECTOR_CONFIG_FILE); final PropertiesParser FloodProtectors = new PropertiesParser(FLOOD_PROTECTOR_CONFIG_FILE);

View File

@ -13915,6 +13915,12 @@ public class PlayerInstance extends Playable
_autoPlayTask = ThreadPool.scheduleAtFixedRate(() -> _autoPlayTask = ThreadPool.scheduleAtFixedRate(() ->
{ {
if (!Config.ENABLE_AUTO_PLAY)
{
stopAutoPlayTask();
return;
}
// Skip thinking. // Skip thinking.
if ((getTarget() != null) && getTarget().isMonster() && (((MonsterInstance) getTarget()).getTarget() == this) && !((MonsterInstance) getTarget()).isAlikeDead()) if ((getTarget() != null) && getTarget().isMonster() && (((MonsterInstance) getTarget()).getTarget() == this) && !((MonsterInstance) getTarget()).isAlikeDead())
{ {
@ -14011,6 +14017,8 @@ public class PlayerInstance extends Playable
return; return;
} }
if (Config.ENABLE_AUTO_ITEM)
{
for (int itemId : _autoSupplyItems) for (int itemId : _autoSupplyItems)
{ {
final ItemInstance item = _inventory.getItemByItemId(itemId); final ItemInstance item = _inventory.getItemByItemId(itemId);
@ -14030,8 +14038,9 @@ public class PlayerInstance extends Playable
} }
} }
} }
}
if (getCurrentHpPercent() <= _autoPotionPercent) if (Config.ENABLE_AUTO_POTION && (getCurrentHpPercent() <= _autoPotionPercent))
{ {
for (int itemId : _autoPotionItems) for (int itemId : _autoPotionItems)
{ {
@ -14054,6 +14063,8 @@ public class PlayerInstance extends Playable
} }
} }
if (Config.ENABLE_AUTO_BUFF)
{
for (int skillId : _autoSkills) for (int skillId : _autoSkills)
{ {
final Skill skill = getKnownSkill(skillId); final Skill skill = getKnownSkill(skillId);
@ -14067,6 +14078,7 @@ public class PlayerInstance extends Playable
doCast(skill); doCast(skill);
} }
} }
}
}, 0, 1000); }, 0, 1000);
} }

View File

@ -16,6 +16,7 @@
*/ */
package org.l2jmobius.gameserver.network.clientpackets.autoplay; package org.l2jmobius.gameserver.network.clientpackets.autoplay;
import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.GameClient; import org.l2jmobius.gameserver.network.GameClient;
@ -60,6 +61,11 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _longRange, _potionPercent, _respectfulHunting)); player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _longRange, _potionPercent, _respectfulHunting));
player.setAutoPotionPercent(_potionPercent); player.setAutoPotionPercent(_potionPercent);
if (!Config.ENABLE_AUTO_PLAY)
{
return;
}
if (_active) if (_active)
{ {
player.startAutoPlayTask(_pickUp, _longRange, _respectfulHunting); player.startAutoPlayTask(_pickUp, _longRange, _respectfulHunting);

View File

@ -16,6 +16,7 @@
*/ */
package org.l2jmobius.gameserver.network.clientpackets.autoplay; package org.l2jmobius.gameserver.network.clientpackets.autoplay;
import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.commons.network.PacketReader;
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;
@ -93,7 +94,7 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket
if (_room > 263) if (_room > 263)
{ {
// auto supply // auto supply
if (item != null) if (Config.ENABLE_AUTO_ITEM && (item != null))
{ {
player.addAutoSupplyItem(item.getId()); player.addAutoSupplyItem(item.getId());
} }
@ -103,14 +104,14 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket
// auto potion // auto potion
if ((page == 23) && (slot == 1)) if ((page == 23) && (slot == 1))
{ {
if ((item != null) && item.isPotion()) if (Config.ENABLE_AUTO_POTION && (item != null) && item.isPotion())
{ {
player.addAutoPotionItem(item.getId()); player.addAutoPotionItem(item.getId());
return; return;
} }
} }
// auto skill // auto skill
if (skill != null) if (Config.ENABLE_AUTO_BUFF && (skill != null))
{ {
player.addAutoSkill(skill.getId()); player.addAutoSkill(skill.getId());
} }

View File

@ -576,6 +576,7 @@ CustomMultisellLoad = True
# Default: False # Default: False
CustomBuyListLoad = True CustomBuyListLoad = True
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Birthday Event Settings # Birthday Event Settings
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@ -592,6 +593,7 @@ AltBirthdayMailSubject = Happy Birthday!
# $s1: Age # $s1: Age
AltBirthdayMailText = Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day.\n\nSincerely, Alegria AltBirthdayMailText = Hello Adventurer!! Seeing as you're one year older now, I thought I would send you some birthday cheer :) Please find your birthday pack attached. May these gifts bring you joy and happiness on this very special day.\n\nSincerely, Alegria
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Handy's Block Checker Event Settings # Handy's Block Checker Event Settings
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@ -613,6 +615,7 @@ BlockCheckerMinTeamMembers = 2
# balanced in the teleport to the arena # balanced in the teleport to the arena
HBCEFairPlay = True HBCEFairPlay = True
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Bot Report Button settings # Bot Report Button settings
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@ -633,6 +636,24 @@ BotReportDelay = 30
# Default: False # Default: False
AllowReportsFromSameClanMembers = False AllowReportsFromSameClanMembers = False
# ---------------------------------------------------------------------------
# Auto Play Settings
# ---------------------------------------------------------------------------
# Default: True
EnableAutoPlay = True
# Default: True
EnableAutoPotion = True
# Default: True
EnableAutoBuff = True
# Default: True
EnableAutoItem = True
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Developer Settings # Developer Settings
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------

View File

@ -583,6 +583,10 @@ public class Config
public static String[] BOTREPORT_RESETPOINT_HOUR; public static String[] BOTREPORT_RESETPOINT_HOUR;
public static long BOTREPORT_REPORT_DELAY; public static long BOTREPORT_REPORT_DELAY;
public static boolean BOTREPORT_ALLOW_REPORTS_FROM_SAME_CLAN_MEMBERS; public static boolean BOTREPORT_ALLOW_REPORTS_FROM_SAME_CLAN_MEMBERS;
public static boolean ENABLE_AUTO_PLAY;
public static boolean ENABLE_AUTO_POTION;
public static boolean ENABLE_AUTO_BUFF;
public static boolean ENABLE_AUTO_ITEM;
// -------------------------------------------------- // --------------------------------------------------
// FloodProtector Settings // FloodProtector Settings
@ -1917,6 +1921,7 @@ public class Config
GRIDS_ALWAYS_ON = General.getBoolean("GridsAlwaysOn", false); GRIDS_ALWAYS_ON = General.getBoolean("GridsAlwaysOn", false);
GRID_NEIGHBOR_TURNON_TIME = General.getInt("GridNeighborTurnOnTime", 1); GRID_NEIGHBOR_TURNON_TIME = General.getInt("GridNeighborTurnOnTime", 1);
GRID_NEIGHBOR_TURNOFF_TIME = General.getInt("GridNeighborTurnOffTime", 90); GRID_NEIGHBOR_TURNOFF_TIME = General.getInt("GridNeighborTurnOffTime", 90);
ENABLE_FALLING_DAMAGE = General.getBoolean("EnableFallingDamage", true);
PEACE_ZONE_MODE = General.getInt("PeaceZoneMode", 0); PEACE_ZONE_MODE = General.getInt("PeaceZoneMode", 0);
DEFAULT_GLOBAL_CHAT = General.getString("GlobalChat", "ON"); DEFAULT_GLOBAL_CHAT = General.getString("GlobalChat", "ON");
DEFAULT_TRADE_CHAT = General.getString("TradeChat", "ON"); DEFAULT_TRADE_CHAT = General.getString("TradeChat", "ON");
@ -2002,7 +2007,10 @@ public class Config
BOTREPORT_RESETPOINT_HOUR = General.getString("BotReportPointsResetHour", "00:00").split(":"); BOTREPORT_RESETPOINT_HOUR = General.getString("BotReportPointsResetHour", "00:00").split(":");
BOTREPORT_REPORT_DELAY = General.getInt("BotReportDelay", 30) * 60000; BOTREPORT_REPORT_DELAY = General.getInt("BotReportDelay", 30) * 60000;
BOTREPORT_ALLOW_REPORTS_FROM_SAME_CLAN_MEMBERS = General.getBoolean("AllowReportsFromSameClanMembers", false); BOTREPORT_ALLOW_REPORTS_FROM_SAME_CLAN_MEMBERS = General.getBoolean("AllowReportsFromSameClanMembers", false);
ENABLE_FALLING_DAMAGE = General.getBoolean("EnableFallingDamage", true); ENABLE_AUTO_PLAY = General.getBoolean("EnableAutoPlay", true);
ENABLE_AUTO_POTION = General.getBoolean("EnableAutoPotion", true);
ENABLE_AUTO_BUFF = General.getBoolean("EnableAutoBuff", true);
ENABLE_AUTO_ITEM = General.getBoolean("EnableAutoItem", true);
// Load FloodProtector config file // Load FloodProtector config file
final PropertiesParser FloodProtectors = new PropertiesParser(FLOOD_PROTECTOR_CONFIG_FILE); final PropertiesParser FloodProtectors = new PropertiesParser(FLOOD_PROTECTOR_CONFIG_FILE);

View File

@ -13893,6 +13893,12 @@ public class PlayerInstance extends Playable
_autoPlayTask = ThreadPool.scheduleAtFixedRate(() -> _autoPlayTask = ThreadPool.scheduleAtFixedRate(() ->
{ {
if (!Config.ENABLE_AUTO_PLAY)
{
stopAutoPlayTask();
return;
}
// Skip thinking. // Skip thinking.
if ((getTarget() != null) && getTarget().isMonster() && (((MonsterInstance) getTarget()).getTarget() == this) && !((MonsterInstance) getTarget()).isAlikeDead()) if ((getTarget() != null) && getTarget().isMonster() && (((MonsterInstance) getTarget()).getTarget() == this) && !((MonsterInstance) getTarget()).isAlikeDead())
{ {
@ -13989,6 +13995,8 @@ public class PlayerInstance extends Playable
return; return;
} }
if (Config.ENABLE_AUTO_ITEM)
{
for (int itemId : _autoSupplyItems) for (int itemId : _autoSupplyItems)
{ {
final ItemInstance item = _inventory.getItemByItemId(itemId); final ItemInstance item = _inventory.getItemByItemId(itemId);
@ -14008,8 +14016,9 @@ public class PlayerInstance extends Playable
} }
} }
} }
}
if (getCurrentHpPercent() <= _autoPotionPercent) if (Config.ENABLE_AUTO_POTION && (getCurrentHpPercent() <= _autoPotionPercent))
{ {
for (int itemId : _autoPotionItems) for (int itemId : _autoPotionItems)
{ {
@ -14032,6 +14041,8 @@ public class PlayerInstance extends Playable
} }
} }
if (Config.ENABLE_AUTO_BUFF)
{
for (int skillId : _autoSkills) for (int skillId : _autoSkills)
{ {
final Skill skill = getKnownSkill(skillId); final Skill skill = getKnownSkill(skillId);
@ -14045,6 +14056,7 @@ public class PlayerInstance extends Playable
doCast(skill); doCast(skill);
} }
} }
}
}, 0, 1000); }, 0, 1000);
} }

View File

@ -16,6 +16,7 @@
*/ */
package org.l2jmobius.gameserver.network.clientpackets.autoplay; package org.l2jmobius.gameserver.network.clientpackets.autoplay;
import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.commons.network.PacketReader;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.GameClient; import org.l2jmobius.gameserver.network.GameClient;
@ -60,6 +61,11 @@ public class ExAutoPlaySetting implements IClientIncomingPacket
player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _longRange, _potionPercent, _respectfulHunting)); player.sendPacket(new ExAutoPlaySettingSend(_options, _active, _pickUp, _nextTargetMode, _longRange, _potionPercent, _respectfulHunting));
player.setAutoPotionPercent(_potionPercent); player.setAutoPotionPercent(_potionPercent);
if (!Config.ENABLE_AUTO_PLAY)
{
return;
}
if (_active) if (_active)
{ {
player.startAutoPlayTask(_pickUp, _longRange, _respectfulHunting); player.startAutoPlayTask(_pickUp, _longRange, _respectfulHunting);

View File

@ -16,6 +16,7 @@
*/ */
package org.l2jmobius.gameserver.network.clientpackets.autoplay; package org.l2jmobius.gameserver.network.clientpackets.autoplay;
import org.l2jmobius.Config;
import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.commons.network.PacketReader;
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;
@ -93,7 +94,7 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket
if (_room > 263) if (_room > 263)
{ {
// auto supply // auto supply
if (item != null) if (Config.ENABLE_AUTO_ITEM && (item != null))
{ {
player.addAutoSupplyItem(item.getId()); player.addAutoSupplyItem(item.getId());
} }
@ -103,14 +104,14 @@ public class ExRequestActivateAutoShortcut implements IClientIncomingPacket
// auto potion // auto potion
if ((page == 23) && (slot == 1)) if ((page == 23) && (slot == 1))
{ {
if ((item != null) && item.isPotion()) if (Config.ENABLE_AUTO_POTION && (item != null) && item.isPotion())
{ {
player.addAutoPotionItem(item.getId()); player.addAutoPotionItem(item.getId());
return; return;
} }
} }
// auto skill // auto skill
if (skill != null) if (Config.ENABLE_AUTO_BUFF && (skill != null))
{ {
player.addAutoSkill(skill.getId()); player.addAutoSkill(skill.getId());
} }