summaryrefslogtreecommitdiff
path: root/src/map/battle.c
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-08-16 11:07:10 -0600
committerJared Adams <jaxad0127@gmail.com>2009-08-16 11:07:10 -0600
commitd54b91582b6f8ba1a2c26411dd122d80930f3b02 (patch)
treecc0a05ac68576900492611274b0ea77ad39718e8 /src/map/battle.c
parent4fcb38d69d1b61cc79b6b9af06918e5c228b242b (diff)
downloadtmwa-d54b91582b6f8ba1a2c26411dd122d80930f3b02.tar.gz
tmwa-d54b91582b6f8ba1a2c26411dd122d80930f3b02.tar.bz2
tmwa-d54b91582b6f8ba1a2c26411dd122d80930f3b02.tar.xz
tmwa-d54b91582b6f8ba1a2c26411dd122d80930f3b02.zip
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.
Diffstat (limited to 'src/map/battle.c')
-rw-r--r--src/map/battle.c35
1 files changed, 32 insertions, 3 deletions
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]