mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-24 19:06:49 +01:00
Merge branch 'pr/n9655_Bezo'
This commit is contained in:
@@ -42,13 +42,19 @@ public:
|
||||
{ "password", SEC_CONSOLE, true, &HandleAccountSetPasswordCommand, "", NULL },
|
||||
{ NULL, SEC_PLAYER, false, NULL, "", NULL }
|
||||
};
|
||||
static ChatCommand accountLockCommandTable[] =
|
||||
{
|
||||
{ "country", SEC_PLAYER, true, &HandleAccountLockCountryCommand, "", NULL },
|
||||
{ "ip", SEC_PLAYER, true, &HandleAccountLockIpCommand, "", NULL },
|
||||
{ NULL, SEC_PLAYER, false, NULL, "", NULL },
|
||||
};
|
||||
static ChatCommand accountCommandTable[] =
|
||||
{
|
||||
{ "addon", SEC_MODERATOR, false, &HandleAccountAddonCommand, "", NULL },
|
||||
{ "create", SEC_CONSOLE, true, &HandleAccountCreateCommand, "", NULL },
|
||||
{ "delete", SEC_CONSOLE, true, &HandleAccountDeleteCommand, "", NULL },
|
||||
{ "onlinelist", SEC_CONSOLE, true, &HandleAccountOnlineListCommand, "", NULL },
|
||||
{ "lock", SEC_PLAYER, false, &HandleAccountLockCommand, "", NULL },
|
||||
{ "lock", SEC_PLAYER, false, NULL, "", accountLockCommandTable },
|
||||
{ "set", SEC_ADMINISTRATOR, true, NULL, "", accountSetCommandTable },
|
||||
{ "password", SEC_PLAYER, false, &HandleAccountPasswordCommand, "", NULL },
|
||||
{ "", SEC_PLAYER, false, &HandleAccountCommand, "", NULL },
|
||||
@@ -245,7 +251,57 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleAccountLockCommand(ChatHandler* handler, char const* args)
|
||||
static bool HandleAccountLockCountryCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
{
|
||||
handler->SendSysMessage(LANG_USE_BOL);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
std::string param = (char*)args;
|
||||
|
||||
if (!param.empty())
|
||||
{
|
||||
if (param == "on")
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_LOGON_COUNTRY);
|
||||
uint32 ip = inet_addr(handler->GetSession()->GetRemoteAddress().c_str());
|
||||
EndianConvertReverse(ip);
|
||||
stmt->setUInt32(0, ip);
|
||||
PreparedQueryResult result = LoginDatabase.Query(stmt);
|
||||
if (result)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
std::string country = fields[0].GetString();
|
||||
stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_LOCK_CONTRY);
|
||||
stmt->setString(0, country);
|
||||
stmt->setUInt32(1, handler->GetSession()->GetAccountId());
|
||||
LoginDatabase.Execute(stmt);
|
||||
handler->PSendSysMessage(LANG_COMMAND_ACCLOCKLOCKED);
|
||||
}
|
||||
else
|
||||
{
|
||||
handler->PSendSysMessage("[IP2NATION] Table empty");
|
||||
sLog->outDebug(LOG_FILTER_AUTHSERVER, "[IP2NATION] Table empty");
|
||||
}
|
||||
}
|
||||
else if (param == "off")
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_LOCK_CONTRY);
|
||||
stmt->setString(0, "00");
|
||||
stmt->setUInt32(1, handler->GetSession()->GetAccountId());
|
||||
LoginDatabase.Execute(stmt);
|
||||
handler->PSendSysMessage(LANG_COMMAND_ACCLOCKUNLOCKED);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
handler->SendSysMessage(LANG_USE_BOL);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool HandleAccountLockIpCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
if (!*args)
|
||||
{
|
||||
|
||||
@@ -1587,7 +1587,7 @@ public:
|
||||
EndianConvertReverse(ip);
|
||||
#endif
|
||||
|
||||
PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_IP2NATION_COUNTRY);
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP2NATION_COUNTRY);
|
||||
|
||||
stmt->setUInt32(0, ip);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user