[Quest API] Add CheckNameFilter to Perl/Lua. (#2175)

- Add quest::checknamefilter(name) to Perl.
- Add eq.check_name_filter(name) to Lua.
- Allows operators to check strings against the name filter for stuff like setting custom pet names, titles, suffixes, etc in scripts.
This commit is contained in:
Kinglykrab
2022-05-19 20:01:14 -04:00
committed by GitHub
parent 7c1a139991
commit 6398381c44
6 changed files with 65 additions and 62 deletions
+10 -4
View File
@@ -167,15 +167,21 @@ bool BotDatabase::LoadBotSpellCastingChances()
/* Bot functions */
bool BotDatabase::QueryNameAvailablity(const std::string& bot_name, bool& available_flag)
{
if (bot_name.empty() || bot_name.size() > 60 || !database.CheckUsedName(bot_name.c_str()))
if (bot_name.empty() || bot_name.size() > 60 || !database.CheckUsedName(bot_name))
return false;
query = StringFormat("SELECT `id` FROM `vw_bot_character_mobs` WHERE `name` LIKE '%s' LIMIT 1", bot_name.c_str());
query = fmt::format(
"SELECT `id` FROM `vw_bot_character_mobs` WHERE `name` LIKE '{}' LIMIT 1",
bot_name
);
auto results = database.QueryDatabase(query);
if (!results.Success())
if (!results.Success()) {
return false;
if (results.RowCount())
}
if (results.RowCount()) {
return true;
}
available_flag = true;