[Friends] Transmit ingame name
This commit is contained in:
parent
538724f67e
commit
8dd86043dc
@ -159,6 +159,7 @@ namespace Components
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
lastValidName = name;
|
lastValidName = name;
|
||||||
|
Friends::UpdateName();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
|
bool Friends::TriggerUpdate = false;
|
||||||
int Friends::InitialState;
|
int Friends::InitialState;
|
||||||
unsigned int Friends::CurrentFriend;
|
unsigned int Friends::CurrentFriend;
|
||||||
std::recursive_mutex Friends::Mutex;
|
std::recursive_mutex Friends::Mutex;
|
||||||
@ -99,7 +100,9 @@ namespace Components
|
|||||||
Friends::SortList();
|
Friends::SortList();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Friends::UpdateState()
|
void Friends::UpdateState(bool force)
|
||||||
|
{
|
||||||
|
if(force)
|
||||||
{
|
{
|
||||||
if (Steam::Proxy::SteamLegacyFriends)
|
if (Steam::Proxy::SteamLegacyFriends)
|
||||||
{
|
{
|
||||||
@ -107,6 +110,11 @@ namespace Components
|
|||||||
Steam::Proxy::SteamLegacyFriends->SetPersonaState((state == 1 ? 2 : 1));
|
Steam::Proxy::SteamLegacyFriends->SetPersonaState((state == 1 ? 2 : 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Friends::TriggerUpdate = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Friends::UpdateHostname(Network::Address server, std::string hostname)
|
void Friends::UpdateHostname(Network::Address server, std::string hostname)
|
||||||
{
|
{
|
||||||
@ -121,6 +129,12 @@ namespace Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Friends::UpdateName()
|
||||||
|
{
|
||||||
|
Friends::SetPresence("iw4x_name", Steam::SteamFriends()->GetPersonaName());
|
||||||
|
Friends::UpdateState();
|
||||||
|
}
|
||||||
|
|
||||||
void Friends::ClearPresence(std::string key)
|
void Friends::ClearPresence(std::string key)
|
||||||
{
|
{
|
||||||
if (Steam::Proxy::SteamFriends)
|
if (Steam::Proxy::SteamFriends)
|
||||||
@ -263,8 +277,16 @@ namespace Components
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
|
{
|
||||||
|
if (user.playerName.empty())
|
||||||
|
{
|
||||||
return Utils::String::VA("%s", user.name.data());
|
return Utils::String::VA("%s", user.name.data());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return Utils::String::VA("%s ^7(%s^7)", user.name.data(), user.playerName.data());
|
||||||
|
}
|
||||||
|
}
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
if (!user.online) return "Offline";
|
if (!user.online) return "Offline";
|
||||||
@ -362,6 +384,19 @@ namespace Components
|
|||||||
|
|
||||||
QuickPatch::OnFrame([]()
|
QuickPatch::OnFrame([]()
|
||||||
{
|
{
|
||||||
|
static Utils::Time::Interval interval;
|
||||||
|
|
||||||
|
if(interval.elapsed(5s))
|
||||||
|
{
|
||||||
|
interval.update();
|
||||||
|
|
||||||
|
if(Friends::TriggerUpdate)
|
||||||
|
{
|
||||||
|
Friends::TriggerUpdate = false;
|
||||||
|
Friends::UpdateState(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(*reinterpret_cast<bool*>(0x1AD5690)) // LiveStorage_DoWeHaveStats
|
if(*reinterpret_cast<bool*>(0x1AD5690)) // LiveStorage_DoWeHaveStats
|
||||||
{
|
{
|
||||||
Friends::UpdateRank();
|
Friends::UpdateRank();
|
||||||
@ -394,7 +429,8 @@ namespace Components
|
|||||||
|
|
||||||
Friends::SetPresence("iw4x_guid", Utils::String::VA("%llX", Steam::SteamUser()->GetSteamID().Bits));
|
Friends::SetPresence("iw4x_guid", Utils::String::VA("%llX", Steam::SteamUser()->GetSteamID().Bits));
|
||||||
Friends::UpdateTimeStamp();
|
Friends::UpdateTimeStamp();
|
||||||
//Friends::UpdateState(); // Don't update state yet, stats will do that
|
Friends::UpdateName();
|
||||||
|
Friends::UpdateState();
|
||||||
|
|
||||||
Friends::UpdateFriends();
|
Friends::UpdateFriends();
|
||||||
});
|
});
|
||||||
|
@ -15,6 +15,7 @@ namespace Components
|
|||||||
static void UpdateFriends();
|
static void UpdateFriends();
|
||||||
static void UpdateRank();
|
static void UpdateRank();
|
||||||
static void UpdateHostname(Network::Address server, std::string hostname);
|
static void UpdateHostname(Network::Address server, std::string hostname);
|
||||||
|
static void UpdateName();
|
||||||
|
|
||||||
static void SetPresence(std::string key, std::string value);
|
static void SetPresence(std::string key, std::string value);
|
||||||
static void ClearPresence(std::string key);
|
static void ClearPresence(std::string key);
|
||||||
@ -49,6 +50,7 @@ namespace Components
|
|||||||
int prestige;
|
int prestige;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static bool TriggerUpdate;
|
||||||
static int InitialState;
|
static int InitialState;
|
||||||
static unsigned int CurrentFriend;
|
static unsigned int CurrentFriend;
|
||||||
static std::recursive_mutex Mutex;
|
static std::recursive_mutex Mutex;
|
||||||
@ -61,7 +63,7 @@ namespace Components
|
|||||||
static bool IsClientInParty(int controller, int clientNum);
|
static bool IsClientInParty(int controller, int clientNum);
|
||||||
|
|
||||||
static void UpdateUserInfo(SteamID user);
|
static void UpdateUserInfo(SteamID user);
|
||||||
static void UpdateState();
|
static void UpdateState(bool force = false);
|
||||||
|
|
||||||
static void SortList();
|
static void SortList();
|
||||||
static void SortIndividualList(std::vector<Friend>* list);
|
static void SortIndividualList(std::vector<Friend>* list);
|
||||||
|
Loading…
Reference in New Issue
Block a user