2017-01-25 16:39:00 -05:00
|
|
|
#include "STDInclude.hpp"
|
|
|
|
|
|
|
|
namespace Components
|
|
|
|
{
|
2017-02-19 05:38:18 -05:00
|
|
|
bool Friends::LoggedOn = false;
|
2017-01-31 12:16:30 -05:00
|
|
|
bool Friends::TriggerSort = false;
|
2017-01-31 11:04:54 -05:00
|
|
|
bool Friends::TriggerUpdate = false;
|
2017-01-31 12:16:30 -05:00
|
|
|
|
2017-01-30 15:54:34 -05:00
|
|
|
int Friends::InitialState;
|
2017-01-25 16:39:00 -05:00
|
|
|
unsigned int Friends::CurrentFriend;
|
|
|
|
std::recursive_mutex Friends::Mutex;
|
|
|
|
std::vector<Friends::Friend> Friends::FriendsList;
|
|
|
|
|
2017-01-29 11:16:09 -05:00
|
|
|
void Friends::SortIndividualList(std::vector<Friends::Friend>* list)
|
|
|
|
{
|
2017-07-12 07:39:45 -04:00
|
|
|
std::stable_sort(list->begin(), list->end(), [](Friends::Friend const& friend1, Friends::Friend const& friend2)
|
2017-01-29 11:16:09 -05:00
|
|
|
{
|
2017-06-08 11:55:27 -04:00
|
|
|
return friend1.cleanName.compare(friend2.cleanName) < 0;
|
2017-01-29 11:16:09 -05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-01-31 12:16:30 -05:00
|
|
|
void Friends::SortList(bool force)
|
2017-01-29 11:16:09 -05:00
|
|
|
{
|
2017-06-14 06:06:04 -04:00
|
|
|
if (!force)
|
2017-01-31 12:16:30 -05:00
|
|
|
{
|
|
|
|
Friends::TriggerSort = true;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-01-29 11:16:09 -05:00
|
|
|
std::lock_guard<std::recursive_mutex> _(Friends::Mutex);
|
|
|
|
|
2017-01-29 12:06:48 -05:00
|
|
|
std::vector<Friends::Friend> connectedList;
|
2017-01-29 11:16:09 -05:00
|
|
|
std::vector<Friends::Friend> playingList;
|
|
|
|
std::vector<Friends::Friend> onlineList;
|
|
|
|
std::vector<Friends::Friend> offlineList;
|
|
|
|
|
|
|
|
// Split up the list
|
2017-06-14 06:06:04 -04:00
|
|
|
for (auto entry : Friends::FriendsList)
|
2017-01-29 11:16:09 -05:00
|
|
|
{
|
2017-06-14 06:06:04 -04:00
|
|
|
if (!entry.online) offlineList.push_back(entry);
|
|
|
|
else if (!Friends::IsOnline(entry.lastTime)) onlineList.push_back(entry);
|
2017-01-30 15:13:30 -05:00
|
|
|
else if (entry.server.getType() == Game::NA_BAD) playingList.push_back(entry);
|
|
|
|
else connectedList.push_back(entry);
|
2017-01-29 11:16:09 -05:00
|
|
|
}
|
|
|
|
|
2017-01-29 12:06:48 -05:00
|
|
|
Friends::SortIndividualList(&connectedList);
|
2017-01-29 11:16:09 -05:00
|
|
|
Friends::SortIndividualList(&playingList);
|
|
|
|
Friends::SortIndividualList(&onlineList);
|
|
|
|
Friends::SortIndividualList(&offlineList);
|
|
|
|
|
2017-01-31 10:20:49 -05:00
|
|
|
size_t count = Friends::FriendsList.size();
|
2017-01-29 11:16:09 -05:00
|
|
|
Friends::FriendsList.clear();
|
2017-01-31 10:20:49 -05:00
|
|
|
Friends::FriendsList.reserve(count);
|
2017-01-29 11:16:09 -05:00
|
|
|
|
2017-01-29 12:06:48 -05:00
|
|
|
Utils::Merge(&Friends::FriendsList, connectedList);
|
2017-01-29 11:16:09 -05:00
|
|
|
Utils::Merge(&Friends::FriendsList, playingList);
|
|
|
|
Utils::Merge(&Friends::FriendsList, onlineList);
|
|
|
|
Utils::Merge(&Friends::FriendsList, offlineList);
|
|
|
|
}
|
|
|
|
|
2017-01-25 16:39:00 -05:00
|
|
|
void Friends::UpdateUserInfo(SteamID user)
|
|
|
|
{
|
2017-01-30 15:13:30 -05:00
|
|
|
std::lock_guard<std::recursive_mutex> _(Friends::Mutex);
|
|
|
|
|
|
|
|
auto entry = std::find_if(Friends::FriendsList.begin(), Friends::FriendsList.end(), [user](Friends::Friend entry)
|
|
|
|
{
|
2017-02-18 03:42:55 -05:00
|
|
|
return (entry.userId.bits == user.bits);
|
2017-01-30 15:13:30 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
if (entry == Friends::FriendsList.end() || !Steam::Proxy::SteamFriends) return;
|
|
|
|
|
|
|
|
entry->name = Steam::Proxy::SteamFriends->GetFriendPersonaName(user);
|
|
|
|
entry->online = Steam::Proxy::SteamFriends->GetFriendPersonaState(user) != 0;
|
2017-01-31 12:16:30 -05:00
|
|
|
entry->cleanName = Utils::String::ToLower(Colors::Strip(entry->name));
|
2017-01-31 11:53:59 -05:00
|
|
|
|
2017-02-16 21:27:38 -05:00
|
|
|
std::string guid = Friends::GetPresence(user, "iw4x_guid");
|
|
|
|
std::string name = Friends::GetPresence(user, "iw4x_name");
|
|
|
|
std::string experience = Friends::GetPresence(user, "iw4x_experience");
|
|
|
|
std::string prestige = Friends::GetPresence(user, "iw4x_prestige");
|
2017-01-31 11:53:59 -05:00
|
|
|
|
2017-02-18 03:42:55 -05:00
|
|
|
if (!guid.empty()) entry->guid.bits = strtoull(guid.data(), nullptr, 16);
|
2017-01-31 11:53:59 -05:00
|
|
|
if (!name.empty()) entry->playerName = name;
|
|
|
|
if (!experience.empty()) entry->experience = atoi(experience.data());
|
|
|
|
if (!prestige.empty()) entry->prestige = atoi(prestige.data());
|
2017-01-28 18:31:11 -05:00
|
|
|
|
2017-02-16 21:27:38 -05:00
|
|
|
std::string server = Friends::GetPresence(user, "iw4x_server");
|
2017-01-30 15:13:30 -05:00
|
|
|
Network::Address oldAddress = entry->server;
|
|
|
|
|
2017-02-12 07:07:14 -05:00
|
|
|
bool gotOnline = Friends::IsOnline(entry->lastTime);
|
2017-02-16 21:27:38 -05:00
|
|
|
entry->lastTime = static_cast<unsigned int>(atoi(Friends::GetPresence(user, "iw4x_playing").data()));
|
2017-02-12 07:07:14 -05:00
|
|
|
gotOnline = !gotOnline && Friends::IsOnline(entry->lastTime);
|
2017-01-31 04:20:28 -05:00
|
|
|
|
2017-01-30 15:13:30 -05:00
|
|
|
if (server.empty())
|
|
|
|
{
|
|
|
|
entry->server.setType(Game::NA_BAD);
|
|
|
|
entry->serverName.clear();
|
|
|
|
}
|
|
|
|
else if (entry->server != server)
|
|
|
|
{
|
|
|
|
entry->server = server;
|
|
|
|
entry->serverName.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Block localhost
|
2017-02-08 08:45:02 -05:00
|
|
|
if (entry->server.getType() == Game::NA_LOOPBACK || (entry->server.getType() == Game::NA_IP && entry->server.getIP().full == 0x0100007F)) entry->server.setType(Game::NA_BAD);
|
|
|
|
else if (entry->server.getType() != Game::NA_BAD && entry->server != oldAddress)
|
2017-01-30 15:13:30 -05:00
|
|
|
{
|
2017-06-25 15:54:35 -04:00
|
|
|
Node::Add(entry->server);
|
2017-01-30 15:13:30 -05:00
|
|
|
Network::SendCommand(entry->server, "getinfo", Utils::Cryptography::Rand::GenerateChallenge());
|
|
|
|
}
|
2017-01-28 18:31:11 -05:00
|
|
|
|
2017-01-30 15:13:30 -05:00
|
|
|
Friends::SortList();
|
2017-02-12 07:07:14 -05:00
|
|
|
|
2017-02-12 14:36:38 -05:00
|
|
|
int notify = Dvar::Var("cl_notifyFriendState").get<int>();
|
2017-06-05 08:31:45 -04:00
|
|
|
if (gotOnline && (notify == -1 || (notify == 1 && !Game::CL_IsCgameInitialized())) && !Dvar::Var("ui_streamFriendly").get<bool>())
|
2017-02-12 07:07:14 -05:00
|
|
|
{
|
2017-06-05 06:53:26 -04:00
|
|
|
Game::Material* material = Friends::CreateAvatar(user);
|
|
|
|
Toast::Show(material, entry->name, "is playing IW4x", 3000, [material]()
|
|
|
|
{
|
|
|
|
Materials::Delete(material, true);
|
|
|
|
});
|
2017-02-12 07:07:14 -05:00
|
|
|
}
|
2017-01-25 16:39:00 -05:00
|
|
|
}
|
|
|
|
|
2017-01-31 11:04:54 -05:00
|
|
|
void Friends::UpdateState(bool force)
|
2017-01-29 09:10:54 -05:00
|
|
|
{
|
2017-02-18 11:26:14 -05:00
|
|
|
if (Dvar::Var("cl_anonymous").get<bool>() || !Steam::Enabled()) return;
|
2017-02-01 15:08:59 -05:00
|
|
|
|
2017-06-14 06:06:04 -04:00
|
|
|
if (force)
|
2017-01-30 15:13:30 -05:00
|
|
|
{
|
2017-02-17 18:02:42 -05:00
|
|
|
if (Steam::Proxy::ClientFriends && Steam::Proxy::SteamFriends)
|
2017-01-31 11:04:54 -05:00
|
|
|
{
|
2017-02-17 18:02:42 -05:00
|
|
|
int state = Steam::Proxy::SteamFriends->GetPersonaState();
|
|
|
|
Steam::Proxy::ClientFriends.invoke<void>("SetPersonaState", (state == 1 ? 2 : 1));
|
2017-01-31 11:04:54 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Friends::TriggerUpdate = true;
|
2017-01-30 15:13:30 -05:00
|
|
|
}
|
2017-01-29 09:10:54 -05:00
|
|
|
}
|
|
|
|
|
2017-02-12 16:55:45 -05:00
|
|
|
void Friends::UpdateServer(Network::Address server, std::string hostname, std::string mapname)
|
2017-01-29 11:16:09 -05:00
|
|
|
{
|
|
|
|
std::lock_guard<std::recursive_mutex> _(Friends::Mutex);
|
|
|
|
|
2017-06-14 06:06:04 -04:00
|
|
|
for (auto& entry : Friends::FriendsList)
|
2017-01-29 11:16:09 -05:00
|
|
|
{
|
2017-06-14 06:06:04 -04:00
|
|
|
if (entry.server == server)
|
2017-01-29 11:16:09 -05:00
|
|
|
{
|
|
|
|
entry.serverName = hostname;
|
2017-02-12 16:55:45 -05:00
|
|
|
entry.mapname = mapname;
|
2017-01-29 11:16:09 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-31 11:04:54 -05:00
|
|
|
void Friends::UpdateName()
|
|
|
|
{
|
|
|
|
Friends::SetPresence("iw4x_name", Steam::SteamFriends()->GetPersonaName());
|
|
|
|
Friends::UpdateState();
|
|
|
|
}
|
|
|
|
|
2017-02-20 17:58:58 -05:00
|
|
|
std::vector<int> Friends::GetAppIdList()
|
|
|
|
{
|
|
|
|
std::vector<int> ids;
|
|
|
|
|
2017-06-14 06:06:04 -04:00
|
|
|
const auto addId = [&](int id)
|
2017-02-20 17:58:58 -05:00
|
|
|
{
|
2017-06-14 06:06:04 -04:00
|
|
|
if (std::find(ids.begin(), ids.end(), id) == ids.end())
|
2017-02-20 17:58:58 -05:00
|
|
|
{
|
|
|
|
ids.push_back(id);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
addId(0);
|
|
|
|
addId(10190);
|
|
|
|
addId(480);
|
2017-02-20 18:16:23 -05:00
|
|
|
addId(Steam::Proxy::AppId);
|
2017-02-20 17:58:58 -05:00
|
|
|
|
|
|
|
if (Steam::Proxy::SteamUtils)
|
|
|
|
{
|
|
|
|
addId(Steam::Proxy::SteamUtils->GetAppID());
|
|
|
|
}
|
|
|
|
|
2017-06-14 06:06:04 -04:00
|
|
|
if (Steam::Proxy::SteamFriends)
|
2017-02-21 02:46:12 -05:00
|
|
|
{
|
|
|
|
std::lock_guard<std::recursive_mutex> _(Friends::Mutex);
|
|
|
|
|
2017-06-14 06:06:04 -04:00
|
|
|
const unsigned int modId = *reinterpret_cast<unsigned int*>("IW4x") | 0x80000000;
|
2017-02-21 02:46:12 -05:00
|
|
|
|
|
|
|
// Split up the list
|
|
|
|
for (auto entry : Friends::FriendsList)
|
|
|
|
{
|
|
|
|
Steam::FriendGameInfo info;
|
2017-06-14 06:06:04 -04:00
|
|
|
if (Steam::Proxy::SteamFriends->GetFriendGamePlayed(entry.userId, &info) && info.m_gameID.modID == modId)
|
2017-02-21 02:46:12 -05:00
|
|
|
{
|
|
|
|
addId(info.m_gameID.appID);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-20 17:58:58 -05:00
|
|
|
return ids;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Friends::SetRawPresence(const char* key, const char* value)
|
2017-01-29 11:16:09 -05:00
|
|
|
{
|
2017-02-17 05:59:16 -05:00
|
|
|
if (Steam::Proxy::ClientFriends)
|
2017-01-30 15:13:30 -05:00
|
|
|
{
|
2017-02-21 10:07:52 -05:00
|
|
|
// Set the presence for all possible apps that IW4x might have to interact with.
|
|
|
|
// GetFriendRichPresence only reads values for the app that we are running,
|
|
|
|
// therefore our friends (and we as well) have to set the presence for those apps.
|
2017-02-20 17:58:58 -05:00
|
|
|
auto appIds = Friends::GetAppIdList();
|
|
|
|
|
|
|
|
for (auto id : appIds)
|
|
|
|
{
|
|
|
|
Steam::Proxy::ClientFriends.invoke<void>("SetRichPresence", id, key, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Friends::ClearPresence(std::string key)
|
|
|
|
{
|
|
|
|
if (Steam::Proxy::ClientFriends && Steam::Proxy::SteamUtils)
|
|
|
|
{
|
|
|
|
Friends::SetRawPresence(key.data(), nullptr);
|
2017-01-30 15:13:30 -05:00
|
|
|
}
|
2017-01-29 11:16:09 -05:00
|
|
|
}
|
|
|
|
|
2017-01-29 15:49:48 -05:00
|
|
|
void Friends::SetPresence(std::string key, std::string value)
|
2017-01-29 11:16:09 -05:00
|
|
|
{
|
2017-02-20 17:58:58 -05:00
|
|
|
if (Steam::Proxy::ClientFriends && Steam::Proxy::SteamUtils && !Dvar::Var("cl_anonymous").get<bool>() && Steam::Enabled())
|
2017-01-30 15:13:30 -05:00
|
|
|
{
|
2017-02-20 17:58:58 -05:00
|
|
|
Friends::SetRawPresence(key.data(), value.data());
|
2017-01-30 15:13:30 -05:00
|
|
|
}
|
2017-01-29 15:49:48 -05:00
|
|
|
}
|
|
|
|
|
2017-02-16 21:27:38 -05:00
|
|
|
void Friends::RequestPresence(SteamID user)
|
|
|
|
{
|
2017-06-14 06:06:04 -04:00
|
|
|
if (Steam::Proxy::ClientFriends)
|
2017-02-16 21:27:38 -05:00
|
|
|
{
|
2017-02-20 17:58:58 -05:00
|
|
|
Steam::Proxy::ClientFriends.invoke<void>("RequestFriendRichPresence", Friends::GetGame(user), user);
|
2017-02-16 21:27:38 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string Friends::GetPresence(SteamID user, std::string key)
|
|
|
|
{
|
2017-02-20 17:58:58 -05:00
|
|
|
if (!Steam::Proxy::ClientFriends || !Steam::Proxy::SteamUtils) return "";
|
2017-02-16 21:27:38 -05:00
|
|
|
|
2017-02-20 17:58:58 -05:00
|
|
|
std::string result = Steam::Proxy::ClientFriends.invoke<const char*>("GetFriendRichPresence", Friends::GetGame(user), user, key.data());
|
2017-02-16 21:27:38 -05:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2017-01-29 15:49:48 -05:00
|
|
|
void Friends::SetServer()
|
|
|
|
{
|
|
|
|
Friends::SetPresence("iw4x_server", Network::Address(*Game::connectedHost).getString()); // reinterpret_cast<char*>(0x7ED3F8)
|
|
|
|
Friends::UpdateState();
|
|
|
|
}
|
2017-01-29 11:16:09 -05:00
|
|
|
|
2017-01-29 15:49:48 -05:00
|
|
|
void Friends::ClearServer()
|
|
|
|
{
|
|
|
|
Friends::ClearPresence("iw4x_server");
|
2017-01-29 11:16:09 -05:00
|
|
|
Friends::UpdateState();
|
|
|
|
}
|
|
|
|
|
2017-01-29 15:49:48 -05:00
|
|
|
bool Friends::IsClientInParty(int /*controller*/, int clientNum)
|
|
|
|
{
|
|
|
|
if (clientNum < 0 || clientNum >= ARRAYSIZE(Dedicated::PlayerGuids)) return false;
|
|
|
|
|
|
|
|
std::lock_guard<std::recursive_mutex> _(Friends::Mutex);
|
2017-02-17 06:26:07 -05:00
|
|
|
SteamID guid = Dedicated::PlayerGuids[clientNum][0];
|
2017-01-29 15:49:48 -05:00
|
|
|
|
|
|
|
for (auto entry : Friends::FriendsList)
|
|
|
|
{
|
2017-02-18 03:42:55 -05:00
|
|
|
if (entry.guid.bits == guid.bits && Friends::IsOnline(entry.lastTime) && entry.online)
|
2017-01-29 15:49:48 -05:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-01-29 09:10:54 -05:00
|
|
|
void Friends::UpdateRank()
|
|
|
|
{
|
2017-06-13 09:35:12 -04:00
|
|
|
static std::optional<int> levelVal;
|
2017-01-29 09:10:54 -05:00
|
|
|
|
|
|
|
int experience = Game::Live_GetXp(0);
|
|
|
|
int prestige = Game::Live_GetPrestige(0);
|
|
|
|
int level = (experience & 0xFFFFFF) | ((prestige & 0xFF) << 24);
|
|
|
|
|
2017-06-14 06:06:04 -04:00
|
|
|
if (!levelVal.has_value() || levelVal.value() != level)
|
2017-01-29 09:10:54 -05:00
|
|
|
{
|
2017-06-13 09:35:12 -04:00
|
|
|
levelVal.emplace(level);
|
2017-01-29 09:10:54 -05:00
|
|
|
|
2017-01-30 15:54:34 -05:00
|
|
|
Friends::SetPresence("iw4x_experience", Utils::String::VA("%d", experience));
|
|
|
|
Friends::SetPresence("iw4x_prestige", Utils::String::VA("%d", prestige));
|
2017-01-29 09:26:46 -05:00
|
|
|
Friends::UpdateState();
|
2017-01-29 09:10:54 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-25 16:39:00 -05:00
|
|
|
void Friends::UpdateFriends()
|
|
|
|
{
|
2017-01-30 15:13:30 -05:00
|
|
|
std::lock_guard<std::recursive_mutex> _(Friends::Mutex);
|
2017-02-19 05:38:18 -05:00
|
|
|
|
|
|
|
Friends::LoggedOn = (Steam::Proxy::SteamUser_ && Steam::Proxy::SteamUser_->LoggedOn());
|
2017-01-30 15:13:30 -05:00
|
|
|
if (!Steam::Proxy::SteamFriends) return;
|
2017-01-25 16:39:00 -05:00
|
|
|
|
2017-02-12 16:55:45 -05:00
|
|
|
Game::UI_UpdateArenas();
|
|
|
|
|
2017-01-30 15:13:30 -05:00
|
|
|
int count = Steam::Proxy::SteamFriends->GetFriendCount(4);
|
|
|
|
|
2017-01-31 11:53:59 -05:00
|
|
|
Proto::Friends::List list;
|
|
|
|
list.ParseFromString(Utils::IO::ReadFile("players/friends.dat"));
|
|
|
|
|
2017-02-12 07:07:14 -05:00
|
|
|
std::vector<Friends::Friend> steamFriends;
|
|
|
|
|
2017-01-30 15:13:30 -05:00
|
|
|
for (int i = 0; i < count; ++i)
|
|
|
|
{
|
|
|
|
SteamID id = Steam::Proxy::SteamFriends->GetFriendByIndex(i, 4);
|
|
|
|
|
|
|
|
Friends::Friend entry;
|
|
|
|
entry.userId = id;
|
2017-02-18 03:42:55 -05:00
|
|
|
entry.guid.bits = 0;
|
2017-01-30 15:13:30 -05:00
|
|
|
entry.online = false;
|
2017-01-31 04:20:28 -05:00
|
|
|
entry.lastTime = 0;
|
2017-01-30 15:13:30 -05:00
|
|
|
entry.prestige = 0;
|
|
|
|
entry.experience = 0;
|
|
|
|
entry.server.setType(Game::NA_BAD);
|
|
|
|
|
2017-06-14 06:06:04 -04:00
|
|
|
for (auto storedFriend : list.friends())
|
2017-01-31 11:53:59 -05:00
|
|
|
{
|
2017-06-14 06:06:04 -04:00
|
|
|
if (entry.userId.bits == strtoull(storedFriend.steamid().data(), nullptr, 16))
|
2017-01-31 11:53:59 -05:00
|
|
|
{
|
|
|
|
entry.playerName = storedFriend.name();
|
|
|
|
entry.experience = storedFriend.experience();
|
|
|
|
entry.prestige = storedFriend.prestige();
|
2017-02-18 03:42:55 -05:00
|
|
|
entry.guid.bits = strtoull(storedFriend.guid().data(), nullptr, 16);
|
2017-01-31 11:53:59 -05:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-12 07:07:14 -05:00
|
|
|
auto oldEntry = std::find_if(Friends::FriendsList.begin(), Friends::FriendsList.end(), [id](Friends::Friend entry)
|
2017-01-30 15:13:30 -05:00
|
|
|
{
|
2017-02-18 03:42:55 -05:00
|
|
|
return (entry.userId.bits == id.bits);
|
2017-01-30 15:13:30 -05:00
|
|
|
});
|
|
|
|
|
2017-02-12 07:07:14 -05:00
|
|
|
if (oldEntry != Friends::FriendsList.end()) entry = *oldEntry;
|
|
|
|
else Friends::FriendsList.push_back(entry);
|
|
|
|
|
|
|
|
steamFriends.push_back(entry);
|
|
|
|
}
|
|
|
|
|
2017-06-14 06:06:04 -04:00
|
|
|
for (auto i = Friends::FriendsList.begin(); i != Friends::FriendsList.end();)
|
2017-02-12 07:07:14 -05:00
|
|
|
{
|
|
|
|
SteamID id = i->userId;
|
2017-01-30 15:13:30 -05:00
|
|
|
|
2017-02-12 07:07:14 -05:00
|
|
|
auto oldEntry = std::find_if(steamFriends.begin(), steamFriends.end(), [id](Friends::Friend entry)
|
|
|
|
{
|
2017-02-18 03:42:55 -05:00
|
|
|
return (entry.userId.bits == id.bits);
|
2017-02-12 07:07:14 -05:00
|
|
|
});
|
2017-01-30 15:13:30 -05:00
|
|
|
|
2017-06-14 06:06:04 -04:00
|
|
|
if (oldEntry == steamFriends.end())
|
2017-02-12 07:07:14 -05:00
|
|
|
{
|
|
|
|
i = Friends::FriendsList.erase(i);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*i = *oldEntry;
|
|
|
|
++i;
|
2017-01-30 15:13:30 -05:00
|
|
|
|
2017-02-12 07:07:14 -05:00
|
|
|
Friends::UpdateUserInfo(id);
|
2017-02-16 21:27:38 -05:00
|
|
|
Friends::RequestPresence(id);
|
2017-02-12 07:07:14 -05:00
|
|
|
}
|
2017-01-30 15:13:30 -05:00
|
|
|
}
|
2017-01-25 16:39:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
unsigned int Friends::GetFriendCount()
|
|
|
|
{
|
|
|
|
return Friends::FriendsList.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
const char* Friends::GetFriendText(unsigned int index, int column)
|
|
|
|
{
|
|
|
|
std::lock_guard<std::recursive_mutex> _(Friends::Mutex);
|
|
|
|
if (index >= Friends::FriendsList.size()) return "";
|
|
|
|
|
|
|
|
auto user = Friends::FriendsList[index];
|
|
|
|
|
2017-06-14 06:06:04 -04:00
|
|
|
switch (column)
|
2017-01-25 16:39:00 -05:00
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
|
|
|
static char buffer[0x100];
|
2017-01-26 06:42:42 -05:00
|
|
|
ZeroMemory(buffer, sizeof(buffer));
|
2017-01-25 16:39:00 -05:00
|
|
|
|
2017-01-26 06:42:42 -05:00
|
|
|
Game::Material* rankIcon = nullptr;
|
|
|
|
int rank = Game::CL_GetRankForXP(user.experience);
|
|
|
|
Game::CL_GetRankIcon(rank, user.prestige, &rankIcon);
|
2017-01-29 09:10:54 -05:00
|
|
|
if (!rankIcon) rankIcon = Game::DB_FindXAssetDefaultHeaderInternal(Game::XAssetType::ASSET_TYPE_MATERIAL).material;
|
2017-01-25 16:39:00 -05:00
|
|
|
|
2017-01-26 06:42:42 -05:00
|
|
|
buffer[0] = '^';
|
|
|
|
buffer[1] = 2;
|
2017-01-25 16:39:00 -05:00
|
|
|
|
|
|
|
// Icon size
|
2017-01-26 06:42:42 -05:00
|
|
|
char size = 0x30;
|
|
|
|
buffer[2] = size; // Width
|
|
|
|
buffer[3] = size; // Height
|
2017-01-25 16:39:00 -05:00
|
|
|
|
|
|
|
// Icon name length
|
2017-01-26 06:42:42 -05:00
|
|
|
buffer[4] = static_cast<char>(strlen(rankIcon->name));
|
2017-01-25 16:39:00 -05:00
|
|
|
|
2017-01-26 06:42:42 -05:00
|
|
|
strcat_s(buffer, rankIcon->name);
|
2017-01-29 09:10:54 -05:00
|
|
|
strcat_s(buffer, Utils::String::VA(" %i", (rank + 1)));
|
2017-01-25 16:39:00 -05:00
|
|
|
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
case 1:
|
2017-01-31 11:04:54 -05:00
|
|
|
{
|
|
|
|
if (user.playerName.empty())
|
|
|
|
{
|
|
|
|
return Utils::String::VA("%s", user.name.data());
|
|
|
|
}
|
2017-02-20 11:57:25 -05:00
|
|
|
else if (user.name == user.playerName)
|
|
|
|
{
|
|
|
|
return Utils::String::VA("%s", user.name.data());
|
|
|
|
}
|
2017-01-31 11:04:54 -05:00
|
|
|
else
|
|
|
|
{
|
|
|
|
return Utils::String::VA("%s ^7(%s^7)", user.name.data(), user.playerName.data());
|
|
|
|
}
|
|
|
|
}
|
2017-01-25 16:39:00 -05:00
|
|
|
case 2:
|
2017-06-14 06:06:04 -04:00
|
|
|
{
|
2017-01-30 15:13:30 -05:00
|
|
|
if (!user.online) return "Offline";
|
2017-01-31 04:20:28 -05:00
|
|
|
if (!Friends::IsOnline(user.lastTime)) return "Online";
|
2017-01-30 15:13:30 -05:00
|
|
|
if (user.server.getType() == Game::NA_BAD) return "Playing IW4x";
|
|
|
|
if (user.serverName.empty()) return Utils::String::VA("Playing on %s", user.server.getCString());
|
2017-02-12 16:55:45 -05:00
|
|
|
return Utils::String::VA("Playing %s on %s", Game::UI_LocalizeMapName(user.mapname.data()), user.serverName.data());
|
2017-01-29 11:16:09 -05:00
|
|
|
}
|
2017-01-25 16:39:00 -05:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
|
|
|
|
void Friends::SelectFriend(unsigned int index)
|
|
|
|
{
|
|
|
|
std::lock_guard<std::recursive_mutex> _(Friends::Mutex);
|
|
|
|
if (index >= Friends::FriendsList.size()) return;
|
|
|
|
|
|
|
|
Friends::CurrentFriend = index;
|
|
|
|
}
|
|
|
|
|
2017-01-29 11:16:09 -05:00
|
|
|
__declspec(naked) void Friends::DisconnectStub()
|
|
|
|
{
|
|
|
|
__asm
|
|
|
|
{
|
|
|
|
pushad
|
|
|
|
call Friends::ClearServer
|
|
|
|
popad
|
|
|
|
|
|
|
|
push 467CC0h
|
|
|
|
retn
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-16 13:44:21 -05:00
|
|
|
void Friends::AddFriend(SteamID user)
|
|
|
|
{
|
2017-06-14 06:06:04 -04:00
|
|
|
if (Steam::Proxy::ClientFriends && Steam::Proxy::SteamFriends)
|
2017-02-16 13:44:21 -05:00
|
|
|
{
|
2017-06-14 06:06:04 -04:00
|
|
|
if (Steam::Proxy::ClientFriends.invoke<bool>("AddFriend", user))
|
2017-02-16 13:44:21 -05:00
|
|
|
{
|
2017-02-18 06:50:02 -05:00
|
|
|
Toast::Show("cardicon_joystick", Steam::Proxy::SteamFriends->GetFriendPersonaName(user), "friend request sent", 3000);
|
2017-02-16 13:44:21 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-02-16 21:27:38 -05:00
|
|
|
Toast::Show("cardicon_stop", Steam::Proxy::SteamFriends->GetFriendPersonaName(user), "unable to send friend request", 3000);
|
2017-02-16 13:44:21 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-20 17:58:58 -05:00
|
|
|
int Friends::GetGame(SteamID user)
|
|
|
|
{
|
|
|
|
int appId = 0;
|
|
|
|
|
|
|
|
Steam::FriendGameInfo info;
|
|
|
|
if (Steam::Proxy::SteamFriends && Steam::Proxy::SteamFriends->GetFriendGamePlayed(user, &info))
|
|
|
|
{
|
|
|
|
appId = info.m_gameID.appID;
|
|
|
|
}
|
|
|
|
|
|
|
|
return appId;
|
|
|
|
}
|
|
|
|
|
2017-01-31 04:20:28 -05:00
|
|
|
void Friends::UpdateTimeStamp()
|
|
|
|
{
|
2017-01-31 14:58:12 -05:00
|
|
|
Friends::SetPresence("iw4x_playing", Utils::String::VA("%d", Steam::SteamUtils()->GetServerRealTime()));
|
2017-02-18 03:42:55 -05:00
|
|
|
Friends::SetPresence("iw4x_guid", Utils::String::VA("%llX", Steam::SteamUser()->GetSteamID().bits));
|
2017-01-31 04:20:28 -05:00
|
|
|
}
|
|
|
|
|
2017-01-31 09:35:34 -05:00
|
|
|
bool Friends::IsOnline(unsigned __int64 timeStamp)
|
2017-01-31 04:20:28 -05:00
|
|
|
{
|
2017-01-31 09:35:34 -05:00
|
|
|
if (!Steam::Proxy::SteamUtils) return false;
|
|
|
|
static const unsigned __int64 duration = std::chrono::duration_cast<std::chrono::seconds>(5min).count();
|
|
|
|
|
2017-01-31 14:58:12 -05:00
|
|
|
return ((Steam::SteamUtils()->GetServerRealTime() - timeStamp) < duration);
|
2017-01-31 04:20:28 -05:00
|
|
|
}
|
|
|
|
|
2017-01-31 11:53:59 -05:00
|
|
|
void Friends::StoreFriendsList()
|
|
|
|
{
|
|
|
|
std::lock_guard<std::recursive_mutex> _(Friends::Mutex);
|
|
|
|
|
2017-02-19 04:44:45 -05:00
|
|
|
// Only store our cache if we are logged in, otherwise it might be invalid
|
2017-02-19 05:38:18 -05:00
|
|
|
if (!Friends::LoggedOn) return;
|
2017-02-19 04:44:45 -05:00
|
|
|
|
2017-01-31 11:53:59 -05:00
|
|
|
Proto::Friends::List list;
|
2017-06-14 06:06:04 -04:00
|
|
|
for (auto entry : Friends::FriendsList)
|
2017-01-31 11:53:59 -05:00
|
|
|
{
|
|
|
|
Proto::Friends::Friend* friendEntry = list.add_friends();
|
|
|
|
|
2017-02-18 03:42:55 -05:00
|
|
|
friendEntry->set_steamid(Utils::String::VA("%llX", entry.userId.bits));
|
|
|
|
friendEntry->set_guid(Utils::String::VA("%llX", entry.guid.bits));
|
2017-01-31 11:53:59 -05:00
|
|
|
friendEntry->set_name(entry.playerName);
|
|
|
|
friendEntry->set_experience(entry.experience);
|
|
|
|
friendEntry->set_prestige(entry.prestige);
|
|
|
|
}
|
|
|
|
|
|
|
|
Utils::IO::WriteFile("players/friends.dat", list.SerializeAsString());
|
|
|
|
}
|
|
|
|
|
2017-06-05 06:53:26 -04:00
|
|
|
Game::Material* Friends::CreateAvatar(SteamID user)
|
|
|
|
{
|
|
|
|
if (!Steam::Proxy::SteamUtils || !Steam::Proxy::SteamFriends) return nullptr;
|
|
|
|
|
|
|
|
int index = Steam::Proxy::SteamFriends->GetMediumFriendAvatar(user);
|
|
|
|
|
|
|
|
unsigned int width, height;
|
|
|
|
Steam::Proxy::SteamUtils->GetImageSize(index, &width, &height);
|
|
|
|
|
|
|
|
Game::GfxImage* image = Materials::CreateImage(Utils::String::VA("texture_%llX", user.bits), width, height, 1, 0x1000003, D3DFMT_A8R8G8B8);
|
|
|
|
|
|
|
|
D3DLOCKED_RECT lockedRect;
|
|
|
|
image->map->LockRect(0, &lockedRect, nullptr, 0);
|
|
|
|
|
|
|
|
unsigned char* buffer = static_cast<unsigned char*>(lockedRect.pBits);
|
|
|
|
Steam::Proxy::SteamUtils->GetImageRGBA(index, buffer, width * height * 4);
|
|
|
|
|
|
|
|
// Swap red and blue channel
|
|
|
|
for (unsigned int i = 0; i < width * height * 4; i += 4)
|
|
|
|
{
|
|
|
|
std::swap(buffer[i + 0], buffer[i + 2]);
|
|
|
|
}
|
|
|
|
|
2017-06-05 07:47:00 -04:00
|
|
|
// Steam rounds the corners and somehow fuck up the pixels there
|
|
|
|
buffer[3] = 0; // top-left
|
|
|
|
buffer[(width - 1) * 4 + 3] = 0; // top-right
|
|
|
|
buffer[((height - 1) * width * 4) + 3] = 0; // bottom-left
|
|
|
|
buffer[((height - 1) * width * 4) + (width - 1) * 4 + 3] = 0; // bottom-right
|
|
|
|
|
2017-06-05 06:53:26 -04:00
|
|
|
image->map->UnlockRect(0);
|
|
|
|
|
|
|
|
return Materials::Create(Utils::String::VA("avatar_%llX", user.bits), image);
|
|
|
|
}
|
|
|
|
|
2017-01-25 16:39:00 -05:00
|
|
|
Friends::Friends()
|
|
|
|
{
|
2017-02-19 05:38:18 -05:00
|
|
|
Friends::LoggedOn = false;
|
|
|
|
|
2017-02-25 09:58:43 -05:00
|
|
|
if (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled() || Monitor::IsEnabled()) return;
|
2017-02-25 06:54:26 -05:00
|
|
|
|
2017-02-01 15:08:59 -05:00
|
|
|
Dvar::Register<bool>("cl_anonymous", false, Game::DVAR_FLAG_SAVED, "");
|
2017-02-12 14:36:38 -05:00
|
|
|
Dvar::Register<int>("cl_notifyFriendState", 1, -1, 1, Game::DVAR_FLAG_SAVED, "");
|
2017-01-31 14:58:12 -05:00
|
|
|
|
2017-02-16 13:44:21 -05:00
|
|
|
Command::Add("addFriend", [](Command::Params* params)
|
|
|
|
{
|
|
|
|
if (params->length() <= 1) return;
|
|
|
|
SteamID id;
|
2017-02-18 03:42:55 -05:00
|
|
|
id.bits = atoll(params->get(1));
|
2017-02-16 13:44:21 -05:00
|
|
|
|
|
|
|
Friends::AddFriend(id);
|
|
|
|
});
|
|
|
|
|
2017-02-12 12:03:55 -05:00
|
|
|
// Hook Live_ShowFriendsList
|
|
|
|
Utils::Hook(0x4D6C70, []()
|
|
|
|
{
|
|
|
|
Command::Execute("openmenu popup_friends", true);
|
|
|
|
}, HOOK_JUMP).install()->quick();
|
|
|
|
|
2017-01-25 16:39:00 -05:00
|
|
|
// Callback to update user information
|
2017-01-30 15:13:30 -05:00
|
|
|
Steam::Proxy::RegisterCallback(336, [](void* data)
|
2017-01-25 16:39:00 -05:00
|
|
|
{
|
2017-01-30 15:13:30 -05:00
|
|
|
Friends::FriendRichPresenceUpdate* update = static_cast<Friends::FriendRichPresenceUpdate*>(data);
|
|
|
|
Friends::UpdateUserInfo(update->m_steamIDFriend);
|
2017-01-25 16:39:00 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
// Persona state has changed
|
2017-01-30 15:13:30 -05:00
|
|
|
Steam::Proxy::RegisterCallback(304, [](void* data)
|
2017-01-25 16:39:00 -05:00
|
|
|
{
|
2017-01-30 15:13:30 -05:00
|
|
|
Friends::PersonaStateChange* state = static_cast<Friends::PersonaStateChange*>(data);
|
2017-02-16 21:27:38 -05:00
|
|
|
Friends::RequestPresence(state->m_ulSteamID);
|
2017-01-25 16:39:00 -05:00
|
|
|
});
|
|
|
|
|
2017-01-30 15:13:30 -05:00
|
|
|
// Update state when connecting/disconnecting
|
|
|
|
Utils::Hook(0x403582, Friends::DisconnectStub, HOOK_CALL).install()->quick();
|
|
|
|
Utils::Hook(0x4CD023, Friends::SetServer, HOOK_JUMP).install()->quick();
|
|
|
|
|
|
|
|
// Show blue icons on the minimap
|
|
|
|
Utils::Hook(0x493130, Friends::IsClientInParty, HOOK_JUMP).install()->quick();
|
|
|
|
|
2017-01-25 16:39:00 -05:00
|
|
|
UIScript::Add("LoadFriends", [](UIScript::Token)
|
|
|
|
{
|
|
|
|
Friends::UpdateFriends();
|
|
|
|
});
|
|
|
|
|
2017-01-29 11:16:09 -05:00
|
|
|
UIScript::Add("JoinFriend", [](UIScript::Token)
|
|
|
|
{
|
|
|
|
std::lock_guard<std::recursive_mutex> _(Friends::Mutex);
|
|
|
|
if (Friends::CurrentFriend >= Friends::FriendsList.size()) return;
|
|
|
|
|
|
|
|
auto& user = Friends::FriendsList[Friends::CurrentFriend];
|
|
|
|
|
2017-06-14 06:06:04 -04:00
|
|
|
if (user.online && user.server.getType() != Game::NA_BAD)
|
2017-01-29 11:16:09 -05:00
|
|
|
{
|
|
|
|
Party::Connect(user.server);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Command::Execute("snd_playLocal exit_prestige", false);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2017-05-31 09:45:12 -04:00
|
|
|
Scheduler::OnFrame([]()
|
2017-01-29 09:10:54 -05:00
|
|
|
{
|
2017-01-31 12:20:16 -05:00
|
|
|
static Utils::Time::Interval timeInterval;
|
2017-01-31 12:16:30 -05:00
|
|
|
static Utils::Time::Interval sortInterval;
|
|
|
|
static Utils::Time::Interval stateInterval;
|
2017-01-31 11:04:54 -05:00
|
|
|
|
2017-01-31 12:20:16 -05:00
|
|
|
if (*reinterpret_cast<bool*>(0x1AD5690)) // LiveStorage_DoWeHaveStats
|
2017-01-31 11:04:54 -05:00
|
|
|
{
|
2017-01-31 12:20:16 -05:00
|
|
|
Friends::UpdateRank();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (timeInterval.elapsed(2min))
|
|
|
|
{
|
|
|
|
timeInterval.update();
|
2017-01-31 12:16:30 -05:00
|
|
|
Friends::UpdateTimeStamp();
|
|
|
|
Friends::UpdateState();
|
|
|
|
}
|
|
|
|
|
2017-06-14 06:06:04 -04:00
|
|
|
if (stateInterval.elapsed(5s))
|
2017-01-31 12:16:30 -05:00
|
|
|
{
|
|
|
|
stateInterval.update();
|
2017-01-31 11:04:54 -05:00
|
|
|
|
2017-06-14 06:06:04 -04:00
|
|
|
if (Friends::TriggerUpdate)
|
2017-01-31 11:04:54 -05:00
|
|
|
{
|
|
|
|
Friends::TriggerUpdate = false;
|
|
|
|
Friends::UpdateState(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-14 06:06:04 -04:00
|
|
|
if (sortInterval.elapsed(1s))
|
2017-01-31 12:16:30 -05:00
|
|
|
{
|
2017-01-31 12:20:16 -05:00
|
|
|
sortInterval.update();
|
2017-01-31 12:16:30 -05:00
|
|
|
|
|
|
|
if (Friends::TriggerSort)
|
|
|
|
{
|
|
|
|
Friends::TriggerSort = false;
|
|
|
|
Friends::SortList(true);
|
|
|
|
}
|
|
|
|
}
|
2017-01-29 09:10:54 -05:00
|
|
|
});
|
|
|
|
|
2017-02-06 15:23:15 -05:00
|
|
|
UIFeeder::Add(61.0f, Friends::GetFriendCount, Friends::GetFriendText, Friends::SelectFriend);
|
2017-01-28 09:51:50 -05:00
|
|
|
|
2017-05-31 10:09:41 -04:00
|
|
|
Scheduler::OnShutdown([]()
|
2017-01-30 15:54:34 -05:00
|
|
|
{
|
|
|
|
Friends::ClearPresence("iw4x_server");
|
|
|
|
Friends::ClearPresence("iw4x_playing");
|
|
|
|
|
2017-01-31 09:56:24 -05:00
|
|
|
#ifdef DEBUG
|
2017-02-06 15:09:41 -05:00
|
|
|
if (Steam::Proxy::SteamFriends)
|
|
|
|
{
|
|
|
|
Steam::Proxy::SteamFriends->ClearRichPresence();
|
|
|
|
}
|
2017-01-31 09:56:24 -05:00
|
|
|
#endif
|
2017-01-30 15:54:34 -05:00
|
|
|
|
2017-06-14 06:06:04 -04:00
|
|
|
if (Steam::Proxy::ClientFriends)
|
2017-01-30 15:54:34 -05:00
|
|
|
{
|
2017-02-17 18:02:42 -05:00
|
|
|
Steam::Proxy::ClientFriends.invoke<void>("SetPersonaState", Friends::InitialState);
|
2017-01-30 15:54:34 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2017-05-31 09:45:12 -04:00
|
|
|
Scheduler::Once([]()
|
2017-01-30 15:54:34 -05:00
|
|
|
{
|
2017-02-17 18:02:42 -05:00
|
|
|
if (Steam::Proxy::SteamFriends)
|
2017-01-30 15:54:34 -05:00
|
|
|
{
|
2017-02-17 18:02:42 -05:00
|
|
|
Friends::InitialState = Steam::Proxy::SteamFriends->GetPersonaState();
|
2017-01-30 15:54:34 -05:00
|
|
|
}
|
|
|
|
|
2017-06-14 06:06:04 -04:00
|
|
|
if (Dvar::Var("cl_anonymous").get<bool>() || !Steam::Enabled())
|
2017-02-01 15:08:59 -05:00
|
|
|
{
|
2017-02-17 05:59:16 -05:00
|
|
|
if (Steam::Proxy::ClientFriends)
|
2017-02-01 15:08:59 -05:00
|
|
|
{
|
2017-02-20 18:16:23 -05:00
|
|
|
for (auto id : Friends::GetAppIdList())
|
|
|
|
{
|
|
|
|
Steam::Proxy::ClientFriends.invoke<void>("ClearRichPresence", id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-06-14 06:06:04 -04:00
|
|
|
if (Steam::Proxy::SteamFriends)
|
2017-02-20 18:16:23 -05:00
|
|
|
{
|
|
|
|
Steam::Proxy::SteamFriends->ClearRichPresence();
|
2017-02-01 15:08:59 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-31 04:20:28 -05:00
|
|
|
Friends::UpdateTimeStamp();
|
2017-01-31 11:04:54 -05:00
|
|
|
Friends::UpdateName();
|
|
|
|
Friends::UpdateState();
|
2017-01-31 10:20:49 -05:00
|
|
|
|
2017-01-30 15:54:34 -05:00
|
|
|
Friends::UpdateFriends();
|
|
|
|
});
|
2017-01-25 16:39:00 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
Friends::~Friends()
|
|
|
|
{
|
2017-02-25 09:58:43 -05:00
|
|
|
if (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled() || Monitor::IsEnabled()) return;
|
2017-01-31 14:58:12 -05:00
|
|
|
|
2017-01-31 11:53:59 -05:00
|
|
|
Friends::StoreFriendsList();
|
|
|
|
|
2017-01-30 16:13:57 -05:00
|
|
|
Steam::Proxy::UnregisterCallback(336);
|
|
|
|
Steam::Proxy::UnregisterCallback(304);
|
|
|
|
|
2017-02-06 15:09:41 -05:00
|
|
|
std::lock_guard<std::recursive_mutex> _(Friends::Mutex);
|
|
|
|
Friends::FriendsList.clear();
|
|
|
|
|
2017-01-25 16:39:00 -05:00
|
|
|
}
|
|
|
|
}
|