iw4x-client/src/Components/Modules/Friends.hpp

107 lines
2.6 KiB
C++
Raw Normal View History

#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();
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);
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;
private:
#pragma pack(push, 4)
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)
};
#pragma pack(pop)
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
};
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;
std::string name;
std::string playerName;
2017-01-31 12:16:30 -05:00
std::string cleanName;
Network::Address server;
std::string serverName;
std::string mapname;
bool online;
unsigned int lastTime;
2017-01-26 06:42:42 -05:00
int experience;
int prestige;
};
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;
static unsigned int CurrentFriend;
static std::recursive_mutex Mutex;
static std::vector<Friend> FriendsList;
static void ClearServer();
static void SetServer();
2017-01-29 15:49:48 -05:00
static bool IsClientInParty(int controller, int clientNum);
static void UpdateUserInfo(SteamID user);
static void UpdateState();
2017-01-31 12:16:30 -05:00
static void SortList(bool force = false);
static void SortIndividualList(std::vector<Friend>* list);
static unsigned int GetFriendCount();
static const char* GetFriendText(unsigned int index, int column);
static void SelectFriend(unsigned int index);
static void UpdateTimeStamp();
static bool IsOnline(unsigned __int64 timeStamp);
static void StoreFriendsList();
static void SetRawPresence(const char* key, const char* value);
static std::vector<int> GetAppIdList();
static Game::Material* CreateAvatar(SteamID user);
};
}