diff --git a/src/server/game/AI/NpcBots/bot_ai.cpp b/src/server/game/AI/NpcBots/bot_ai.cpp index 8df567f42fe5df..cb4e1f3754b1a2 100644 --- a/src/server/game/AI/NpcBots/bot_ai.cpp +++ b/src/server/game/AI/NpcBots/bot_ai.cpp @@ -9944,7 +9944,7 @@ bool bot_ai::OnGossipSelect(Player* player, Creature* creature/* == me*/, uint32 ItemTemplate const* set_item_proto = sObjectMgr->GetItemTemplate(itemset_items[i]); // validated at load if (!available_items.contains(itemset_items[i]) || available_items.at(itemset_items[i]).empty()) check_res = BotEquipResult::BOT_EQUIP_RESULT_FAIL_NO_ITEM; - else if (!_canEquip(set_item_proto, i, true, *available_items.at(itemset_items[i]).cbegin())) + else if (!_canEquip(set_item_proto, i, true, *available_items.at(itemset_items[i]).cbegin(), true)) check_res = BotEquipResult::BOT_EQUIP_RESULT_FAIL_CANT_EQUIP; else { @@ -9997,6 +9997,7 @@ bool bot_ai::OnGossipSelect(Player* player, Creature* creature/* == me*/, uint32 { std::string err_code = Bcore::ToString(uint32(AsUnderlyingType(res))); BotWhisper(LocalizedNpcText(player, BOT_TEXT_FAILED) + " -" + Bcore::ToString(uint32(i)) + " (" + err_code + ")"); + break; } } } @@ -12209,7 +12210,7 @@ void bot_ai::_autoLootCreature(Creature* creature) ////////// //EQUIPS// ////////// -bool bot_ai::_canUseOffHand(ItemTemplate const* with/* = nullptr*/) const +bool bot_ai::_canUseOffHand(ItemTemplate const* with/* = nullptr*/, bool ignore_mh/* = false*/) const { //bm can on only equip in main hand if (_botclass == BOT_CLASS_BM) @@ -12228,6 +12229,9 @@ bool bot_ai::_canUseOffHand(ItemTemplate const* with/* = nullptr*/) const if (_botclass == BOT_CLASS_WARRIOR && me->GetLevel() >= 60 && GetSpec() == BOT_SPEC_WARRIOR_FURY) return true; + if (ignore_mh) + return true; + ItemTemplate const* protoMH = with ? with : _equips[BOT_SLOT_MAINHAND] ? _equips[BOT_SLOT_MAINHAND]->GetTemplate() : nullptr; //no mainhand weapon OR @@ -12262,10 +12266,10 @@ bool bot_ai::_canUseRelic() const bool bot_ai::_canCombineWeapons(ItemTemplate const* mh, ItemTemplate const* oh) const { - return _canEquip(mh, BOT_SLOT_MAINHAND, true) && _canEquip(oh, BOT_SLOT_OFFHAND, true) && _canUseOffHand(mh); + return _canEquip(mh, BOT_SLOT_MAINHAND, true, nullptr, true) && _canEquip(oh, BOT_SLOT_OFFHAND, true, nullptr, true) && _canUseOffHand(mh); } -bool bot_ai::_canEquip(ItemTemplate const* newProto, uint8 slot, bool ignoreItemLevel, Item const* newItem) const +bool bot_ai::_canEquip(ItemTemplate const* newProto, uint8 slot, bool ignoreItemLevel, Item const* newItem/* = nullptr*/, bool ignore_combine/* = false*/) const { EquipmentInfo const* einfo = BotDataMgr::GetBotEquipmentInfo(me->GetEntry()); @@ -12283,7 +12287,7 @@ bool bot_ai::_canEquip(ItemTemplate const* newProto, uint8 slot, bool ignoreItem return false; } - if (slot == BOT_SLOT_OFFHAND && !_canUseOffHand()) + if (slot == BOT_SLOT_OFFHAND && !_canUseOffHand(nullptr, ignore_combine)) return false; //level requirements diff --git a/src/server/game/AI/NpcBots/bot_ai.h b/src/server/game/AI/NpcBots/bot_ai.h index f939d44a366b74..f80cb7b59c4625 100644 --- a/src/server/game/AI/NpcBots/bot_ai.h +++ b/src/server/game/AI/NpcBots/bot_ai.h @@ -639,11 +639,11 @@ class bot_ai : public CreatureAI void _autoLootCreatureItems(Player* receiver, Creature* creature, uint32 lootQualityMask, uint32 lootThreshold) const; void _autoLootCreature(Creature* creature); - bool _canUseOffHand(ItemTemplate const* with = nullptr) const; + bool _canUseOffHand(ItemTemplate const* with = nullptr, bool ignore_mh = false) const; bool _canUseRanged() const; bool _canUseRelic() const; bool _canCombineWeapons(ItemTemplate const* mh, ItemTemplate const* oh) const; - bool _canEquip(ItemTemplate const* newProto, uint8 slot, bool ignoreItemLevel, Item const* newItem = nullptr) const; + bool _canEquip(ItemTemplate const* newProto, uint8 slot, bool ignoreItemLevel, Item const* newItem = nullptr, bool ignore_combine = false) const; void _removeEquipment(uint8 slot); [[nodiscard]] BotEquipResult _unequip(uint8 slot, ObjectGuid receiver, bool store_to_bank, bool on_equip_from_bank = false); [[nodiscard]] BotEquipResult _equip(uint8 slot, Item* newItem, ObjectGuid receiver, bool store_to_bank, bool from_bank = false);