diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-07-06 11:23:10 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-07-06 11:23:10 -0600 |
commit | 2e87e5b65a02d8d9f867a0510f039cc319b3ffcb (patch) | |
tree | bd6fe5b0fe8d0f9296eb1f3eea0d69aca9196cfe /src/map/tmw.c | |
parent | ad8f53edc80811b933c9e2e0f469ef6e6a25972d (diff) | |
download | tmwa-2e87e5b65a02d8d9f867a0510f039cc319b3ffcb.tar.gz tmwa-2e87e5b65a02d8d9f867a0510f039cc319b3ffcb.tar.bz2 tmwa-2e87e5b65a02d8d9f867a0510f039cc319b3ffcb.tar.xz tmwa-2e87e5b65a02d8d9f867a0510f039cc319b3ffcb.zip |
Add a new trade spam system
Diffstat (limited to 'src/map/tmw.c')
-rw-r--r-- | src/map/tmw.c | 33 |
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; +} |