Addition of AugmentScript and EnchantItem flood protectors.

This commit is contained in:
MobiusDevelopment 2021-11-07 11:58:07 +00:00
parent ab19b0ba91
commit 99c349ead8
9 changed files with 92 additions and 2 deletions

View File

@ -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

View File

@ -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);

View File

@ -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();

View File

@ -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}

View File

@ -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

View File

@ -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);

View File

@ -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();

View File

@ -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);

View File

@ -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}