mirror of
https://github.com/mordentral/AdvancedSessionsPlugin.git
synced 2025-10-22 16:04:18 +00:00
Fixed up the workshop nodes a little more
Added "bRequireNameOnly" to the RequestSteamFriendInfo node, significantly reduces time to return a result as the cost of not downloading the avatar for that user. Added the following nodes GetSteamPersonaName - To retrieve the name of a non friend Make UniqueNetID from SteamID String - Makes a uniquenetid from a 64bit steam ID string Former-commit-id: ec7b6b909584d0260225bd8a9e5477970483563a
This commit is contained in:
@@ -12,7 +12,9 @@ public class AdvancedSessions : ModuleRules
|
||||
|
||||
if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Linux) || (Target.Platform == UnrealTargetPlatform.Mac))
|
||||
{
|
||||
PublicDependencyModuleNames.AddRange(new string[] { "Steamworks"/*,"Voice", "OnlineSubsystemSteam"*/ });
|
||||
PublicDependencyModuleNames.AddRange(new string[] { "Steamworks",/*"Voice",*/ "OnlineSubsystemSteam" });
|
||||
|
||||
PublicIncludePaths.AddRange(new string[] { "../Plugins/Online/OnlineSubsystemSteam/Source/Private" });// This is dumb but it isn't very open
|
||||
}
|
||||
}
|
||||
}
|
@@ -67,10 +67,17 @@ public:
|
||||
|
||||
// Preloads the avatar and name of a steam friend, return whether it is already available or not, STEAM ONLY, Takes time to actually load everything after this is called.
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI")
|
||||
static bool RequestSteamFriendInfo(const FBPUniqueNetId UniqueNetId);
|
||||
static bool RequestSteamFriendInfo(const FBPUniqueNetId UniqueNetId, bool bRequireNameOnly = false);
|
||||
|
||||
// Gets the level of a friends steam account, STEAM ONLY, Returns -1 if the steam level is not known, might need RequestSteamFriendInfo called first.
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI")
|
||||
static int32 GetFriendSteamLevel(const FBPUniqueNetId UniqueNetId);
|
||||
|
||||
// Gets the persona name of a steam ID, STEAM ONLY, Returns empty if no result, might need RequestSteamFriendInfo called first.
|
||||
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI")
|
||||
static FString GetSteamPersonaName(const FBPUniqueNetId UniqueNetId);
|
||||
|
||||
// Creates a unique steam id directly from a string holding a uint64 value, useful for testing
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedFriends|SteamAPI")
|
||||
static FBPUniqueNetId CreateSteamIDFromString(const FString SteamID64);
|
||||
};
|
||||
|
@@ -210,6 +210,8 @@ public:
|
||||
bBanned = hUGCDetails.m_bBanned;
|
||||
bAcceptedForUse = hUGCDetails.m_bAcceptedForUse;
|
||||
bTagsTruncated = hUGCDetails.m_bTagsTruncated;
|
||||
|
||||
CreatorSteamID = FString::Printf(TEXT("%llu"), hUGCDetails.m_ulSteamIDOwner);
|
||||
}
|
||||
|
||||
// Result of obtaining the details
|
||||
@@ -260,9 +262,12 @@ public:
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop")
|
||||
bool bTagsTruncated;
|
||||
|
||||
// Steam ID of the user who created this content.
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop")
|
||||
FString CreatorSteamID;
|
||||
|
||||
/*
|
||||
PublishedFileId_t m_nPublishedFileId;
|
||||
uint64 m_ulSteamIDOwner; // Steam ID of the user who created this content.
|
||||
uint32 m_rtimeCreated; // time when the published file was created
|
||||
uint32 m_rtimeUpdated; // time when the published file was last updated
|
||||
uint32 m_rtimeAddedToUserList; // time when the user added the published file to their list (not always applicable)
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#undef ARRAY_COUNT
|
||||
|
||||
#include <steam/steam_api.h>
|
||||
#include <OnlineSubsystemSteamTypes.h>
|
||||
|
||||
#pragma pop_macro("ARRAY_COUNT")
|
||||
|
||||
@@ -55,7 +56,53 @@ int32 UAdvancedFriendsLibrary::GetFriendSteamLevel(const FBPUniqueNetId UniqueNe
|
||||
|
||||
}
|
||||
|
||||
bool UAdvancedFriendsLibrary::RequestSteamFriendInfo(const FBPUniqueNetId UniqueNetId)
|
||||
FString UAdvancedFriendsLibrary::GetSteamPersonaName(const FBPUniqueNetId UniqueNetId)
|
||||
{
|
||||
|
||||
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
||||
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid())
|
||||
{
|
||||
UE_LOG(AdvancedFriendsLog, Warning, TEXT("GetSteamPersonaName Had a bad UniqueNetId!"));
|
||||
return FString(TEXT(""));
|
||||
}
|
||||
|
||||
if (SteamAPI_Init())
|
||||
{
|
||||
uint64 id = *((uint64*)UniqueNetId.UniqueNetId->GetBytes());
|
||||
const char* PersonaName = SteamFriends()->GetFriendPersonaName(id);
|
||||
return FString(UTF8_TO_TCHAR(PersonaName));
|
||||
}
|
||||
#endif
|
||||
|
||||
return FString(TEXT(""));
|
||||
}
|
||||
|
||||
FBPUniqueNetId UAdvancedFriendsLibrary::CreateSteamIDFromString(const FString SteamID64)
|
||||
{
|
||||
FBPUniqueNetId netId;
|
||||
|
||||
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
||||
if (!(SteamID64.Len() > 0))
|
||||
{
|
||||
UE_LOG(AdvancedFriendsLog, Warning, TEXT("CreateSteamIDFromString Had a bad UniqueNetId!"));
|
||||
return netId;
|
||||
}
|
||||
|
||||
if (SteamAPI_Init())
|
||||
{
|
||||
// Already does the conversion
|
||||
TSharedPtr<const FUniqueNetId> ValueID(new const FUniqueNetIdSteam(SteamID64));
|
||||
//FCString::Atoi64(*SteamID64));
|
||||
|
||||
netId.SetUniqueNetId(ValueID);
|
||||
return netId;
|
||||
}
|
||||
#endif
|
||||
|
||||
return netId;
|
||||
}
|
||||
|
||||
bool UAdvancedFriendsLibrary::RequestSteamFriendInfo(const FBPUniqueNetId UniqueNetId, bool bRequireNameOnly)
|
||||
{
|
||||
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
|
||||
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid())
|
||||
@@ -68,7 +115,7 @@ bool UAdvancedFriendsLibrary::RequestSteamFriendInfo(const FBPUniqueNetId Unique
|
||||
{
|
||||
uint64 id = *((uint64*)UniqueNetId.UniqueNetId->GetBytes());
|
||||
|
||||
return !SteamFriends()->RequestUserInformation(id, false);
|
||||
return !SteamFriends()->RequestUserInformation(id, bRequireNameOnly);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -357,7 +404,7 @@ void UAdvancedFriendsLibrary::IsAFriend(APlayerController *PlayerController, con
|
||||
void UAdvancedFriendsLibrary::GetStoredRecentPlayersList(FBPUniqueNetId UniqueNetId, TArray<FBPOnlineRecentPlayer> &PlayersList)
|
||||
{
|
||||
IOnlineFriendsPtr FriendsInterface = Online::GetFriendsInterface();
|
||||
|
||||
|
||||
if (!FriendsInterface.IsValid())
|
||||
{
|
||||
UE_LOG(AdvancedFriendsLog, Warning, TEXT("GetRecentPlayersList Failed to get friends interface!"));
|
||||
|
Reference in New Issue
Block a user