mirror of
https://github.com/mod-playerbots/mod-playerbots
synced 2025-11-29 15:58:20 +08:00
Add check to make sure there are races available for a class
This commit is contained in:
@@ -165,6 +165,13 @@ Player* RandomPlayerbotFactory::CreateRandomBot(WorldSession* session, uint8 cls
|
|||||||
raceOptions.push_back(race);
|
raceOptions.push_back(race);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (raceOptions.size() == 0)
|
||||||
|
{
|
||||||
|
LOG_ERROR("playerbots", "No race available for class: {}", cls);
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
uint8 race = raceOptions[urand(0, raceOptions.size() - 1)];
|
uint8 race = raceOptions[urand(0, raceOptions.size() - 1)];
|
||||||
|
|
||||||
const auto raceAndGender = CombineRaceAndGender(gender, race);
|
const auto raceAndGender = CombineRaceAndGender(gender, race);
|
||||||
|
|||||||
Reference in New Issue
Block a user