[Friends] Show playing iw4x state
This commit is contained in:
parent
1e72fe51be
commit
bb18fcc034
@ -24,6 +24,7 @@ namespace Components
|
|||||||
{
|
{
|
||||||
std::lock_guard<std::recursive_mutex> _(Friends::Mutex);
|
std::lock_guard<std::recursive_mutex> _(Friends::Mutex);
|
||||||
|
|
||||||
|
std::vector<Friends::Friend> connectedList;
|
||||||
std::vector<Friends::Friend> playingList;
|
std::vector<Friends::Friend> playingList;
|
||||||
std::vector<Friends::Friend> onlineList;
|
std::vector<Friends::Friend> onlineList;
|
||||||
std::vector<Friends::Friend> offlineList;
|
std::vector<Friends::Friend> offlineList;
|
||||||
@ -33,13 +34,20 @@ namespace Components
|
|||||||
{
|
{
|
||||||
if(entry.online)
|
if(entry.online)
|
||||||
{
|
{
|
||||||
if(entry.server.getType() == Game::NA_BAD)
|
if (entry.playing)
|
||||||
{
|
{
|
||||||
onlineList.push_back(entry);
|
if (entry.server.getType() == Game::NA_BAD)
|
||||||
|
{
|
||||||
|
playingList.push_back(entry);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
playingList.push_back(entry);
|
connectedList.push_back(entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
onlineList.push_back(entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -48,12 +56,14 @@ namespace Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Friends::SortIndividualList(&connectedList);
|
||||||
Friends::SortIndividualList(&playingList);
|
Friends::SortIndividualList(&playingList);
|
||||||
Friends::SortIndividualList(&onlineList);
|
Friends::SortIndividualList(&onlineList);
|
||||||
Friends::SortIndividualList(&offlineList);
|
Friends::SortIndividualList(&offlineList);
|
||||||
|
|
||||||
Friends::FriendsList.clear();
|
Friends::FriendsList.clear();
|
||||||
|
|
||||||
|
Utils::Merge(&Friends::FriendsList, connectedList);
|
||||||
Utils::Merge(&Friends::FriendsList, playingList);
|
Utils::Merge(&Friends::FriendsList, playingList);
|
||||||
Utils::Merge(&Friends::FriendsList, onlineList);
|
Utils::Merge(&Friends::FriendsList, onlineList);
|
||||||
Utils::Merge(&Friends::FriendsList, offlineList);
|
Utils::Merge(&Friends::FriendsList, offlineList);
|
||||||
@ -72,6 +82,7 @@ namespace Components
|
|||||||
*function.add_params() = "iw4x_status";
|
*function.add_params() = "iw4x_status";
|
||||||
*function.add_params() = "iw4x_rank";
|
*function.add_params() = "iw4x_rank";
|
||||||
*function.add_params() = "iw4x_server";
|
*function.add_params() = "iw4x_server";
|
||||||
|
*function.add_params() = "iw4x_playing";
|
||||||
|
|
||||||
IPCHandler::SendWorker("friends", function.SerializeAsString());
|
IPCHandler::SendWorker("friends", function.SerializeAsString());
|
||||||
}
|
}
|
||||||
@ -196,9 +207,13 @@ namespace Components
|
|||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
if(user.online && user.server.getType() != Game::NA_BAD)
|
if(user.online)
|
||||||
{
|
{
|
||||||
if(user.serverName.empty())
|
if (user.playing)
|
||||||
|
{
|
||||||
|
if (user.server.getType() != Game::NA_BAD)
|
||||||
|
{
|
||||||
|
if (user.serverName.empty())
|
||||||
{
|
{
|
||||||
return Utils::String::VA("Playing on %s", user.server.getCString());
|
return Utils::String::VA("Playing on %s", user.server.getCString());
|
||||||
}
|
}
|
||||||
@ -207,10 +222,16 @@ namespace Components
|
|||||||
return Utils::String::VA("Playing on %s", user.serverName.data());
|
return Utils::String::VA("Playing on %s", user.serverName.data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(user.online)
|
else
|
||||||
|
{
|
||||||
|
return "Playing IW4x";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
return "Online";
|
return "Online";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return "Offline";
|
return "Offline";
|
||||||
@ -274,6 +295,10 @@ namespace Components
|
|||||||
{
|
{
|
||||||
entry->playerName = value;
|
entry->playerName = value;
|
||||||
}
|
}
|
||||||
|
else if (key == "iw4x_playing")
|
||||||
|
{
|
||||||
|
entry->playing = atoi(value.data()) == 1;
|
||||||
|
}
|
||||||
else if (key == "iw4x_server")
|
else if (key == "iw4x_server")
|
||||||
{
|
{
|
||||||
Network::Address oldAddress = entry->server;
|
Network::Address oldAddress = entry->server;
|
||||||
@ -370,6 +395,7 @@ namespace Components
|
|||||||
Friends::Friend entry;
|
Friends::Friend entry;
|
||||||
entry.userId = id;
|
entry.userId = id;
|
||||||
entry.online = false;
|
entry.online = false;
|
||||||
|
entry.playing = false;
|
||||||
entry.prestige = 0;
|
entry.prestige = 0;
|
||||||
entry.experience = 0;
|
entry.experience = 0;
|
||||||
entry.server.setType(Game::NA_BAD);
|
entry.server.setType(Game::NA_BAD);
|
||||||
@ -476,6 +502,13 @@ namespace Components
|
|||||||
fInterface->map("nameResponse", Friends::NameResponse);
|
fInterface->map("nameResponse", Friends::NameResponse);
|
||||||
fInterface->map("presenceResponse", Friends::PresenceResponse);
|
fInterface->map("presenceResponse", Friends::PresenceResponse);
|
||||||
fInterface->map("infoResponse", Friends::InfoResponse);
|
fInterface->map("infoResponse", Friends::InfoResponse);
|
||||||
|
|
||||||
|
Proto::IPC::Function function;
|
||||||
|
function.set_name("setPresence");
|
||||||
|
*function.add_params() = "iw4x_playing";
|
||||||
|
*function.add_params() = "1";
|
||||||
|
|
||||||
|
IPCHandler::SendWorker("friends", function.SerializeAsString());
|
||||||
}
|
}
|
||||||
|
|
||||||
Friends::~Friends()
|
Friends::~Friends()
|
||||||
|
@ -40,6 +40,7 @@ namespace Components
|
|||||||
Network::Address server;
|
Network::Address server;
|
||||||
std::string serverName;
|
std::string serverName;
|
||||||
bool online;
|
bool online;
|
||||||
|
bool playing;
|
||||||
int experience;
|
int experience;
|
||||||
int prestige;
|
int prestige;
|
||||||
};
|
};
|
||||||
|
@ -173,6 +173,7 @@ namespace Handlers
|
|||||||
if(Steam::Proxy::SteamFriends)
|
if(Steam::Proxy::SteamFriends)
|
||||||
{
|
{
|
||||||
Steam::Proxy::SteamFriends->SetRichPresence("iw4x_server", nullptr);
|
Steam::Proxy::SteamFriends->SetRichPresence("iw4x_server", nullptr);
|
||||||
|
Steam::Proxy::SteamFriends->SetRichPresence("iw4x_playing", nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Steam::Proxy::SteamLegacyFriends)
|
if(Steam::Proxy::SteamLegacyFriends)
|
||||||
|
Loading…
Reference in New Issue
Block a user