game,ui: add ContactEntry struct and Friends tab in social frame

Store structured friend data (online status, level, area, class) that
was previously discarded in handleFriendList/handleContactList. New
ContactEntry struct lives in game_handler.hpp; getContacts() exposes it.

UI: the O-key Social window (formerly guild-only) now has a Friends tab.
- Shows online/offline status dot, name, level, and AFK/DND label
- Pressing O when not in a guild opens Social directly on the Friends tab
- The window title changed from "Guild" to "Social" for accuracy
- Non-guild players no longer get a "not in a guild" rejection on O press
This commit is contained in:
Kelsi 2026-03-10 05:46:03 -07:00
parent f98cc32947
commit 7cd8e86d3b
4 changed files with 125 additions and 22 deletions

View file

@ -55,6 +55,24 @@ enum class QuestGiverStatus : uint8_t {
REWARD = 10 // ? (yellow)
};
/**
* A single contact list entry (friend, ignore, or mute).
*/
struct ContactEntry {
uint64_t guid = 0;
std::string name;
std::string note;
uint32_t flags = 0; // 0x1=friend, 0x2=ignore, 0x4=mute
uint8_t status = 0; // 0=offline, 1=online, 2=AFK, 3=DND
uint32_t areaId = 0;
uint32_t level = 0;
uint32_t classId = 0;
bool isFriend() const { return (flags & 0x1) != 0; }
bool isIgnored() const { return (flags & 0x2) != 0; }
bool isOnline() const { return status != 0; }
};
/**
* World connection state
*/
@ -800,6 +818,7 @@ public:
void leaveGroup();
bool isInGroup() const { return !partyData.isEmpty(); }
const GroupListData& getPartyData() const { return partyData; }
const std::vector<ContactEntry>& getContacts() const { return contacts_; }
bool hasPendingGroupInvite() const { return pendingGroupInvite; }
const std::string& getPendingInviterName() const { return pendingInviterName; }
@ -1662,11 +1681,12 @@ private:
std::unordered_map<uint32_t, GameObjectQueryResponseData> gameObjectInfoCache_;
std::unordered_set<uint32_t> pendingGameObjectQueries_;
// ---- Friend list cache ----
// ---- Friend/contact list cache ----
std::unordered_map<std::string, uint64_t> friendsCache; // name -> guid
std::unordered_set<uint64_t> friendGuids_; // all known friend GUIDs (for name backfill)
uint32_t lastContactListMask_ = 0;
uint32_t lastContactListCount_ = 0;
std::vector<ContactEntry> contacts_; // structured contact list (friends + ignores)
// ---- World state and faction initialization snapshots ----
uint32_t worldStateMapId_ = 0;

View file

@ -64,6 +64,7 @@ private:
bool showChatWindow = true;
bool showNameplates_ = true; // V key toggles nameplates
bool showPlayerInfo = false;
bool showSocialFrame_ = false; // O key toggles social/friends list
bool showGuildRoster_ = false;
std::string selectedGuildMember_;
bool showGuildNoteEdit_ = false;
@ -219,6 +220,7 @@ private:
void renderSharedQuestPopup(game::GameHandler& gameHandler);
void renderItemTextWindow(game::GameHandler& gameHandler);
void renderBuffBar(game::GameHandler& gameHandler);
void renderSocialFrame(game::GameHandler& gameHandler);
void renderLootWindow(game::GameHandler& gameHandler);
void renderGossipWindow(game::GameHandler& gameHandler);
void renderQuestDetailsWindow(game::GameHandler& gameHandler);