From d54b91582b6f8ba1a2c26411dd122d80930f3b02 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Sun, 16 Aug 2009 11:07:10 -0600 Subject: Adjust auto ban code and add sit spam handling All three ban types can now either ban or just ingore new packets. Trade and sit spam default to ignore. Chat spam defaults to 1hr ban. --- src/map/battle.c | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) (limited to 'src/map/battle.c') diff --git a/src/map/battle.c b/src/map/battle.c index c9f1b59..c21d69c 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -4524,8 +4524,13 @@ int battle_config_read(const char *cfgName) battle_config.trade_spam_threshold = 10; battle_config.trade_spam_flood = 10; - battle_config.trade_spam_ban = 1; + battle_config.trade_spam_ban = 0; battle_config.trade_spam_warn = 8; + + battle_config.sit_spam_threshold = 1; + battle_config.sit_spam_flood = 15; + battle_config.sit_spam_ban = 0; + battle_config.sit_spam_warn = 3; } fp = fopen_(cfgName,"r"); @@ -4737,7 +4742,11 @@ int battle_config_read(const char *cfgName) { "trade_spam_threshold", &battle_config.trade_spam_threshold }, { "trade_spam_flood", &battle_config.trade_spam_flood }, { "trade_spam_ban", &battle_config.trade_spam_ban }, - { "trade_spam_warn", &battle_config.trade_spam_warn } + { "trade_spam_warn", &battle_config.trade_spam_warn }, + { "sit_spam_threshold", &battle_config.sit_spam_threshold }, + { "sit_spam_flood", &battle_config.sit_spam_flood }, + { "sit_spam_ban", &battle_config.sit_spam_ban }, + { "sit_spam_warn", &battle_config.sit_spam_warn } }; if (line[0] == '/' && line[1] == '/') @@ -4896,7 +4905,27 @@ int battle_config_read(const char *cfgName) if (battle_config.trade_spam_threshold < 0) battle_config.trade_spam_threshold = 0; else if (battle_config.trade_spam_threshold > 32767) - battle_config.trade_spam_threshold = 32767; + battle_config.trade_spam_threshold = 32767; + + if (battle_config.sit_spam_ban < 0) + battle_config.sit_spam_ban = 0; + else if (battle_config.sit_spam_ban > 32767) + battle_config.sit_spam_ban = 32767; + + if (battle_config.sit_spam_flood < 0) + battle_config.sit_spam_flood = 0; + else if (battle_config.sit_spam_flood > 32767) + battle_config.sit_spam_flood = 32767; + + if (battle_config.sit_spam_warn < 0) + battle_config.sit_spam_warn = 0; + else if (battle_config.sit_spam_warn > 32767) + battle_config.sit_spam_warn = 32767; + + if (battle_config.sit_spam_threshold < 0) + battle_config.sit_spam_threshold = 0; + else if (battle_config.sit_spam_threshold > 32767) + battle_config.sit_spam_threshold = 32767; // at least 1 client must be accepted if ((battle_config.packet_ver_flag & 63) == 0) // added by [Yor] -- cgit v1.2.3-60-g2f50