mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Update RandomPlayerbotFactory.cpp
code cleanup
This commit is contained in:
@@ -117,7 +117,6 @@ RandomPlayerbotFactory::RandomPlayerbotFactory(uint32 accountId) : accountId(acc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Player* RandomPlayerbotFactory::CreateRandomBot(WorldSession* session, uint8 cls, std::unordered_map<uint8, std::vector<std::string>> names)
|
|
||||||
Player* RandomPlayerbotFactory::CreateRandomBot(WorldSession* session, uint8 cls)
|
Player* RandomPlayerbotFactory::CreateRandomBot(WorldSession* session, uint8 cls)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("playerbots", "Creating new random bot for class {}", cls);
|
LOG_DEBUG("playerbots", "Creating new random bot for class {}", cls);
|
||||||
@@ -131,28 +130,7 @@ Player* RandomPlayerbotFactory::CreateRandomBot(WorldSession* session, uint8 cls
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::string name;
|
std::string name = CreateRandomBotName(gender);
|
||||||
// int tries = 10;
|
|
||||||
// while (tries--) {
|
|
||||||
// std::string cur_name;
|
|
||||||
// if (names.empty())
|
|
||||||
name = CreateRandomBotName(gender);
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// if (names[gender].empty())
|
|
||||||
// return nullptr;
|
|
||||||
|
|
||||||
// uint32 i = urand(0, names[gender].size() - 1);
|
|
||||||
// cur_name = names[gender][i];
|
|
||||||
// std::swap(names[gender][i], names[gender].back());
|
|
||||||
// names[gender].pop_back();
|
|
||||||
// }
|
|
||||||
// if (ObjectMgr::CheckPlayerName(name) != CHAR_NAME_SUCCESS)
|
|
||||||
// {
|
|
||||||
// name.clear();
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (name.empty()) {
|
if (name.empty()) {
|
||||||
LOG_ERROR("playerbots", "Unable to get random bot name!");
|
LOG_ERROR("playerbots", "Unable to get random bot name!");
|
||||||
@@ -417,7 +395,6 @@ void RandomPlayerbotFactory::CreateRandomBots()
|
|||||||
uint32 totalRandomBotChars = 0;
|
uint32 totalRandomBotChars = 0;
|
||||||
uint32 totalCharCount = sPlayerbotAIConfig->randomBotAccountCount * 10;
|
uint32 totalCharCount = sPlayerbotAIConfig->randomBotAccountCount * 10;
|
||||||
|
|
||||||
//std::unordered_map<uint8,std::vector<std::string>> names;
|
|
||||||
std::vector<std::pair<Player*, uint32>> playerBots;
|
std::vector<std::pair<Player*, uint32>> playerBots;
|
||||||
std::vector<WorldSession*> sessionBots;
|
std::vector<WorldSession*> sessionBots;
|
||||||
int bot_creation = 0;
|
int bot_creation = 0;
|
||||||
@@ -464,7 +441,6 @@ void RandomPlayerbotFactory::CreateRandomBots()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (cls != 10) {
|
if (cls != 10) {
|
||||||
//if (Player* playerBot = factory.CreateRandomBot(session, cls, names)) {
|
|
||||||
if (Player* playerBot = factory.CreateRandomBot(session, cls)) {
|
if (Player* playerBot = factory.CreateRandomBot(session, cls)) {
|
||||||
playerBot->SaveToDB(true, false);
|
playerBot->SaveToDB(true, false);
|
||||||
sCharacterCache->AddCharacterCacheEntry(playerBot->GetGUID(), accountId, playerBot->GetName(),
|
sCharacterCache->AddCharacterCacheEntry(playerBot->GetGUID(), accountId, playerBot->GetName(),
|
||||||
|
|||||||
Reference in New Issue
Block a user