mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-15 00:06:11 +00:00
Fix commands and starting to use nullptr instead of NULL
This commit is contained in:
@@ -31,38 +31,33 @@ public:
|
||||
{ "account", SEC_ADMINISTRATOR, true, &HandleUnBanAccountCommand, "" },
|
||||
{ "character", SEC_ADMINISTRATOR, true, &HandleUnBanCharacterCommand, "" },
|
||||
{ "playeraccount", SEC_ADMINISTRATOR, true, &HandleUnBanAccountByCharCommand, "" },
|
||||
{ "ip", SEC_ADMINISTRATOR, true, &HandleUnBanIPCommand, "" },
|
||||
{ NULL, 0, false, NULL, "" }
|
||||
{ "ip", SEC_ADMINISTRATOR, true, &HandleUnBanIPCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> banlistCommandTable =
|
||||
{
|
||||
{ "account", SEC_ADMINISTRATOR, true, &HandleBanListAccountCommand, "" },
|
||||
{ "character", SEC_ADMINISTRATOR, true, &HandleBanListCharacterCommand, "" },
|
||||
{ "ip", SEC_ADMINISTRATOR, true, &HandleBanListIPCommand, "" },
|
||||
{ NULL, 0, false, NULL, "" }
|
||||
{ "ip", SEC_ADMINISTRATOR, true, &HandleBanListIPCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> baninfoCommandTable =
|
||||
{
|
||||
{ "account", SEC_ADMINISTRATOR, true, &HandleBanInfoAccountCommand, "" },
|
||||
{ "character", SEC_ADMINISTRATOR, true, &HandleBanInfoCharacterCommand, "" },
|
||||
{ "ip", SEC_ADMINISTRATOR, true, &HandleBanInfoIPCommand, "" },
|
||||
{ NULL, 0, false, NULL, "" }
|
||||
{ "ip", SEC_ADMINISTRATOR, true, &HandleBanInfoIPCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> banCommandTable =
|
||||
{
|
||||
{ "account", SEC_ADMINISTRATOR, true, &HandleBanAccountCommand, "" },
|
||||
{ "character", SEC_ADMINISTRATOR, true, &HandleBanCharacterCommand, "" },
|
||||
{ "playeraccount", SEC_ADMINISTRATOR, true, &HandleBanAccountByCharCommand, "" },
|
||||
{ "ip", SEC_ADMINISTRATOR, true, &HandleBanIPCommand, "" },
|
||||
{ NULL, 0, false, NULL, "" }
|
||||
{ "ip", SEC_ADMINISTRATOR, true, &HandleBanIPCommand, "" }
|
||||
};
|
||||
static std::vector<ChatCommand> commandTable =
|
||||
{
|
||||
{ "ban", SEC_ADMINISTRATOR, true, NULL, "", banCommandTable },
|
||||
{ "baninfo", SEC_ADMINISTRATOR, true, NULL, "", baninfoCommandTable },
|
||||
{ "banlist", SEC_ADMINISTRATOR, true, NULL, "", banlistCommandTable },
|
||||
{ "unban", SEC_ADMINISTRATOR, true, NULL, "", unbanCommandTable },
|
||||
{ NULL, 0, false, NULL, "" }
|
||||
{ "ban", SEC_ADMINISTRATOR, true, nullptr, "", banCommandTable },
|
||||
{ "baninfo", SEC_ADMINISTRATOR, true, nullptr, "", baninfoCommandTable },
|
||||
{ "banlist", SEC_ADMINISTRATOR, true, nullptr, "", banlistCommandTable },
|
||||
{ "unban", SEC_ADMINISTRATOR, true, nullptr, "", unbanCommandTable }
|
||||
};
|
||||
return commandTable;
|
||||
}
|
||||
@@ -83,11 +78,11 @@ public:
|
||||
|
||||
std::string name = nameStr;
|
||||
|
||||
char* durationStr = strtok(NULL, " ");
|
||||
char* durationStr = strtok(nullptr, " ");
|
||||
if (!durationStr || !atoi(durationStr))
|
||||
return false;
|
||||
|
||||
char* reasonStr = strtok(NULL, "");
|
||||
char* reasonStr = strtok(nullptr, "");
|
||||
if (!reasonStr)
|
||||
return false;
|
||||
|
||||
@@ -142,11 +137,11 @@ public:
|
||||
|
||||
std::string nameOrIP = cnameOrIP;
|
||||
|
||||
char* durationStr = strtok(NULL, " ");
|
||||
char* durationStr = strtok(nullptr, " ");
|
||||
if (!durationStr || !atoi(durationStr))
|
||||
return false;
|
||||
|
||||
char* reasonStr = strtok(NULL, "");
|
||||
char* reasonStr = strtok(nullptr, "");
|
||||
if (!reasonStr)
|
||||
return false;
|
||||
|
||||
@@ -250,7 +245,7 @@ public:
|
||||
|
||||
time_t unbanDate = time_t(fields[3].GetUInt32());
|
||||
bool active = false;
|
||||
if (fields[2].GetBool() && (fields[1].GetUInt64() == uint64(0) || unbanDate >= time(NULL)))
|
||||
if (fields[2].GetBool() && (fields[1].GetUInt64() == uint64(0) || unbanDate >= time(nullptr)))
|
||||
active = true;
|
||||
bool permanent = (fields[1].GetUInt64() == uint64(0));
|
||||
std::string banTime = permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt64(), true);
|
||||
@@ -298,7 +293,7 @@ public:
|
||||
Field* fields = result->Fetch();
|
||||
time_t unbanDate = time_t(fields[3].GetUInt32());
|
||||
bool active = false;
|
||||
if (fields[2].GetUInt8() && (!fields[1].GetUInt32() || unbanDate >= time(NULL)))
|
||||
if (fields[2].GetUInt8() && (!fields[1].GetUInt32() || unbanDate >= time(nullptr)))
|
||||
active = true;
|
||||
bool permanent = (fields[1].GetUInt32() == uint32(0));
|
||||
std::string banTime = permanent ? handler->GetTrinityString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt64(), true);
|
||||
|
||||
Reference in New Issue
Block a user