[Bots] Remove hardcoded race-class combinations from bots. (#1375)

* [Bots] Remove hardcoded race-class combinations from bots.
- Allows server operators to directly influence via a database table the classes a specific bot race can be.
- Previously this was hardcoded and required a source modification to do.
- Allowed races, classes, and genders have been removed due to redundancy at this point.

* Remove const cast and modify saylink definition.
This commit is contained in:
Alex
2021-06-11 14:30:56 -04:00
committed by GitHub
parent 0461ac7912
commit c3456ebea0
10 changed files with 147 additions and 365 deletions
+14
View File
@@ -2952,6 +2952,20 @@ uint8 BotDatabase::GetSpellCastingChance(uint8 spell_type_index, uint8 class_ind
return Bot::spell_casting_chances[spell_type_index][class_index][stance_index][conditional_index];
}
uint16 BotDatabase::GetRaceClassBitmask(uint16 bot_race)
{
std::string query = fmt::format(
"SELECT `classes` FROM `bot_create_combinations` WHERE `race` = {}",
bot_race
);
auto results = database.QueryDatabase(query);
uint16 classes = 0;
if (results.RowCount() == 1) {
auto row = results.begin();
classes = atoi(row[0]);
}
return classes;
}
/* fail::Bot functions */
const char* BotDatabase::fail::QueryNameAvailablity() { return "Failed to query name availability"; }