| 8812 | } |
| 8813 | |
| 8814 | void Bot::AddBotStartingItems(uint16 race_id, uint8 class_id) |
| 8815 | { |
| 8816 | if (!IsPlayerRace(race_id) || !IsPlayerClass(class_id)) { |
| 8817 | return; |
| 8818 | } |
| 8819 | |
| 8820 | const uint16 race_bitmask = GetPlayerRaceBit(race_id); |
| 8821 | const uint16 class_bitmask = GetPlayerClassBit(class_id); |
| 8822 | |
| 8823 | const auto& l = BotStartingItemsRepository::GetWhere( |
| 8824 | content_db, |
| 8825 | fmt::format( |
| 8826 | "(races & {} OR races = 0) AND " |
| 8827 | "(classes & {} OR classes = 0) {}", |
| 8828 | race_bitmask, |
| 8829 | class_bitmask, |
| 8830 | ContentFilterCriteria::apply() |
| 8831 | ) |
| 8832 | ); |
| 8833 | |
| 8834 | if (l.empty()) { |
| 8835 | return; |
| 8836 | } |
| 8837 | |
| 8838 | std::vector<BotInventoriesRepository::BotInventories> v; |
| 8839 | |
| 8840 | for (const auto& e : l) { |
| 8841 | if ( |
| 8842 | CanClassEquipItem(e.item_id) && |
| 8843 | (CanRaceEquipItem(e.item_id) || RuleB(Bots, AllowBotEquipAnyRaceGear)) |
| 8844 | ) { |
| 8845 | auto i = BotInventoriesRepository::NewEntity(); |
| 8846 | |
| 8847 | i.bot_id = GetBotID(); |
| 8848 | i.slot_id = e.slot_id; |
| 8849 | i.item_id = e.item_id; |
| 8850 | i.inst_charges = e.item_charges; |
| 8851 | i.augment_1 = e.augment_one; |
| 8852 | i.augment_2 = e.augment_two; |
| 8853 | i.augment_3 = e.augment_three; |
| 8854 | i.augment_4 = e.augment_four; |
| 8855 | i.augment_5 = e.augment_five; |
| 8856 | i.augment_6 = e.augment_six; |
| 8857 | |
| 8858 | v.emplace_back(i); |
| 8859 | } |
| 8860 | } |
| 8861 | |
| 8862 | if (!v.empty()) { |
| 8863 | BotInventoriesRepository::InsertMany(content_db, v); |
| 8864 | } |
| 8865 | } |
| 8866 | |
| 8867 | void Bot::SetSpellRecastTimer(uint16 spell_id, int32 recast_delay) { |
| 8868 | if (!IsValidSpell(spell_id)) { |
no test coverage detected