From a97d339c91b5eb7418020d09dcf2606747360054 Mon Sep 17 00:00:00 2001 From: Yunfan Li Date: Wed, 11 Sep 2024 16:26:12 +0800 Subject: [PATCH] Name creation check --- src/RandomPlayerbotFactory.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/RandomPlayerbotFactory.cpp b/src/RandomPlayerbotFactory.cpp index 3aa003b4..8c350130 100644 --- a/src/RandomPlayerbotFactory.cpp +++ b/src/RandomPlayerbotFactory.cpp @@ -12,6 +12,7 @@ #include "PlayerbotFactory.h" #include "Playerbots.h" #include "ScriptMgr.h" +#include "SharedDefines.h" #include "SocialMgr.h" std::map> RandomPlayerbotFactory::availableRaces; @@ -245,8 +246,6 @@ Player* RandomPlayerbotFactory::CreateRandomBot(WorldSession* session, uint8 cls { player->learnSpell(50977, false); } - // player->SaveToDB(true, false); - // player->RewardQuest(const Quest *quest, uint32 reward, Object *questGiver) LOG_DEBUG("playerbots", "Random bot created for account {} - name: \"{}\"; race: {}; class: {}", accountId, name.c_str(), race, cls); @@ -424,7 +423,8 @@ void RandomPlayerbotFactory::CreateRandomBots() Field* fields = result->Fetch(); std::string name = fields[0].Get(); NameRaceAndGender raceAndGender = static_cast(fields[1].Get()); - nameCache[raceAndGender].push_back(name); + if (sObjectMgr->CheckPlayerName(name) == CHAR_NAME_SUCCESS) + nameCache[raceAndGender].push_back(name); } while (result->NextRow());