summaryrefslogtreecommitdiff
path: root/src/map/tmw.c
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-07-06 14:33:43 -0600
committerJared Adams <jaxad0127@gmail.com>2009-07-06 14:33:43 -0600
commit03b5e644857f80a23bd8b856b78a10cf0a564a66 (patch)
tree1f557d75211e3408cbac740b95258e5a3f92f35d /src/map/tmw.c
parent2855e018b8e177878ca0d83c61e4442ddf3e505c (diff)
downloadtmwa-03b5e644857f80a23bd8b856b78a10cf0a564a66.tar.gz
tmwa-03b5e644857f80a23bd8b856b78a10cf0a564a66.tar.bz2
tmwa-03b5e644857f80a23bd8b856b78a10cf0a564a66.tar.xz
tmwa-03b5e644857f80a23bd8b856b78a10cf0a564a66.zip
Add a new trade spam system
Diffstat (limited to 'src/map/tmw.c')
-rw-r--r--src/map/tmw.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/map/tmw.c b/src/map/tmw.c
index ba02189..5d4c991 100644
--- a/src/map/tmw.c
+++ b/src/map/tmw.c
@@ -116,3 +116,36 @@ void tmw_GmHackMsg(const char *fmt, ...) {
intif_wis_message_to_gm(wisp_server_name, battle_config.hack_info_GM_level, outbuf, strlen(outbuf) + 1);
}
+
+int tmw_CheckTradeSpam(struct map_session_data *sd) {
+ nullpo_retr(1, sd);
+ time_t now = time(NULL);
+
+ if (pc_isGM(sd)) return 0;
+
+ if (now > sd->trade_reset_due) {
+ sd->trade_reset_due = now + battle_config.trade_spam_threshold;
+ sd->trades_in = 0;
+ }
+
+ sd->trades_in++;
+
+ if (sd->trades_in >= battle_config.trade_spam_flood) {
+ sd->trades_in = 0;
+ tmw_GmHackMsg("Trade spam detected from character '%s' (account: %d)", sd->status.name, sd->status.account_id);
+
+ if (battle_config.trade_spam_ban > 0) {
+ clif_displaymessage(sd->fd, "You have been banned for trade spamming. Please do not trade spam.");
+ tmw_GmHackMsg("This player has been banned for %d hour(s).", battle_config.trade_spam_ban);
+
+ chrif_char_ask_name(-1, sd->status.name, 2, 0, 0, 0, battle_config.trade_spam_ban, 0, 0); // type: 2 - ban (year, month, day, hour, minute, second)
+ clif_setwaitclose(sd->fd);
+ }
+ }
+
+ if (battle_config.trade_spam_ban && sd->trades_in >= battle_config.trade_spam_warn) {
+ clif_displaymessage(sd->fd, "WARNING : You are about to be automaticly banned for trade spam!");
+ }
+
+ return 0;
+}