mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-19 03:45:43 +00:00
refactor(Core/Scripts): restyle scripts lib with astyle (#3467)
This commit is contained in:
@@ -109,26 +109,26 @@ public:
|
||||
|
||||
switch (sBan->BanCharacter(name, durationStr, reasonStr, handler->GetSession() ? handler->GetSession()->GetPlayerName() : ""))
|
||||
{
|
||||
case BAN_SUCCESS:
|
||||
if (atoi(durationStr) > 0)
|
||||
{
|
||||
if (!sWorld->getBoolConfig(CONFIG_SHOW_BAN_IN_WORLD))
|
||||
handler->PSendSysMessage(LANG_BAN_YOUBANNED, name.c_str(), secsToTimeString(TimeStringToSecs(durationStr), true).c_str(), reasonStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!sWorld->getBoolConfig(CONFIG_SHOW_BAN_IN_WORLD))
|
||||
handler->PSendSysMessage(LANG_BAN_YOUPERMBANNED, name.c_str(), reasonStr);
|
||||
}
|
||||
break;
|
||||
case BAN_NOTFOUND:
|
||||
{
|
||||
handler->PSendSysMessage(LANG_BAN_NOTFOUND, "character", name.c_str());
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
case BAN_SUCCESS:
|
||||
if (atoi(durationStr) > 0)
|
||||
{
|
||||
if (!sWorld->getBoolConfig(CONFIG_SHOW_BAN_IN_WORLD))
|
||||
handler->PSendSysMessage(LANG_BAN_YOUBANNED, name.c_str(), secsToTimeString(TimeStringToSecs(durationStr), true).c_str(), reasonStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!sWorld->getBoolConfig(CONFIG_SHOW_BAN_IN_WORLD))
|
||||
handler->PSendSysMessage(LANG_BAN_YOUPERMBANNED, name.c_str(), reasonStr);
|
||||
}
|
||||
break;
|
||||
case BAN_NOTFOUND:
|
||||
{
|
||||
handler->PSendSysMessage(LANG_BAN_NOTFOUND, "character", name.c_str());
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -191,16 +191,16 @@ public:
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case BAN_ACCOUNT:
|
||||
banReturn = sBan->BanAccount(nameOrIP, durationStr, reasonStr, handler->GetSession() ? handler->GetSession()->GetPlayerName() : "");
|
||||
break;
|
||||
case BAN_CHARACTER:
|
||||
banReturn = sBan->BanAccountByPlayerName(nameOrIP, durationStr, reasonStr, handler->GetSession() ? handler->GetSession()->GetPlayerName() : "");
|
||||
break;
|
||||
case BAN_IP:
|
||||
default:
|
||||
banReturn = sBan->BanIP(nameOrIP, durationStr, reasonStr, handler->GetSession() ? handler->GetSession()->GetPlayerName() : "");
|
||||
break;
|
||||
case BAN_ACCOUNT:
|
||||
banReturn = sBan->BanAccount(nameOrIP, durationStr, reasonStr, handler->GetSession() ? handler->GetSession()->GetPlayerName() : "");
|
||||
break;
|
||||
case BAN_CHARACTER:
|
||||
banReturn = sBan->BanAccountByPlayerName(nameOrIP, durationStr, reasonStr, handler->GetSession() ? handler->GetSession()->GetPlayerName() : "");
|
||||
break;
|
||||
case BAN_IP:
|
||||
default:
|
||||
banReturn = sBan->BanIP(nameOrIP, durationStr, reasonStr, handler->GetSession() ? handler->GetSession()->GetPlayerName() : "");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (banReturn)
|
||||
@@ -208,7 +208,7 @@ public:
|
||||
case BAN_SUCCESS:
|
||||
if (atoi(durationStr) > 0)
|
||||
{
|
||||
if (!sWorld->getBoolConfig(CONFIG_SHOW_BAN_IN_WORLD))
|
||||
if (!sWorld->getBoolConfig(CONFIG_SHOW_BAN_IN_WORLD))
|
||||
handler->PSendSysMessage(LANG_BAN_YOUBANNED, nameOrIP.c_str(), secsToTimeString(TimeStringToSecs(durationStr), true).c_str(), reasonStr);
|
||||
}
|
||||
else
|
||||
@@ -292,9 +292,8 @@ public:
|
||||
bool permanent = (fields[1].GetUInt64() == uint64(0));
|
||||
std::string banTime = permanent ? handler->GetAcoreString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt64(), true);
|
||||
handler->PSendSysMessage(LANG_BANINFO_HISTORYENTRY,
|
||||
fields[0].GetCString(), banTime.c_str(), active ? handler->GetAcoreString(LANG_YES) : handler->GetAcoreString(LANG_NO), fields[4].GetCString(), fields[5].GetCString());
|
||||
}
|
||||
while (result->NextRow());
|
||||
fields[0].GetCString(), banTime.c_str(), active ? handler->GetAcoreString(LANG_YES) : handler->GetAcoreString(LANG_NO), fields[4].GetCString(), fields[5].GetCString());
|
||||
} while (result->NextRow());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -340,9 +339,8 @@ public:
|
||||
bool permanent = (fields[1].GetUInt32() == uint32(0));
|
||||
std::string banTime = permanent ? handler->GetAcoreString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[1].GetUInt64(), true);
|
||||
handler->PSendSysMessage(LANG_BANINFO_HISTORYENTRY,
|
||||
fields[0].GetCString(), banTime.c_str(), active ? handler->GetAcoreString(LANG_YES) : handler->GetAcoreString(LANG_NO), fields[4].GetCString(), fields[5].GetCString());
|
||||
}
|
||||
while (result->NextRow());
|
||||
fields[0].GetCString(), banTime.c_str(), active ? handler->GetAcoreString(LANG_YES) : handler->GetAcoreString(LANG_NO), fields[4].GetCString(), fields[5].GetCString());
|
||||
} while (result->NextRow());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -372,8 +370,8 @@ public:
|
||||
Field* fields = result->Fetch();
|
||||
bool permanent = !fields[6].GetUInt64();
|
||||
handler->PSendSysMessage(LANG_BANINFO_IPENTRY,
|
||||
fields[0].GetCString(), fields[1].GetCString(), permanent ? handler->GetAcoreString(LANG_BANINFO_NEVER) : fields[2].GetCString(),
|
||||
permanent ? handler->GetAcoreString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[3].GetUInt64(), true).c_str(), fields[4].GetCString(), fields[5].GetCString());
|
||||
fields[0].GetCString(), fields[1].GetCString(), permanent ? handler->GetAcoreString(LANG_BANINFO_NEVER) : fields[2].GetCString(),
|
||||
permanent ? handler->GetAcoreString(LANG_BANINFO_INFINITE) : secsToTimeString(fields[3].GetUInt64(), true).c_str(), fields[4].GetCString(), fields[5].GetCString());
|
||||
|
||||
|
||||
return true;
|
||||
@@ -428,8 +426,7 @@ public:
|
||||
Field* fields2 = banResult->Fetch();
|
||||
handler->PSendSysMessage("%s", fields2[0].GetCString());
|
||||
}
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
}
|
||||
// Console wide output
|
||||
else
|
||||
@@ -466,8 +463,8 @@ public:
|
||||
if (fields2[0].GetUInt32() == fields2[1].GetUInt32())
|
||||
{
|
||||
handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|",
|
||||
accountName.c_str(), tmBan.tm_year%100, tmBan.tm_mon+1, tmBan.tm_mday, tmBan.tm_hour, tmBan.tm_min,
|
||||
fields2[2].GetCString(), fields2[3].GetCString());
|
||||
accountName.c_str(), tmBan.tm_year % 100, tmBan.tm_mon + 1, tmBan.tm_mday, tmBan.tm_hour, tmBan.tm_min,
|
||||
fields2[2].GetCString(), fields2[3].GetCString());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -475,15 +472,13 @@ public:
|
||||
tm tmUnban;
|
||||
localtime_r(&timeUnban, &tmUnban);
|
||||
handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|",
|
||||
accountName.c_str(), tmBan.tm_year%100, tmBan.tm_mon+1, tmBan.tm_mday, tmBan.tm_hour, tmBan.tm_min,
|
||||
tmUnban.tm_year%100, tmUnban.tm_mon+1, tmUnban.tm_mday, tmUnban.tm_hour, tmUnban.tm_min,
|
||||
fields2[2].GetCString(), fields2[3].GetCString());
|
||||
accountName.c_str(), tmBan.tm_year % 100, tmBan.tm_mon + 1, tmBan.tm_mday, tmBan.tm_hour, tmBan.tm_min,
|
||||
tmUnban.tm_year % 100, tmUnban.tm_mon + 1, tmUnban.tm_mday, tmUnban.tm_hour, tmUnban.tm_min,
|
||||
fields2[2].GetCString(), fields2[3].GetCString());
|
||||
}
|
||||
}
|
||||
while (banInfo->NextRow());
|
||||
} while (banInfo->NextRow());
|
||||
}
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
|
||||
handler->SendSysMessage(" ===============================================================================");
|
||||
}
|
||||
@@ -523,8 +518,7 @@ public:
|
||||
PreparedQueryResult banResult = CharacterDatabase.Query(stmt2);
|
||||
if (banResult)
|
||||
handler->PSendSysMessage("%s", (*banResult)[0].GetCString());
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
}
|
||||
// Console wide output
|
||||
else
|
||||
@@ -555,8 +549,8 @@ public:
|
||||
if (banFields[0].GetUInt32() == banFields[1].GetUInt32())
|
||||
{
|
||||
handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|",
|
||||
char_name.c_str(), tmBan.tm_year%100, tmBan.tm_mon+1, tmBan.tm_mday, tmBan.tm_hour, tmBan.tm_min,
|
||||
banFields[2].GetCString(), banFields[3].GetCString());
|
||||
char_name.c_str(), tmBan.tm_year % 100, tmBan.tm_mon + 1, tmBan.tm_mday, tmBan.tm_hour, tmBan.tm_min,
|
||||
banFields[2].GetCString(), banFields[3].GetCString());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -564,15 +558,13 @@ public:
|
||||
tm tmUnban;
|
||||
localtime_r(&timeUnban, &tmUnban);
|
||||
handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|",
|
||||
char_name.c_str(), tmBan.tm_year%100, tmBan.tm_mon+1, tmBan.tm_mday, tmBan.tm_hour, tmBan.tm_min,
|
||||
tmUnban.tm_year%100, tmUnban.tm_mon+1, tmUnban.tm_mday, tmUnban.tm_hour, tmUnban.tm_min,
|
||||
banFields[2].GetCString(), banFields[3].GetCString());
|
||||
char_name.c_str(), tmBan.tm_year % 100, tmBan.tm_mon + 1, tmBan.tm_mday, tmBan.tm_hour, tmBan.tm_min,
|
||||
tmUnban.tm_year % 100, tmUnban.tm_mon + 1, tmUnban.tm_mday, tmUnban.tm_hour, tmUnban.tm_min,
|
||||
banFields[2].GetCString(), banFields[3].GetCString());
|
||||
}
|
||||
}
|
||||
while (banInfo->NextRow());
|
||||
} while (banInfo->NextRow());
|
||||
}
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
handler->SendSysMessage(" =============================================================================== ");
|
||||
}
|
||||
|
||||
@@ -616,8 +608,7 @@ public:
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
handler->PSendSysMessage("%s", fields[0].GetCString());
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
}
|
||||
// Console wide output
|
||||
else
|
||||
@@ -635,8 +626,8 @@ public:
|
||||
if (fields[1].GetUInt32() == fields[2].GetUInt32())
|
||||
{
|
||||
handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d| permanent |%-15.15s|%-15.15s|",
|
||||
fields[0].GetCString(), tmBan.tm_year%100, tmBan.tm_mon+1, tmBan.tm_mday, tmBan.tm_hour, tmBan.tm_min,
|
||||
fields[3].GetCString(), fields[4].GetCString());
|
||||
fields[0].GetCString(), tmBan.tm_year % 100, tmBan.tm_mon + 1, tmBan.tm_mday, tmBan.tm_hour, tmBan.tm_min,
|
||||
fields[3].GetCString(), fields[4].GetCString());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -644,12 +635,11 @@ public:
|
||||
tm tmUnban;
|
||||
localtime_r(&timeUnban, &tmUnban);
|
||||
handler->PSendSysMessage("|%-15.15s|%02d-%02d-%02d %02d:%02d|%02d-%02d-%02d %02d:%02d|%-15.15s|%-15.15s|",
|
||||
fields[0].GetCString(), tmBan.tm_year%100, tmBan.tm_mon+1, tmBan.tm_mday, tmBan.tm_hour, tmBan.tm_min,
|
||||
tmUnban.tm_year%100, tmUnban.tm_mon+1, tmUnban.tm_mday, tmUnban.tm_hour, tmUnban.tm_min,
|
||||
fields[3].GetCString(), fields[4].GetCString());
|
||||
fields[0].GetCString(), tmBan.tm_year % 100, tmBan.tm_mon + 1, tmBan.tm_mday, tmBan.tm_hour, tmBan.tm_min,
|
||||
tmUnban.tm_year % 100, tmUnban.tm_mon + 1, tmUnban.tm_mday, tmUnban.tm_hour, tmUnban.tm_min,
|
||||
fields[3].GetCString(), fields[4].GetCString());
|
||||
}
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
|
||||
handler->SendSysMessage(" ===============================================================================");
|
||||
}
|
||||
@@ -737,26 +727,26 @@ public:
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case BAN_ACCOUNT:
|
||||
if (sBan->RemoveBanAccount(nameOrIP))
|
||||
handler->PSendSysMessage(LANG_UNBAN_UNBANNED, nameOrIP.c_str());
|
||||
else
|
||||
handler->PSendSysMessage(LANG_UNBAN_ERROR, nameOrIP.c_str());
|
||||
break;
|
||||
case BAN_CHARACTER:
|
||||
if (sBan->RemoveBanAccountByPlayerName(nameOrIP))
|
||||
handler->PSendSysMessage(LANG_UNBAN_UNBANNED, nameOrIP.c_str());
|
||||
else
|
||||
handler->PSendSysMessage(LANG_UNBAN_ERROR, nameOrIP.c_str());
|
||||
break;
|
||||
case BAN_IP:
|
||||
if (sBan->RemoveBanIP(nameOrIP))
|
||||
handler->PSendSysMessage(LANG_UNBAN_UNBANNED, nameOrIP.c_str());
|
||||
else
|
||||
handler->PSendSysMessage(LANG_UNBAN_ERROR, nameOrIP.c_str());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case BAN_ACCOUNT:
|
||||
if (sBan->RemoveBanAccount(nameOrIP))
|
||||
handler->PSendSysMessage(LANG_UNBAN_UNBANNED, nameOrIP.c_str());
|
||||
else
|
||||
handler->PSendSysMessage(LANG_UNBAN_ERROR, nameOrIP.c_str());
|
||||
break;
|
||||
case BAN_CHARACTER:
|
||||
if (sBan->RemoveBanAccountByPlayerName(nameOrIP))
|
||||
handler->PSendSysMessage(LANG_UNBAN_UNBANNED, nameOrIP.c_str());
|
||||
else
|
||||
handler->PSendSysMessage(LANG_UNBAN_ERROR, nameOrIP.c_str());
|
||||
break;
|
||||
case BAN_IP:
|
||||
if (sBan->RemoveBanIP(nameOrIP))
|
||||
handler->PSendSysMessage(LANG_UNBAN_UNBANNED, nameOrIP.c_str());
|
||||
else
|
||||
handler->PSendSysMessage(LANG_UNBAN_ERROR, nameOrIP.c_str());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user