Skip to content

Commit

Permalink
drop any non-AC code from Ban() function
Browse files Browse the repository at this point in the history
  • Loading branch information
sudlud committed Jul 7, 2024
1 parent ff7cd8f commit 27e65cf
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions src/LuaEngine/GlobalMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -2159,46 +2159,25 @@ namespace LuaGlobalFunctions
const int BAN_CHARACTER = 1;
const int BAN_IP = 2;

#ifndef AZEROTHCORE
BanMode mode = BanMode::BAN_ACCOUNT;
#endif

switch (banMode)
{
case BAN_ACCOUNT:
#if defined TRINITY || AZEROTHCORE
if (!Utf8ToUpperOnlyLatin(nameOrIP))
return luaL_argerror(L, 2, "invalid account name");
#else
if (!AccountMgr::normalizeString(nameOrIP))
return luaL_argerror(L, 2, "invalid account name");
#endif
#ifndef AZEROTHCORE
mode = BanMode::BAN_ACCOUNT;
#endif
break;
case BAN_CHARACTER:
if (!normalizePlayerName(nameOrIP))
return luaL_argerror(L, 2, "invalid character name");
#ifndef AZEROTHCORE
mode = BanMode::BAN_CHARACTER;
#endif
break;
case BAN_IP:
if (!IsIPAddress(nameOrIP.c_str()))
return luaL_argerror(L, 2, "invalid ip");
#ifndef AZEROTHCORE
mode = BanMode::BAN_IP;
#endif
break;
default:
return luaL_argerror(L, 1, "unknown banmode");
}

BanReturn result;
#ifndef AZEROTHCORE
result = eWorld->BanAccount(mode, nameOrIP, duration, reason, whoBanned);
#else
switch (banMode)
{
case BAN_ACCOUNT:
Expand All @@ -2211,7 +2190,6 @@ namespace LuaGlobalFunctions
result = sBan->BanIP(nameOrIP, std::to_string(duration) + "s", reason, whoBanned);
break;
}
#endif

switch (result)
{
Expand All @@ -2224,15 +2202,9 @@ namespace LuaGlobalFunctions
case BanReturn::BAN_NOTFOUND:
Eluna::Push(L, 2);
break;
#ifdef AZEROTHCORE
case BanReturn::BAN_LONGER_EXISTS:
Eluna::Push(L, 3);
break;
#elif TRINITY
case BanReturn::BAN_EXISTS:
Eluna::Push(L, 3);
break;
#endif
}
return 1;
}
Expand Down

0 comments on commit 27e65cf

Please sign in to comment.