2017-01-25 16:39:00 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace Components
|
|
|
|
{
|
|
|
|
class Friends : public Component
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Friends();
|
|
|
|
~Friends();
|
|
|
|
|
|
|
|
static void UpdateFriends();
|
2017-01-29 09:10:54 -05:00
|
|
|
static void UpdateRank();
|
2018-12-17 08:29:18 -05:00
|
|
|
static void UpdateServer(Network::Address server, const std::string& hostname, const std::string& mapname);
|
2017-01-31 11:04:54 -05:00
|
|
|
static void UpdateName();
|
2017-01-25 16:39:00 -05:00
|
|
|
|
2018-12-17 08:29:18 -05:00
|
|
|
static void SetPresence(const std::string& key, const std::string& value);
|
|
|
|
static void ClearPresence(const std::string& key);
|
2017-01-29 15:49:48 -05:00
|
|
|
|
2017-02-16 21:27:38 -05:00
|
|
|
static void RequestPresence(SteamID user);
|
2018-12-17 08:29:18 -05:00
|
|
|
static std::string GetPresence(SteamID user, const std::string& key);
|
2017-02-16 21:27:38 -05:00
|
|
|
|
2017-02-16 13:44:21 -05:00
|
|
|
static void AddFriend(SteamID user);
|
|
|
|
|
2017-02-20 17:58:58 -05:00
|
|
|
static int GetGame(SteamID user);
|
|
|
|
|
2019-01-10 15:18:18 -05:00
|
|
|
static bool IsInvisible();
|
|
|
|
|
2022-04-12 17:15:50 -04:00
|
|
|
static Dvar::Var UIStreamFriendly;
|
|
|
|
static Dvar::Var CLAnonymous;
|
|
|
|
static Dvar::Var CLNotifyFriendState;
|
|
|
|
|
2017-01-25 16:39:00 -05:00
|
|
|
private:
|
2017-01-28 18:31:11 -05:00
|
|
|
#pragma pack(push, 4)
|
2017-01-25 16:39:00 -05:00
|
|
|
struct FriendRichPresenceUpdate
|
|
|
|
{
|
|
|
|
SteamID m_steamIDFriend; // friend who's rich presence has changed
|
|
|
|
int32_t m_nAppID; // the appID of the game (should always be the current game)
|
|
|
|
};
|
2017-01-28 18:31:11 -05:00
|
|
|
#pragma pack(pop)
|
2017-01-25 16:39:00 -05:00
|
|
|
|
2017-06-04 18:00:46 -04:00
|
|
|
struct AvatarImageLoaded
|
|
|
|
{
|
|
|
|
SteamID m_steamID; // steamid the avatar has been loaded for
|
|
|
|
int m_iImage; // the image index of the now loaded image
|
|
|
|
int m_iWide; // width of the loaded image
|
|
|
|
int m_iTall; // height of the loaded image
|
|
|
|
};
|
|
|
|
|
2017-01-25 16:39:00 -05:00
|
|
|
struct PersonaStateChange
|
|
|
|
{
|
|
|
|
SteamID m_ulSteamID; // steamID of the friend who changed
|
|
|
|
int m_nChangeFlags; // what's changed
|
|
|
|
};
|
|
|
|
|
|
|
|
class Friend
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SteamID userId;
|
2017-01-29 15:49:48 -05:00
|
|
|
SteamID guid;
|
2017-01-25 16:39:00 -05:00
|
|
|
std::string name;
|
2017-01-29 11:16:09 -05:00
|
|
|
std::string playerName;
|
2017-01-31 12:16:30 -05:00
|
|
|
std::string cleanName;
|
2017-01-25 16:39:00 -05:00
|
|
|
Network::Address server;
|
2017-01-29 11:16:09 -05:00
|
|
|
std::string serverName;
|
2017-02-12 16:55:45 -05:00
|
|
|
std::string mapname;
|
2017-01-25 16:39:00 -05:00
|
|
|
bool online;
|
2017-01-31 04:20:28 -05:00
|
|
|
unsigned int lastTime;
|
2017-01-26 06:42:42 -05:00
|
|
|
int experience;
|
|
|
|
int prestige;
|
2017-01-25 16:39:00 -05:00
|
|
|
};
|
|
|
|
|
2017-02-19 05:38:18 -05:00
|
|
|
static bool LoggedOn;
|
2017-01-31 12:16:30 -05:00
|
|
|
static bool TriggerSort;
|
2017-01-31 11:04:54 -05:00
|
|
|
static bool TriggerUpdate;
|
2017-01-30 15:54:34 -05:00
|
|
|
static int InitialState;
|
2017-01-25 16:39:00 -05:00
|
|
|
static unsigned int CurrentFriend;
|
|
|
|
static std::recursive_mutex Mutex;
|
|
|
|
static std::vector<Friend> FriendsList;
|
|
|
|
|
2017-01-29 11:16:09 -05:00
|
|
|
static void ClearServer();
|
|
|
|
static void SetServer();
|
|
|
|
|
2017-01-29 15:49:48 -05:00
|
|
|
static bool IsClientInParty(int controller, int clientNum);
|
|
|
|
|
2017-01-25 16:39:00 -05:00
|
|
|
static void UpdateUserInfo(SteamID user);
|
2017-01-31 11:04:54 -05:00
|
|
|
static void UpdateState(bool force = false);
|
2017-01-25 16:39:00 -05:00
|
|
|
|
2017-01-31 12:16:30 -05:00
|
|
|
static void SortList(bool force = false);
|
2017-01-29 11:16:09 -05:00
|
|
|
static void SortIndividualList(std::vector<Friend>* list);
|
|
|
|
|
2017-01-25 16:39:00 -05:00
|
|
|
static unsigned int GetFriendCount();
|
|
|
|
static const char* GetFriendText(unsigned int index, int column);
|
|
|
|
static void SelectFriend(unsigned int index);
|
2017-01-31 04:20:28 -05:00
|
|
|
|
|
|
|
static void UpdateTimeStamp();
|
|
|
|
|
2017-01-31 09:35:34 -05:00
|
|
|
static bool IsOnline(unsigned __int64 timeStamp);
|
2017-01-31 11:53:59 -05:00
|
|
|
|
|
|
|
static void StoreFriendsList();
|
2017-02-20 17:58:58 -05:00
|
|
|
|
|
|
|
static void SetRawPresence(const char* key, const char* value);
|
|
|
|
static std::vector<int> GetAppIdList();
|
2017-06-05 06:53:26 -04:00
|
|
|
|
|
|
|
static Game::Material* CreateAvatar(SteamID user);
|
2017-01-25 16:39:00 -05:00
|
|
|
};
|
|
|
|
}
|