From 99c349ead84abe165d65d10a81db40e02f9e5545 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Sun, 7 Nov 2021 11:58:07 +0000 Subject: [PATCH] Addition of AugmentScript and EnchantItem flood protectors. --- .../{Flood.ini => FloodProtector.ini} | 7 +++++ .../java/org/l2jmobius/Config.java | 5 +++- .../clientpackets/RequestEnchantItem.java | 6 ++++ .../gameserver/util/FloodProtectors.java | 14 ++++++++++ .../{Flood.ini => FloodProtector.ini} | 14 ++++++++++ .../java/org/l2jmobius/Config.java | 8 +++++- .../clientpackets/RequestEnchantItem.java | 6 ++++ .../network/clientpackets/RequestRefine.java | 6 ++++ .../gameserver/util/FloodProtectors.java | 28 +++++++++++++++++++ 9 files changed, 92 insertions(+), 2 deletions(-) rename L2J_Mobius_C4_ScionsOfDestiny/dist/game/config/protected/{Flood.ini => FloodProtector.ini} (93%) rename L2J_Mobius_C6_Interlude/dist/game/config/protected/{Flood.ini => FloodProtector.ini} (90%) diff --git a/L2J_Mobius_C4_ScionsOfDestiny/dist/game/config/protected/Flood.ini b/L2J_Mobius_C4_ScionsOfDestiny/dist/game/config/protected/FloodProtector.ini similarity index 93% rename from L2J_Mobius_C4_ScionsOfDestiny/dist/game/config/protected/Flood.ini rename to L2J_Mobius_C4_ScionsOfDestiny/dist/game/config/protected/FloodProtector.ini index 6b11cac288..cdd17fe8f6 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/dist/game/config/protected/Flood.ini +++ b/L2J_Mobius_C4_ScionsOfDestiny/dist/game/config/protected/FloodProtector.ini @@ -71,6 +71,13 @@ FloodProtectorDropItemPunishmentLimit = 0 FloodProtectorDropItemPunishmentType = none FloodProtectorDropItemPunishmentTime = 0 +# EnchantItem - flooding +FloodProtectorEnchantItemInterval = 15 +FloodProtectorEnchantItemLogFlooding = False +FloodProtectorEnchantItemPunishmentLimit = 0 +FloodProtectorEnchantItemPunishmentType = none +FloodProtectorEnchantItemPunishmentTime = 0 + # ServerBypass - server bypass flooding FloodProtectorServerBypassInterval = 5 FloodProtectorServerBypassLogFlooding = False diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/Config.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/Config.java index adee463892..9ec8fe6672 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/Config.java @@ -80,7 +80,7 @@ public class Config private static final String SEVENSIGNS_CONFIG_FILE = "./config/main/SevenSigns.ini"; public static final String SIEGE_CONFIG_FILE = "./config/main/Siege.ini"; // protected - private static final String PROTECT_FLOOD_CONFIG_FILE = "./config/protected/Flood.ini"; + private static final String PROTECT_FLOOD_CONFIG_FILE = "./config/protected/FloodProtector.ini"; private static final String PROTECT_OTHER_CONFIG_FILE = "./config/protected/Other.ini"; public static final String TELNET_CONFIG_FILE = "./config/protected/Telnet.ini"; // events @@ -772,6 +772,7 @@ public class Config public static FloodProtectorConfig FLOOD_PROTECTOR_GLOBAL_CHAT; public static FloodProtectorConfig FLOOD_PROTECTOR_SUBCLASS; public static FloodProtectorConfig FLOOD_PROTECTOR_DROP_ITEM; + public static FloodProtectorConfig FLOOD_PROTECTOR_ENCHANT_ITEM; public static FloodProtectorConfig FLOOD_PROTECTOR_SERVER_BYPASS; public static FloodProtectorConfig FLOOD_PROTECTOR_MULTISELL; public static FloodProtectorConfig FLOOD_PROTECTOR_TRANSACTION; @@ -2209,6 +2210,7 @@ public class Config FLOOD_PROTECTOR_GLOBAL_CHAT = new FloodProtectorConfig("GlobalChatFloodProtector"); FLOOD_PROTECTOR_SUBCLASS = new FloodProtectorConfig("SubclassFloodProtector"); FLOOD_PROTECTOR_DROP_ITEM = new FloodProtectorConfig("DropItemFloodProtector"); + FLOOD_PROTECTOR_ENCHANT_ITEM = new FloodProtectorConfig("EnchantItemFloodProtector"); FLOOD_PROTECTOR_SERVER_BYPASS = new FloodProtectorConfig("ServerBypassFloodProtector"); FLOOD_PROTECTOR_MULTISELL = new FloodProtectorConfig("MultiSellFloodProtector"); FLOOD_PROTECTOR_TRANSACTION = new FloodProtectorConfig("TransactionFloodProtector"); @@ -2903,6 +2905,7 @@ public class Config loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_GLOBAL_CHAT, "GlobalChat", 5); loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_SUBCLASS, "Subclass", 20); loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_DROP_ITEM, "DropItem", 10); + loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_ENCHANT_ITEM, "EnchantItem", 15); loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_SERVER_BYPASS, "ServerBypass", 5); loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_MULTISELL, "MultiSell", 1); loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_TRANSACTION, "Transaction", 10); diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/clientpackets/RequestEnchantItem.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/clientpackets/RequestEnchantItem.java index bafa03d43b..8a6df4ffee 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/clientpackets/RequestEnchantItem.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/network/clientpackets/RequestEnchantItem.java @@ -123,6 +123,12 @@ public class RequestEnchantItem implements IClientIncomingPacket return; } + // Flood protect to enchant script + if (!client.getFloodProtectors().getEnchantItem().tryPerformAction("enchant")) + { + return; + } + if (player.getActiveTradeList() != null) { player.cancelActiveTrade(); diff --git a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/util/FloodProtectors.java b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/util/FloodProtectors.java index 9e0ec2b6c3..50d7d37f54 100644 --- a/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/util/FloodProtectors.java +++ b/L2J_Mobius_C4_ScionsOfDestiny/java/org/l2jmobius/gameserver/util/FloodProtectors.java @@ -57,6 +57,10 @@ public class FloodProtectors * Drop-item flood protector. */ private final FloodProtectorAction _dropItem; + /** + * enchantItem flood protector. + */ + private final FloodProtectorAction _enchantItem; /** * Server-bypass flood protector. */ @@ -125,6 +129,7 @@ public class FloodProtectors _globalChat = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_GLOBAL_CHAT); _subclass = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_SUBCLASS); _dropItem = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_DROP_ITEM); + _enchantItem = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_ENCHANT_ITEM); _serverBypass = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_SERVER_BYPASS); _multiSell = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_MULTISELL); _transaction = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_TRANSACTION); @@ -212,6 +217,15 @@ public class FloodProtectors return _dropItem; } + /** + * Returns {@link #_enchantItem}. + * @return {@link #_enchantItem} + */ + public FloodProtectorAction getEnchantItem() + { + return _enchantItem; + } + /** * Returns {@link #_serverBypass}. * @return {@link #_serverBypass} diff --git a/L2J_Mobius_C6_Interlude/dist/game/config/protected/Flood.ini b/L2J_Mobius_C6_Interlude/dist/game/config/protected/FloodProtector.ini similarity index 90% rename from L2J_Mobius_C6_Interlude/dist/game/config/protected/Flood.ini rename to L2J_Mobius_C6_Interlude/dist/game/config/protected/FloodProtector.ini index 6b11cac288..323d742f83 100644 --- a/L2J_Mobius_C6_Interlude/dist/game/config/protected/Flood.ini +++ b/L2J_Mobius_C6_Interlude/dist/game/config/protected/FloodProtector.ini @@ -71,6 +71,20 @@ FloodProtectorDropItemPunishmentLimit = 0 FloodProtectorDropItemPunishmentType = none FloodProtectorDropItemPunishmentTime = 0 +# AugmentScript - flooding +FloodProtectorAugmentScriptInterval = 30 +FloodProtectorAugmentScriptLogFlooding = False +FloodProtectorAugmentScriptPunishmentLimit = 0 +FloodProtectorAugmentScriptPunishmentType = none +FloodProtectorAugmentScriptPunishmentTime = 0 + +# EnchantItem - flooding +FloodProtectorEnchantItemInterval = 15 +FloodProtectorEnchantItemLogFlooding = False +FloodProtectorEnchantItemPunishmentLimit = 0 +FloodProtectorEnchantItemPunishmentType = none +FloodProtectorEnchantItemPunishmentTime = 0 + # ServerBypass - server bypass flooding FloodProtectorServerBypassInterval = 5 FloodProtectorServerBypassLogFlooding = False diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java index cadda9952b..6a5273f72c 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/Config.java @@ -91,7 +91,7 @@ public class Config private static final String SEVENSIGNS_CONFIG_FILE = "./config/main/SevenSigns.ini"; public static final String SIEGE_CONFIG_FILE = "./config/main/Siege.ini"; // protected - private static final String PROTECT_FLOOD_CONFIG_FILE = "./config/protected/Flood.ini"; + private static final String PROTECT_FLOOD_CONFIG_FILE = "./config/protected/FloodProtector.ini"; private static final String PROTECT_OTHER_CONFIG_FILE = "./config/protected/Other.ini"; public static final String TELNET_CONFIG_FILE = "./config/protected/Telnet.ini"; // events @@ -805,6 +805,8 @@ public class Config public static FloodProtectorConfig FLOOD_PROTECTOR_GLOBAL_CHAT; public static FloodProtectorConfig FLOOD_PROTECTOR_SUBCLASS; public static FloodProtectorConfig FLOOD_PROTECTOR_DROP_ITEM; + public static FloodProtectorConfig FLOOD_PROTECTOR_AUGMENT_SCRIPT; + public static FloodProtectorConfig FLOOD_PROTECTOR_ENCHANT_ITEM; public static FloodProtectorConfig FLOOD_PROTECTOR_SERVER_BYPASS; public static FloodProtectorConfig FLOOD_PROTECTOR_MULTISELL; public static FloodProtectorConfig FLOOD_PROTECTOR_TRANSACTION; @@ -2266,6 +2268,8 @@ public class Config FLOOD_PROTECTOR_GLOBAL_CHAT = new FloodProtectorConfig("GlobalChatFloodProtector"); FLOOD_PROTECTOR_SUBCLASS = new FloodProtectorConfig("SubclassFloodProtector"); FLOOD_PROTECTOR_DROP_ITEM = new FloodProtectorConfig("DropItemFloodProtector"); + FLOOD_PROTECTOR_AUGMENT_SCRIPT = new FloodProtectorConfig("AugmentScriptFloodProtector"); + FLOOD_PROTECTOR_ENCHANT_ITEM = new FloodProtectorConfig("EnchantItemFloodProtector"); FLOOD_PROTECTOR_SERVER_BYPASS = new FloodProtectorConfig("ServerBypassFloodProtector"); FLOOD_PROTECTOR_MULTISELL = new FloodProtectorConfig("MultiSellFloodProtector"); FLOOD_PROTECTOR_TRANSACTION = new FloodProtectorConfig("TransactionFloodProtector"); @@ -2877,6 +2881,8 @@ public class Config loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_GLOBAL_CHAT, "GlobalChat", 5); loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_SUBCLASS, "Subclass", 20); loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_DROP_ITEM, "DropItem", 10); + loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_AUGMENT_SCRIPT, "AugmentScript", 30); + loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_ENCHANT_ITEM, "EnchantItem", 15); loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_SERVER_BYPASS, "ServerBypass", 5); loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_MULTISELL, "MultiSell", 1); loadFloodProtectorConfig(properties, FLOOD_PROTECTOR_TRANSACTION, "Transaction", 10); diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestEnchantItem.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestEnchantItem.java index 7e83fe06dd..515fdd3453 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestEnchantItem.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestEnchantItem.java @@ -123,6 +123,12 @@ public class RequestEnchantItem implements IClientIncomingPacket return; } + // Flood protect to enchant script + if (!client.getFloodProtectors().getEnchantItem().tryPerformAction("enchant")) + { + return; + } + if (player.getActiveTradeList() != null) { player.cancelActiveTrade(); diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefine.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefine.java index cd755ee4e6..d2c7ab826c 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefine.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/network/clientpackets/RequestRefine.java @@ -60,6 +60,12 @@ public class RequestRefine implements IClientIncomingPacket return; } + // Flood protect to augment script + if (!client.getFloodProtectors().getAugmentItem().tryPerformAction("augment")) + { + return; + } + final ItemInstance targetItem = (ItemInstance) World.getInstance().findObject(_targetItemObjId); final ItemInstance refinerItem = (ItemInstance) World.getInstance().findObject(_refinerItemObjId); final ItemInstance gemstoneItem = (ItemInstance) World.getInstance().findObject(_gemstoneItemObjId); diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/util/FloodProtectors.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/util/FloodProtectors.java index 9e0ec2b6c3..49b51806ce 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/util/FloodProtectors.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/util/FloodProtectors.java @@ -57,6 +57,14 @@ public class FloodProtectors * Drop-item flood protector. */ private final FloodProtectorAction _dropItem; + /** + * Augmentscript flood protector. + */ + private final FloodProtectorAction _augmentScript; + /** + * enchantItem flood protector. + */ + private final FloodProtectorAction _enchantItem; /** * Server-bypass flood protector. */ @@ -125,6 +133,8 @@ public class FloodProtectors _globalChat = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_GLOBAL_CHAT); _subclass = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_SUBCLASS); _dropItem = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_DROP_ITEM); + _augmentScript = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_AUGMENT_SCRIPT); + _enchantItem = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_ENCHANT_ITEM); _serverBypass = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_SERVER_BYPASS); _multiSell = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_MULTISELL); _transaction = new FloodProtectorAction(client, Config.FLOOD_PROTECTOR_TRANSACTION); @@ -212,6 +222,24 @@ public class FloodProtectors return _dropItem; } + /** + * Returns {@link #_augmentScript}. + * @return {@link #_augmentScript} + */ + public FloodProtectorAction getAugmentItem() + { + return _augmentScript; + } + + /** + * Returns {@link #_enchantItem}. + * @return {@link #_enchantItem} + */ + public FloodProtectorAction getEnchantItem() + { + return _enchantItem; + } + /** * Returns {@link #_serverBypass}. * @return {@link #_serverBypass}