From c4f3d184abeda63abcfdaa386b4846e94bfed1f9 Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Fri, 18 Mar 2011 20:14:57 +0100 Subject: Improved @ban command When banning a character, the game master now sets a time unit (m, h, d, w or y for minutes, hours, days, weeks or years) after the duration. Ban durations longer than 2^16 minutes are now possible. The banned character is now kicked automatically and the banning character receives a feedback chat message. Reviewed-by: Thorbjorn --- src/account-server/storage.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/account-server/storage.cpp') diff --git a/src/account-server/storage.cpp b/src/account-server/storage.cpp index 333f3aaf..fdcb1cd9 100644 --- a/src/account-server/storage.cpp +++ b/src/account-server/storage.cpp @@ -1649,6 +1649,7 @@ void Storage::banCharacter(int id, int duration) { try { + // check the account of the character std::ostringstream query; query << "select user_id from " << CHARACTERS_TBL_NAME << " where id = '" << id << "';"; @@ -1659,10 +1660,12 @@ void Storage::banCharacter(int id, int duration) return; } + uint64_t bantime = (uint64_t)time(0) + (uint64_t)duration * 60u; + // ban the character std::ostringstream sql; sql << "update " << ACCOUNTS_TBL_NAME << " set level = '" << AL_BANNED << "', banned = '" - << time(0) + duration * 60 + << bantime << "' where id = '" << info(0, 0) << "';"; mDb->execSql(sql.str()); } -- cgit v1.2.3-60-g2f50