feat(Core/Common): delete old Tokenizer (#10121)

This commit is contained in:
Kargatum
2022-01-21 14:59:05 +07:00
committed by GitHub
parent a25ef74de3
commit 6d7f58e6ed
24 changed files with 284 additions and 225 deletions

View File

@@ -263,8 +263,8 @@ public:
uint32 accountId = handler->GetSession()->GetAccountId();
int expansion = atoi(exp); //get int anyway (0 if error)
if (expansion < 0 || uint8(expansion) > sWorld->getIntConfig(CONFIG_EXPANSION))
auto expansion = Acore::StringTo<uint8>(exp); //get int anyway (0 if error)
if (!expansion || *expansion > sWorld->getIntConfig(CONFIG_EXPANSION))
{
handler->SendSysMessage(LANG_IMPROPER_VALUE);
handler->SetSentErrorMessage(true);
@@ -273,12 +273,12 @@ public:
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_EXPANSION);
stmt->setUInt8(0, uint8(expansion));
stmt->setUInt8(0, *expansion);
stmt->setUInt32(1, accountId);
LoginDatabase.Execute(stmt);
handler->PSendSysMessage(LANG_ACCOUNT_ADDON, expansion);
handler->PSendSysMessage(LANG_ACCOUNT_ADDON, *expansion);
return true;
}
@@ -756,18 +756,18 @@ public:
handler->HasLowerSecurityAccount(nullptr, accountId, true))
return false;
int expansion = atoi(exp); //get int anyway (0 if error)
if (expansion < 0 || uint8(expansion) > sWorld->getIntConfig(CONFIG_EXPANSION))
auto expansion = Acore::StringTo<uint8>(exp); //get int anyway (0 if error)
if (!expansion || *expansion > sWorld->getIntConfig(CONFIG_EXPANSION))
return false;
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_EXPANSION);
stmt->setUInt8(0, expansion);
stmt->setUInt8(0, *expansion);
stmt->setUInt32(1, accountId);
LoginDatabase.Execute(stmt);
handler->PSendSysMessage(LANG_ACCOUNT_SETADDON, accountName.c_str(), accountId, expansion);
handler->PSendSysMessage(LANG_ACCOUNT_SETADDON, accountName.c_str(), accountId, *expansion);
return true;
}
@@ -809,7 +809,7 @@ public:
}
// Check for invalid specified GM level.
gm = (isAccountNameGiven) ? atoi(arg2) : atoi(arg1);
gm = (isAccountNameGiven) ? Acore::StringTo<int32>(arg2).value_or(0) : Acore::StringTo<int32>(arg1).value_or(0);
if (gm > SEC_CONSOLE)
{
handler->SendSysMessage(LANG_BAD_VALUE);
@@ -819,7 +819,7 @@ public:
// handler->getSession() == nullptr only for console
targetAccountId = (isAccountNameGiven) ? AccountMgr::GetId(targetAccountName) : handler->getSelectedPlayer()->GetSession()->GetAccountId();
int32 gmRealmID = (isAccountNameGiven) ? atoi(arg3) : atoi(arg2);
int32 gmRealmID = (isAccountNameGiven) ? Acore::StringTo<int32>(arg3).value_or(0) : Acore::StringTo<int32>(arg2).value_or(0);
uint32 playerSecurity;
if (handler->GetSession())
playerSecurity = AccountMgr::GetSecurity(handler->GetSession()->GetAccountId(), gmRealmID);

View File

@@ -120,7 +120,7 @@ public:
if (isNumeric(searchString.c_str()))
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_DEL_INFO_BY_GUID);
stmt->setUInt32(0, uint32(atoi(searchString.c_str())));
stmt->setUInt32(0, *Acore::StringTo<uint32>(searchString));
result = CharacterDatabase.Query(stmt);
}
// search by name