From 70d2f8a77bb4201264abbe6f7b6bd4b1d465a454 Mon Sep 17 00:00:00 2001 From: WiZZy Date: Tue, 26 Mar 2019 12:48:00 +0200 Subject: [PATCH] Update GlobalMethods.h --- GlobalMethods.h | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/GlobalMethods.h b/GlobalMethods.h index 24318c7..4d80668 100644 --- a/GlobalMethods.h +++ b/GlobalMethods.h @@ -9,6 +9,18 @@ #include "BindingMap.h" +#ifdef AZEROTHCORE +#include "BanManager.h" + +enum BanMode +{ + BAN_ACCOUNT, + BAN_CHARACTER, + BAN_IP +}; + +#endif + /*** * These functions can be used anywhere at any time, including at start-up. */ @@ -1941,7 +1953,11 @@ namespace LuaGlobalFunctions { int banMode = Eluna::CHECKVAL(L, 1); std::string nameOrIP = Eluna::CHECKVAL(L, 2); +#ifdef AZEROTHCORE + std::string duration = Eluna::CHECKVAL(L, 3); +#elif uint32 duration = Eluna::CHECKVAL(L, 3); +#endif const char* reason = Eluna::CHECKVAL(L, 4, ""); const char* whoBanned = Eluna::CHECKVAL(L, 5, ""); @@ -1968,10 +1984,22 @@ namespace LuaGlobalFunctions return 0; } + #ifndef AZEROTHCORE eWorld->BanAccount((BanMode)banMode, nameOrIP, duration, reason, whoBanned); #else - eWorld->BanAccount((BanMode)banMode, nameOrIP, std::to_string(duration) + "s", reason, whoBanned); + switch (banMode) + { + case BAN_ACCOUNT: + sBan->BanAccount(nameOrIP, duration, reason, whoBanned); + break; + case BAN_CHARACTER: + sBan->BanAccountByPlayerName(nameOrIP, duration, reason, whoBanned); + break; + case BAN_IP: + sBan->BanIP(nameOrIP, duration, reason, whoBanned); + break; + } #endif return 0; }