diff --git a/src/server/game/AI/NpcBots/bot_ai.cpp b/src/server/game/AI/NpcBots/bot_ai.cpp index d0d16d6a46ea1..5eecbe815c52f 100644 --- a/src/server/game/AI/NpcBots/bot_ai.cpp +++ b/src/server/game/AI/NpcBots/bot_ai.cpp @@ -10007,7 +10007,8 @@ bool bot_ai::OnGossipSelect(Player* player, Creature* creature/* == me*/, uint32 AddGossipItemFor(player, GOSSIP_ICON_TALK, LocalizedNpcText(player, BOT_TEXT_DEPOSIT_ITEMS), GOSSIP_SENDER_EQUIPMENT_BANK_DEPOSIT, GOSSIP_ACTION_INFO_DEF + 0); AddGossipItemFor(player, GOSSIP_ICON_TALK, LocalizedNpcText(player, BOT_TEXT_WITHDRAW_ITEMS), GOSSIP_SENDER_EQUIPMENT_BANK_WITHDRAW, GOSSIP_ACTION_INFO_DEF + 0); - AddGossipItemFor(player, GOSSIP_ICON_TALK, LocalizedNpcText(player, BOT_TEXT_EQUIPMENT_SETS) + "...", GOSSIP_SENDER_EQUIPMENT_BANK_SETS_MENU, GOSSIP_ACTION_INFO_DEF + 0); + if (BotMgr::GetGearBankEquipmentSetsCount() > 0) + AddGossipItemFor(player, GOSSIP_ICON_TALK, LocalizedNpcText(player, BOT_TEXT_EQUIPMENT_SETS) + "...", GOSSIP_SENDER_EQUIPMENT_BANK_SETS_MENU, GOSSIP_ACTION_INFO_DEF + 0); AddGossipItemFor(player, GOSSIP_ICON_CHAT, LocalizedNpcText(player, BOT_TEXT_BACK), GOSSIP_SENDER_EQUIPMENT, GOSSIP_ACTION_INFO_DEF + 1); break; } @@ -10103,7 +10104,8 @@ bool bot_ai::OnGossipSelect(Player* player, Creature* creature/* == me*/, uint32 { subMenu = true; - AddGossipItemFor(player, GOSSIP_ICON_CHAT, LocalizedNpcText(player, BOT_TEXT_CREATE) + "...", GOSSIP_SENDER_EQUIPMENT_BANK_SET_CREATE, GOSSIP_ACTION_INFO_DEF + 0, "", 0, true); + if (BotDataMgr::GetBotItemSetsCount(player->GetGUID()) < BotMgr::GetGearBankEquipmentSetsCount()) + AddGossipItemFor(player, GOSSIP_ICON_CHAT, LocalizedNpcText(player, BOT_TEXT_CREATE) + "...", GOSSIP_SENDER_EQUIPMENT_BANK_SET_CREATE, GOSSIP_ACTION_INFO_DEF + 0, "", 0, true); //list existing sets if (BotItemSetsArray const* itemSets = BotDataMgr::GetBotItemSets(player->GetGUID())) diff --git a/src/server/game/AI/NpcBots/botdatamgr.cpp b/src/server/game/AI/NpcBots/botdatamgr.cpp index 530c92b3c787a..e41312ef2bce2 100644 --- a/src/server/game/AI/NpcBots/botdatamgr.cpp +++ b/src/server/game/AI/NpcBots/botdatamgr.cpp @@ -3248,6 +3248,13 @@ void BotDataMgr::SaveNpcBotStoredGear(ObjectGuid playerGuid, CharacterDatabaseTr } } +uint32 BotDataMgr::GetBotItemSetsCount(ObjectGuid playerGuid) +{ + if (BotItemSetsArray const* item_sets = GetBotItemSets(playerGuid)) + return std::ranges::count_if(NPCBots::index_array, [=](uint8 i) { return !!item_sets->at(i); }); + return 0; +} + BotItemSetsArray const* BotDataMgr::GetBotItemSets(ObjectGuid playerGuid) { decltype(_botStoredGearSetMap)::const_iterator sci = _botStoredGearSetMap.find(playerGuid); diff --git a/src/server/game/AI/NpcBots/botdatamgr.h b/src/server/game/AI/NpcBots/botdatamgr.h index 8e63cc9f9f330..ff0036fa97c3a 100644 --- a/src/server/game/AI/NpcBots/botdatamgr.h +++ b/src/server/game/AI/NpcBots/botdatamgr.h @@ -267,6 +267,7 @@ class BotDataMgr static void DepositBotBankItem(ObjectGuid playerGuid, Item* item); static void SaveNpcBotStoredGear(ObjectGuid playerGuid, CharacterDatabaseTransaction trans); + static uint32 GetBotItemSetsCount(ObjectGuid playerGuid); static BotItemSetsArray const* GetBotItemSets(ObjectGuid playerGuid); static NpcBotItemSet const* GetBotItemSet(ObjectGuid playerGuid, uint8 set_id); static NpcBotItemSet& CreateNewBotItemSet(ObjectGuid playerGuid);