feat: add WotLK equipment set UI to character screen

- Expose equipment sets via public EquipmentSetInfo getter
- Populate equipmentSetInfo_ from handleEquipmentSetList()
- Implement useEquipmentSet() sending CMSG_EQUIPMENT_SET_USE
- Add "Outfits" tab in character screen listing saved sets with Equip button
This commit is contained in:
Kelsi 2026-03-12 17:48:08 -07:00
parent 882cb1bae3
commit 6df8c72cf7
3 changed files with 58 additions and 0 deletions

View file

@ -1252,6 +1252,16 @@ public:
void sendLootRoll(uint64_t objectGuid, uint32_t slot, uint8_t rollType);
// rollType: 0=need, 1=greed, 2=disenchant, 96=pass
// Equipment Sets (WotLK): saved gear loadouts
struct EquipmentSetInfo {
uint64_t setGuid = 0;
uint32_t setId = 0;
std::string name;
std::string iconName;
};
const std::vector<EquipmentSetInfo>& getEquipmentSets() const { return equipmentSetInfo_; }
void useEquipmentSet(uint32_t setId);
// NPC Gossip
void interactWithNpc(uint64_t guid);
void interactWithGameObject(uint64_t guid);
@ -2840,6 +2850,7 @@ private:
std::array<uint64_t, 19> itemGuids{};
};
std::vector<EquipmentSet> equipmentSets_;
std::vector<EquipmentSetInfo> equipmentSetInfo_; // public-facing copy
// ---- Forced faction reactions (SMSG_SET_FORCED_REACTIONS) ----
std::unordered_map<uint32_t, uint8_t> forcedReactions_; // factionId -> reaction tier

View file

@ -7914,6 +7914,14 @@ void GameHandler::sendRequestVehicleExit() {
vehicleId_ = 0; // Optimistically clear; server will confirm via SMSG_PLAYER_VEHICLE_DATA(0)
}
void GameHandler::useEquipmentSet(uint32_t setId) {
if (state != WorldState::IN_WORLD) return;
// CMSG_EQUIPMENT_SET_USE: uint32 setId
network::Packet pkt(wireOpcode(Opcode::CMSG_EQUIPMENT_SET_USE));
pkt.writeUInt32(setId);
socket->send(pkt);
}
void GameHandler::sendMinimapPing(float wowX, float wowY) {
if (state != WorldState::IN_WORLD) return;
@ -20633,6 +20641,17 @@ void GameHandler::handleEquipmentSetList(network::Packet& packet) {
}
equipmentSets_.push_back(std::move(es));
}
// Populate public-facing info
equipmentSetInfo_.clear();
equipmentSetInfo_.reserve(equipmentSets_.size());
for (const auto& es : equipmentSets_) {
EquipmentSetInfo info;
info.setGuid = es.setGuid;
info.setId = es.setId;
info.name = es.name;
info.iconName = es.iconName;
equipmentSetInfo_.push_back(std::move(info));
}
LOG_INFO("SMSG_EQUIPMENT_SET_LIST: ", equipmentSets_.size(), " equipment sets received");
}

View file

@ -1342,6 +1342,34 @@ void InventoryScreen::renderCharacterScreen(game::GameHandler& gameHandler) {
ImGui::EndTabItem();
}
// Equipment Sets tab (WotLK only)
const auto& eqSets = gameHandler.getEquipmentSets();
if (!eqSets.empty()) {
if (ImGui::BeginTabItem("Outfits")) {
ImGui::Spacing();
ImGui::TextDisabled("Saved Equipment Sets");
ImGui::Separator();
ImGui::BeginChild("##EqSetsList", ImVec2(0, 0), false);
for (const auto& es : eqSets) {
ImGui::PushID(static_cast<int>(es.setId));
// Icon placeholder or name
const char* displayName = es.name.empty() ? "(Unnamed)" : es.name.c_str();
ImGui::Text("%s", displayName);
if (!es.iconName.empty()) {
ImGui::SameLine();
ImGui::TextDisabled("(%s)", es.iconName.c_str());
}
ImGui::SameLine(ImGui::GetContentRegionAvail().x - 60.0f);
if (ImGui::SmallButton("Equip")) {
gameHandler.useEquipmentSet(es.setId);
}
ImGui::PopID();
}
ImGui::EndChild();
ImGui::EndTabItem();
}
}
ImGui::EndTabBar();
}