mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Restrict Death Knight random bot creation by expansion
This commit is contained in:
@@ -14,6 +14,8 @@ std::map<uint8, std::vector<uint8>> RandomPlayerbotFactory::availableRaces;
|
||||
|
||||
RandomPlayerbotFactory::RandomPlayerbotFactory(uint32 accountId) : accountId(accountId)
|
||||
{
|
||||
uint32 const expansion = sWorld->getIntConfig(CONFIG_EXPANSION);
|
||||
|
||||
availableRaces[CLASS_WARRIOR].push_back(RACE_HUMAN);
|
||||
availableRaces[CLASS_WARRIOR].push_back(RACE_NIGHTELF);
|
||||
availableRaces[CLASS_WARRIOR].push_back(RACE_GNOME);
|
||||
@@ -92,7 +94,8 @@ Player* RandomPlayerbotFactory::CreateRandomBot(WorldSession* session, uint8 cls
|
||||
|
||||
uint8 gender = rand() % 2 ? GENDER_MALE : GENDER_FEMALE;
|
||||
|
||||
uint8 race = availableRaces[cls][urand(0, availableRaces[cls].size() - 1)];
|
||||
uint32 const randomRaceIndex = urand(0, availableRaces[cls].size() - 1);
|
||||
uint8 race = availableRaces[cls][randomRaceIndex];
|
||||
|
||||
std::string name;
|
||||
if (names.empty())
|
||||
@@ -411,6 +414,14 @@ void RandomPlayerbotFactory::CreateRandomBots()
|
||||
if (!((1 << (cls - 1)) & CLASSMASK_ALL_PLAYABLE) || !sChrClassesStore.LookupEntry(cls))
|
||||
continue;
|
||||
|
||||
if (bool const isClassDeathKnight = cls == CLASS_DEATH_KNIGHT;
|
||||
isClassDeathKnight &&
|
||||
sWorld->getIntConfig(CONFIG_EXPANSION) !=
|
||||
EXPANSION_WRATH_OF_THE_LICH_KING)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cls != 10)
|
||||
if (Player* playerBot = factory.CreateRandomBot(session, cls, names))
|
||||
playerBots.emplace_back(playerBot, accountId);
|
||||
|
||||
Reference in New Issue
Block a user