From bbb35f2ee489e68f2eab3b6e34c8b51c2b8a737b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E4=BD=A9=E8=8C=B9?= Date: Mon, 4 Apr 2022 08:55:03 -0600 Subject: [PATCH] Port fixes until 774db31 - arena emblems, fix non-usable classes, disable multi-thread account delete --- src/RandomPlayerbotFactory.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/RandomPlayerbotFactory.cpp b/src/RandomPlayerbotFactory.cpp index 6a456f97..d961b290 100644 --- a/src/RandomPlayerbotFactory.cpp +++ b/src/RandomPlayerbotFactory.cpp @@ -289,18 +289,19 @@ void RandomPlayerbotFactory::CreateRandomBots() } } else - dels.push_back(std::async([accId] - { - AccountMgr::DeleteAccount(accId); - })); + AccountMgr::DeleteAccount(accId); +// dels.push_back(std::async([accId] +// { +// AccountMgr::DeleteAccount(accId); +// })); } while (results->NextRow()); } - for (uint32 i = 0; i < dels.size(); i++) + /* for (uint32 i = 0; i < dels.size(); i++) { dels[i].wait(); - } + }*/ PlayerbotsDatabase.Execute(PlayerbotsDatabase.GetPreparedStatement(PLAYERBOTS_DEL_RANDOM_BOTS)); @@ -406,6 +407,10 @@ void RandomPlayerbotFactory::CreateRandomBots() for (uint8 cls = CLASS_WARRIOR; cls < MAX_CLASSES - count; ++cls) { + // skip nonexistent classes + if (!((1 << (cls - 1)) & CLASSMASK_ALL_PLAYABLE) || !sChrClassesStore.LookupEntry(cls)) + continue; + if (cls != 10) if (Player* playerBot = factory.CreateRandomBot(session, cls, names)) playerBots.emplace_back(playerBot, accountId); @@ -680,7 +685,7 @@ void RandomPlayerbotFactory::CreateRandomArenaTeams() // set random emblem uint32 backgroundColor = urand(0xFF000000, 0xFFFFFFFF); - uint32 emblemStyle = urand(0, 5); + uint32 emblemStyle = urand(0, 101); uint32 emblemColor = urand(0xFF000000, 0xFFFFFFFF); uint32 borderStyle = urand(0, 5); uint32 borderColor = urand(0xFF000000, 0xFFFFFFFF);