mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
[Bug Fix] Fix Bot Creation Issue (#4235)
# Notes - Creating bots was failing because were checking for `false` on `Database::CheckUsedName()` in `BotDatabase::QueryNameAvailability`. - `Database::CheckUsedName()` is now `Database::IsNameUsed()` and checks for both bots and character name usages. - We were checking for `false` which was always happening when there were no entries for the supplied name, meaning we were never allowed to create a bot.
This commit is contained in:
+1
-25
@@ -184,35 +184,11 @@ bool BotDatabase::QueryNameAvailablity(const std::string& bot_name, bool& availa
|
||||
if (
|
||||
bot_name.empty() ||
|
||||
bot_name.size() > 60 ||
|
||||
!database.CheckUsedName(bot_name)
|
||||
database.IsNameUsed(bot_name)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto& bot_data = BotDataRepository::GetWhere(
|
||||
database,
|
||||
fmt::format(
|
||||
"`name` LIKE '{}' LIMIT 1",
|
||||
bot_name
|
||||
)
|
||||
);
|
||||
|
||||
if (!bot_data.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto& character_data = CharacterDataRepository::GetWhere(
|
||||
database,
|
||||
fmt::format(
|
||||
"`name` LIKE '{}' LIMIT 1",
|
||||
bot_name
|
||||
)
|
||||
);
|
||||
|
||||
if (!character_data.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
available_flag = true;
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user