用於取用個別使用者的資訊,以及和
Steam 內嵌介面互動的介面。
成員函式
ISteamFriends
的成員函式可透過全域存取子函式
ISteamFriends()
呼叫。
ActivateGameOverlay
void ActivateGameOverlay( const char *pchDialog );
名稱 | 型別 | 說明 |
pchDialog | const char * | 要開啟的對話視窗。 有效的選項有:「friends」、「community」、「players」、「settings」、「officialgamegroup」、「stats」、「achievements」。 |
開啟
Steam 內嵌介面中特定的對話視窗。
此與將
steamID
設為
ISteamUser::GetSteamID 並呼叫
ActivateGameOverlayToUser 相同。
範例:SteamFriends()->ActivateGameOverlay( "friends" );
ActivateGameOverlayInviteDialog
void ActivateGameOverlayInviteDialog( CSteamID steamIDLobby );
名稱 | 型別 | 說明 |
steamIDLobby | CSteamID | 要邀請選擇的玩家進入的大廳 Steam ID。 |
啟動
Steam 內嵌介面 並開啟邀請對話視窗。 進入該大廳的邀請將從此視窗發出。
ActivateGameOverlayToStore
void ActivateGameOverlayToStore( AppId_t nAppID, EOverlayToStoreFlag eFlag );
啟動
Steam 內嵌介面並開啟所提供的應用程式的 Steam 商店頁面。
使用
k_uAppIdInvalid 便可將使用者帶至 Steam 商店的首頁。
ActivateGameOverlayToUser
void ActivateGameOverlayToUser( const char *pchDialog, CSteamID steamID );
名稱 | 型別 | 說明 |
pchDialog | const char * | 要開啟的對話視窗。 |
steamID | CSteamID | 用於對話視窗的 Steam ID。 |
開啟
Steam 內嵌介面中特定的對話視窗。
有效的
pchDialog
選項為:
- 「steamid」 - 開啟內嵌介面網頁瀏覽器並前往指定的使用者或群組頁面
- 「chat」 - 開啟與指定使用者的聊天視窗,或加入群組聊天
- 「jointrade」 - 開啟以 ISteamEconomy/StartTrade Web API 開始的 Steam 交易工作階段視窗
- 「stats」 - 開啟內嵌介面網頁瀏覽器並前往指定使用者的統計頁面
- 「achievements」 - 開啟內嵌介面網頁瀏覽器並前往指定使用者的成就頁面
- 「friendadd」 - 以最小模式開啟內嵌介面,以提示使用者將目標使用者加為好友
- 「friendremove」 - 以最小模式開啟內嵌介面,以提示使用者移除目標好友
- 「friendrequestaccept」 - 以最小模式開啟內嵌介面,以提示使用者接受好友邀請
- 「friendrequestaccept」 - 以最小模式開啟內嵌介面,以提示使用者忽略好友邀請
ActivateGameOverlayToWebPage
void ActivateGameOverlayToWebPage( const char *pchURL );
啟動
Steam 內嵌介面網頁瀏覽器,並直接前往指定的 URL。
ClearRichPresence
void ClearRichPresence();
清除目前使用者所有豐富狀態的索引碼 / 值。
CloseClanChatWindowInSteam
bool CloseClanChatWindowInSteam( CSteamID steamIDClanChat );
名稱 | 型別 | 說明 |
steamIDClanChat | CSteamID | 關閉此 Steam ID 的 Steam 群組聊天室。 |
關閉 Steam UI 中指定的 Steam 群組聊天室。
傳回: bool
true ,如果使用者成功離開指定的 Steam 群組聊天室。
false ,如果使用者不在指定的 Steam 群組聊天室中。
另外請見: IsClanChatWindowOpenInSteam、
OpenClanChatWindowInSteamDownloadClanActivityCounts
SteamAPICall_t DownloadClanActivityCounts( CSteamID *psteamIDClans, int cClansToRequest );
名稱 | 型別 | 說明 |
psteamIDClans | CSteamID * | 要取得更新資料的 Steam 群組列表。 |
cClansToRequest | int | 必須為 psteamIDClans 中的群組數量。 |
更新 Steam 群組的活動資料,或取得目前使用者並未加入的群組資料。
收到回呼後,使用
GetClanActivityCounts 即可取得最新的使用者人數。
傳回: 與
DownloadClanActivityCountsResult_t 呼叫結果一起使用的
SteamAPICall_t。
EnumerateFollowingList
SteamAPICall_t EnumerateFollowingList( uint32 unStartIndex );
名稱 | 型別 | 說明 |
unStartIndex | uint32 | 從此索引值的關注者開始取得。 第一次呼叫時應為 0。 |
取得目前使用者正在關注的使用者名單。
您可關注不是好友的人。 當您關注的人有任何活動,例如在 Steam 工作坊中張貼了新內容,您即會收到通知。
備註: 此函式一次最多只能傳回
k_cEnumerateFollowersMax 位使用者。 如果使用者關注的人數大於該數,您便需要重複呼叫此函式,而
unStartIndex
則必須設置為您目前收到的人數總數。
也就是說,您目前收到了 50 名關注中的人,而使用者關注了 105 名,您便需要設置
unStartIndex
= 50 以取得接下來的 50 名,然後再設置
unStartIndex
= 100 取得剩餘的 5 名。
傳回: 與
FriendsEnumerateFollowingList_t 呼叫結果一起使用的
SteamAPICall_t。
範例:class CEnumerateFollowingListExample
{
public:
void GetWhoWeFollow();
private:
void OnFriendsEnumerateFollowingList( FriendsEnumerateFollowingList_t *pCallback, bool bIOFailure );
CCallResult< CEnumerateFollowingListExample, FriendsEnumerateFollowingList_t > m_SteamCallResultFriendsEnumerateFollowingList;
int m_nFollowersParsed;
};
void CEnumerateFollowingListExample::GetWhoWeFollow()
{
m_nFollowersParsed = 0;
printf( "Getting the list of users that we follow.\n" );
SteamAPICall_t handle = SteamFriends()->EnumerateFollowingList( 0 );
m_SteamCallResultFriendsEnumerateFollowingList.Set( handle, this, &CEnumerateFollowingListExample::OnFriendsEnumerateFollowingList );
}
void CEnumerateFollowingListExample::OnFriendsEnumerateFollowingList( FriendsEnumerateFollowingList_t *pCallback, bool bIOFailure )
{
if ( pCallback->m_eResult != k_EResultOK || bIOFailure )
{
printf( "OnFriendsEnumerateFollowingList failed with m_eResult: %d and bIOFailure: %d!", pCallback->m_eResult, bIOFailure );
return;
}
printf( "FriendsEnumerateFollowingList retrieved %d of %d people that we follow.\n", pCallback->m_nResultsReturned, pCallback->m_nTotalResultCount );
for ( int i = 0; i < pCallback->m_nResultsReturned; ++i )
{
printf( " %d: %lld\n", i, pCallback->m_rgSteamID[i].ConvertToUint64() );
}
[/i]
m_nFollowersParsed += pCallback->m_nResultsReturned;
// 還有更多關注者! 繼續取得下一批次!
if ( m_nFollowersParsed < pCallback->m_nTotalResultCount )
{
SteamAPICall_t handle = SteamFriends()->EnumerateFollowingList( pCallback->m_nResultsReturned );
m_SteamCallResultFriendsEnumerateFollowingList.Set( handle, this, &CEnumerateFollowingListExample::OnFriendsEnumerateFollowingList );
}
}
GetChatMemberByIndex
CSteamID GetChatMemberByIndex( CSteamID steamIDClan, int iUser );
取得 Steam 群組聊天中指定索引的 Steam ID。
備註: 呼叫此函式前,必須先呼叫
GetClanChatMemberCount。
傳回: CSteamID如索引無效,則傳回
k_steamIDNil。
GetClanActivityCounts
bool GetClanActivityCounts( CSteamID steamIDClan, int *pnOnline, int *pnInGame, int *pnChatting );
名稱 | 型別 | 說明 |
steamIDClan | CSteamID | 取得此 Steam 群組的動態。 |
pnOnline | int * | 傳回線上的成員人數。 |
pnInGame | int * | 傳回正在遊戲中的成員人數(不包括狀態設為離線的人)。 |
pnChatting | int * | 傳回在群組聊天室中的成員人數。 |
取得 Steam 群組中成員在做什麼的最新資訊。
此函式只能取得本機用戶端所知道的資料。 若要更新或取得目前使用者不是成員的群組資料,則必須呼叫
DownloadClanActivityCounts。
傳回: bool
true ,如果資料成功傳回。
false ,如果提供的 Steam ID 無效,或本機用戶端沒有該 Steam 群組的資訊,並將所有參數設為
0 的話。
GetClanByIndex
CSteamID GetClanByIndex( int iClan );
取得位於該索引的 Steam 群組 Steam ID。
備註: 呼叫此函式前,必須先呼叫
GetClanCount。
傳回: CSteamID如索引無效,則傳回
k_steamIDNil。
GetClanChatMemberCount
int GetClanChatMemberCount( CSteamID steamIDClan );
名稱 | 型別 | 說明 |
steamIDClan | CSteamID | 欲取得聊天人數的 Steam 群組。 |
取得 Steam 群組聊天室中的人數。
備註: 大型 Steam 群組無法由本機使用者逐一查看。
備註: 目前使用者必須在大廳中才能取得同一大廳中其他使用者的 Steam ID。
此函式的用途是逐一查看,之後可再使用
GetChatMemberByIndex 取得聊天室中每個人的 Steam ID。
傳回: int
0 ,如果提供的 Steam ID 無效,或本機使用者的資料無法使用。
GetClanChatMessage
int GetClanChatMessage( CSteamID steamIDClanChat, int iMessage, void *prgchText, int cchTextMax, EChatEntryType *peChatEntryType, CSteamID *psteamidChatter );
名稱 | 型別 | 說明 |
steamIDClanChat | CSteamID | Steam 群組聊天室的 Steam ID。 |
iMessage | int | 訊息的索引。 應為 GameConnectedClanChatMsg_t 的 m_iMessageID 欄位。 |
prgchText | void * | 聊天訊息要複製至的緩衝區。 (大小應能容納 2048 個 UTF-8 字母。 「\0」應於 8192 位元組 + 1 處)。 |
cchTextMax | int | prgchText 的大小。 |
peChatEntryType | EChatEntryType * | 傳回收到的聊天訊息種類。 |
psteamidChatter | CSteamID * | 傳回發訊人的 Steam ID。 |
取得 Steam 群組聊天室訊息中的資料。
此函式應只有在回應
GameConnectedClanChatMsg_t 回呼時才能呼叫。
傳回: int
複製進
prgchText
的位元組數量。
如果目前的使用者並不在指定的 Steam 群組聊天室中,或
iMessage
中提供的索引無效,便會傳回
0,並將
peChatEntryType
設置為
k_EChatEntryTypeInvalid。
GetClanCount
int GetClanCount();
取得目前的使用者所加入的 Steam 群組數量。
此函式的用途是逐一查看,之後可再使用
GetClanByIndex 取得每間 Steam 聊天室的 Steam ID。
傳回: int
取得使用者所加入的 Steam 群組數量。
範例:void ListSteamGroups() {
int nGroups = SteamFriends()->GetClanCount();
printf( "Listing %d Steam Groups\n", nGroups );
for ( int i = 0; i < nGroups; ++i )
{
CSteamID groupSteamID = SteamFriends()->GetClanByIndex( i );
const char *szGroupName = SteamFriends()->GetClanName( groupSteamID );
const char *szGroupTag = SteamFriends()->GetClanTag( groupSteamID );
int nOnline, nInGame, nChatting;
bool success = SteamFriends()->GetClanActivityCounts( groupSteamID, &nOnline, &nInGame, &nChatting );
printf( "Group %d - ID: %lld - Name: '%s' - Tag: '%s'\n", i, groupSteamID.ConvertToUint64(), szGroupName, szGroupTag );
printf( " - Online: %d, In Game: %d, Chatting: %d\n", nOnline, nInGame, nChatting );
}
}
GetClanName
const char * GetClanName( CSteamID steamIDClan );
名稱 | 型別 | 說明 |
steamIDClan | CSteamID | 要取得名稱的 Steam 群組。 |
如果本機用戶端有辦法知道,取得指定 Steam 群組的顯示名稱。
傳回: const char *
The Steam group's name in UTF-8 format. 如果提供的 Steam ID 無效,或使用者不知道該群組,則傳回空白字串("")。
另外請見: DownloadClanActivityCountsGetClanOfficerByIndex
CSteamID GetClanOfficerByIndex( CSteamID steamIDClan, int iOfficer );
取得 Steam 群組中指定索引值的幹部 Steam ID。
備註: 呼叫此函式前,必須先呼叫
GetClanOfficerCount。
傳回: CSteamID如果
steamIDClan
或
iOfficer
無效,則傳回
k_steamIDNil。
GetClanOfficerCount
int GetClanOfficerCount( CSteamID steamIDClan );
名稱 | 型別 | 說明 |
steamIDClan | CSteamID | 要取得幹部人數的 Steam 群組。 |
取得指定 Steam 群組中的幹部(管理員和板務)人數。
這也包括 Steam 群組擁有者。
此函式的用途是逐一查看,之後可再使用
GetClanOfficerByIndex 取得每位幹部的 Steam ID。
備註: 進行此呼叫前,必須先呼叫
RequestClanOfficerList 以取得需要的資料!
傳回: int
Steam 群組中的幹部人數。 如果
steamIDClan
無效,或尚未呼叫
RequestClanOfficerList,則會傳回
0 。
GetClanOwner
CSteamID GetClanOwner( CSteamID steamIDClan );
名稱 | 型別 | 說明 |
steamIDClan | CSteamID | 要取得擁有者的群組 Steam ID。 |
取得 Steam 群組的擁有者。
備註: 進行此呼叫前,必須先呼叫
RequestClanOfficerList 以取得需要的資料!
傳回: CSteamID如果
steamIDClan
無效,或尚未呼叫
RequestClanOfficerList,則會傳回
k_steamIDNil。
GetClanTag
const char * GetClanTag( CSteamID steamIDClan );
名稱 | 型別 | 說明 |
steamIDClan | CSteamID | 要取得標籤的 Steam 群組。 |
如果本機用戶端知道的話,取得指定 Steam 群組的唯一標籤(簡稱)。
Steam 群組簡稱是用於辨識群組獨一無二的名稱,長度最長為 12 個字元。 在一些遊戲中,這將出現於群組成員的名稱旁邊。
傳回: const char *
UTF-8 格式的 Steam 群組標籤名稱。 如果提供的 Steam ID 無效,或使用者不知道該群組,則傳回空白字串("")。
另外請見: DownloadClanActivityCountsGetCoplayFriend
CSteamID GetCoplayFriend( int iCoplayFriend );
取得位於該索引的最近一同遊玩的使用者 Steam ID。
備註: 呼叫此函式前,必須先呼叫
GetCoplayFriendCount。
傳回: CSteamID如索引無效,則傳回
k_steamIDNil。
GetCoplayFriendCount
int GetCoplayFriendCount();
Gets the number of players that the current user has recently played with, across all games.
此函式的用途是逐一查看,之後可再使用
GetCoplayFriend 取得個別玩家的 Steam ID。
這些玩家為先前以
SetPlayedWith 呼叫標記過的使用者。
傳回: int
與目前的使用者一同遊玩過的使用者人數。
範例:void ListRecentlyPlayedWithList() {
int nPlayers = SteamFriends()->GetCoplayFriendCount();
printf( "Listing %d Recently Played with Players\n", nPlayers );
for ( int i = 0; i < nPlayers; ++i )
{
CSteamID playerSteamID = SteamFriends()->GetCoplayFriend( i );
int iTimeStamp = SteamFriends()->GetFriendCoplayTime( playerSteamID );
AppId_t app = SteamFriends()->GetFriendCoplayGame( playerSteamID );
printf( "Player %d - ID: %lld - Time: %d - App: %d\n", i, playerSteamID.ConvertToUint64(), iTimeStamp, app );
}
}
GetFollowerCount
SteamAPICall_t GetFollowerCount( CSteamID steamID );
取得關注指定使用者的人數。
傳回: 用於
FriendsGetFollowerCount_t 呼叫結果的
SteamAPICall_t。
範例:class GetFollowerCountExample
{
public:
void GetFollowerCount();
private:
void OnFriendsGetFollowerCount( FriendsGetFollowerCount_t *pCallback, bool bIOFailure );
CCallResult< GetFollowerCountExample, FriendsGetFollowerCount_t > m_SteamCallResultFriendsGetFollowerCount;
};
void GetFollowerCountExample::GetFollowerCount()
{
printf( "Getting the number of users who follow us.\n" );
SteamAPICall_t handle = SteamFriends()->GetFollowerCount( SteamUser()->GetSteamID() );
m_SteamCallResultFriendsGetFollowerCount.Set( handle, this, &GetFollowerCountExample::OnFriendsGetFollowerCount );
}
void GetFollowerCountExample::OnFriendsGetFollowerCount( FriendsGetFollowerCount_t *pCallback, bool bIOFailure )
{
if ( pCallback->m_eResult != k_EResultOK || bIOFailure )
{
printf( "OnFriendsGetFollowerCount failed for %lld with m_eResult: %d and bIOFailure: %d!", pCallback->m_steamID.ConvertToUint64(), pCallback->m_eResult, bIOFailure );
return;
}
printf( "Got a FriendsGetFollowerCount_t, we have %d followers.\n", pCallback->m_nCount );
}
GetFriendByIndex
CSteamID GetFriendByIndex( int iFriend, int iFriendFlags );
取得位於該索引的使用者 Steam ID。
備註: 呼叫此函式前,必須先呼叫
GetFriendCount。
傳回: CSteamID如索引無效,則傳回
k_steamIDNil。
GetFriendCoplayGame
AppId_t GetFriendCoplayGame( CSteamID steamIDFriend );
名稱 | 型別 | 說明 |
steamIDFriend | CSteamID | 要取得一同玩過的遊戲的、並在最近一同遊戲過清單中的使用者 Steam ID。 |
取得使用者的最近一同遊戲過清單中與某人一起遊玩過的遊戲 App ID。
傳回: AppId_t若 Steam ID 沒有在最近一同遊戲過清單中,則傳回
k_uAppIdInvalid。
GetFriendCoplayTime
int GetFriendCoplayTime( CSteamID steamIDFriend );
名稱 | 型別 | 說明 |
steamIDFriend | CSteamID | 要取得時間戳記的、在最近一同遊戲清單中的使用者 Steam ID。 |
取得使用者的最近一同遊戲過清單中與某人一同遊玩的時間戳記。
傳回: int
時間將以 Unix 紀元格式傳回(自 1970 年 1 月 1 日以來的秒數)。
若 Steam ID 沒有在最近一同遊戲過清單中,則傳回
0。
GetFriendCount
int GetFriendCount( int iFriendFlags );
取得用戶端知道並符合特定條件的使用者人數。 (例如好友、封鎖、同一伺服器上的使用者等等)。
此函式的用途是逐一查看使用者,之後可再使用
GetFriendByIndex 取得個別使用者的 Steam ID。
傳回: int
符合特定條件的使用者人數。
備註: 如果目前的使用者並未登入,則傳回
-1。
範例:int nFriends = SteamFriends()->GetFriendCount( k_EFriendFlagImmediate );
if ( nFriends == -1)
{
printf( "GetFriendCount returned -1, the current user is not logged in.\n" );
// 我們會建議重設為 0,以免需要進行以此值配置(Allocate)
// 陣列, 或在其之上執行迴圈等無法使用 -1 的作業
nFriends = 0;
}
for ( int i = 0; i < nFriends; ++i )
{
CSteamID friendSteamID = SteamFriends()->GetFriendByIndex( i, k_EFriendFlagImmediate );
const char *friendName = SteamFriends()->GetFriendPersonaName( friendSteamID );
printf( "Friend %d: %lld - %s\n", i, friendSteamID.ConvertToUint64(), friendName );
}
GetFriendCountFromSource
int GetFriendCountFromSource( CSteamID steamIDSource );
名稱 | 型別 | 說明 |
steamIDSource | CSteamID | 要取得使用者人數的 Steam 群組、聊天室、大廳,或遊戲伺服器。 |
取得來源中的使用者人數(Steam 群組、聊天室、大廳,或遊戲伺服器)。
備註: 大型 Steam 群組無法由本機使用者逐一查看。
備註: 如果您要取得的是大廳成員的人數,請使用
ISteamMatchmaking::GetNumLobbyMembers。
此函式的用途是逐一查看,之後可再使用
GetFriendFromSourceByIndex 取得來源中每個人的 Steam ID。
傳回: int
0 ,如果提供的 Steam ID 無效,或本機使用者的資料無法使用。
GetFriendFromSourceByIndex
CSteamID GetFriendFromSourceByIndex( CSteamID steamIDSource, int iFriend );
取得來源中位於該索引的 Steam ID(Steam 群組、聊天室、大廳,或遊戲伺服器)。
備註: 呼叫此函式前,必須先呼叫
GetFriendCountFromSource。
傳回: CSteamID如索引無效,則傳回
k_steamIDNil。
GetFriendGamePlayed
bool GetFriendGamePlayed( CSteamID steamIDFriend, FriendGameInfo_t *pFriendGameInfo );
檢查指定的好友是否在遊戲中,若是則取得遊戲的相關資訊。
傳回: bool
true ,若使用者為好友並且在遊戲中;否則傳回
false。
GetFriendMessage
int GetFriendMessage( CSteamID steamIDFriend, int iMessageID, void *pvData, int cubData, EChatEntryType *peChatEntryType );
取得由 Steam 好友發出的訊息的資料。
此函式應只有在回應
GameConnectedFriendChatMsg_t 回呼時才能呼叫。
傳回: int
複製進
pvData
的位元組數量。
如果目前的使用者禁止使用聊天、提供的 Steam ID 並非好友,或
iMessageID
中提供的索引無效,便會傳回
0,並將
peChatEntryType
設置為
k_EChatEntryTypeInvalid。
GetFriendPersonaName
const char * GetFriendPersonaName( CSteamID steamIDFriend );
名稱 | 型別 | 說明 |
steamIDFriend | CSteamID | 另一位使用者的 Steam ID。 |
取得指定使用者的個人暱稱(顯示名稱)。
這只有在另一名使用者為目前使用者的好友,或是在同一個遊戲伺服器、聊天室、大廳、Steam 群組時才能取得。
備註: 第一次進入大廳、聊天室,或遊戲伺服器時,目前的使用者是無法自動知道其他使用者的名稱的。該資訊將不同步地由
PersonaStateChange_t 回呼送到。
要取得目前使用者的個人暱稱,請使用
GetPersonaName。
傳回: const char *
The current user's persona name in UTF-8 format. 保證不為
NULL。
如果提供的 Steam ID 無效,或呼叫者無法知道,則傳回空白字串("")或 "[unknown]"。
GetFriendPersonaNameHistory
const char * GetFriendPersonaNameHistory( CSteamID steamIDFriend, int iPersonaName );
名稱 | 型別 | 說明 |
steamIDFriend | CSteamID | 另一位使用者的 Steam ID。 |
iPersonaName | int | 要取得的歷史名稱的索引。 0 為目前的顯示名稱。1 為更改前最近一次使用的名稱,以此類推。 |
取得指定使用者其中一個使用過的顯示名稱。
此函式只有在目前使用者有在本機電腦上見過那些顯示名稱時才能運作。
傳回: const char *
該玩家位於指定索引的舊個人暱稱。 如果歷史紀錄中沒有那麼多項目,則傳回空白字串。
GetFriendPersonaState
EPersonaState GetFriendPersonaState( CSteamID steamIDFriend );
名稱 | 型別 | 說明 |
steamIDFriend | CSteamID | 另一位使用者的 Steam ID。 |
取得指定使用者目前的狀態。
這只有在另一名使用者為目前使用者的好友,或是在同一個遊戲伺服器、聊天室、大廳、Steam 群組時才能取得。
要取得目前使用者的狀態,請使用
GetPersonaName。
傳回: EPersonaState指定使用者的好友狀態 (線上,離線,遊戲中…等)。
GetFriendRelationship
EFriendRelationship GetFriendRelationship( CSteamID steamIDFriend );
名稱 | 型別 | 說明 |
steamIDFriend | CSteamID | 另一位使用者的 Steam ID。 |
取得與指定使用者的關係。
傳回: EFriendRelationship兩位使用者的關係狀態。
GetFriendRichPresence
const char * GetFriendRichPresence( CSteamID steamIDFriend, const char *pchKey );
名稱 | 型別 | 說明 |
steamIDFriend | CSteamID | 要取得豐富狀態(Rich Presence)值的好友。 |
pchKey | const char * | 要取得的豐富狀態索引碼。 |
取得指定好友的豐富狀態值。
傳回: const char *
若並未指定索引碼,則傳回空白字串("")。
另外請見: RequestFriendRichPresence、
SetRichPresenceGetFriendRichPresenceKeyByIndex
const char * GetFriendRichPresenceKeyByIndex( CSteamID steamIDFriend, int iKey );
傳回: const char *
如果提供的 Steam ID 無效,或指定的使用者並沒有豐富狀態,則傳回空白字串("")。
GetFriendRichPresenceKeyCount
int GetFriendRichPresenceKeyCount( CSteamID steamIDFriend );
名稱 | 型別 | 說明 |
steamIDFriend | CSteamID | 要取得豐富狀態索引碼數量的使用者 Steam ID。 |
取得指定使用者上設定的豐富狀態索引碼數量。
此函式的用途是逐一查看,之後可再使用
GetFriendRichPresenceKeyByIndex 取得各個豐富狀態索引碼。
此函式通常僅用於偵錯。
傳回: int
如果指定的使用者沒有豐富狀態資訊,則傳回
0。
GetFriendsGroupCount
int GetFriendsGroupCount();
取得使用者建立的好友群組(標籤)數量。
此函式的用途是逐一查看,之後可再使用
GetFriendsGroupIDByIndex 取得個別玩家群組的 ID。
這裡的群組與 Steam 群組是不同的, 後者可由
GetClanCount 取得。
傳回: int
目前使用者有的好友群組(標籤)數量。
範例:void ListFriendsGroups() {
int nGroups = SteamFriends()->GetFriendsGroupCount();
for ( int i = 0; i < nGroups; ++i )
{
FriendsGroupID_t friendsGroupID = SteamFriends()->GetFriendsGroupIDByIndex( i );
const char *szFriendsGroupName = SteamFriends()->GetFriendsGroupName( friendsGroupID );
int nFriendsGroupMembers = SteamFriends()->GetFriendsGroupMembersCount( friendsGroupID );
printf( "Group %d - ID: %d - Name: '%s' - Members: %d\n", i, friendsGroupID, szFriendsGroupName, nFriendsGroupMembers );
std::vector<CSteamID> friends( nFriendsGroupMembers );
SteamFriends()->GetFriendsGroupMembersList( friendsGroupID, friends.data(), nFriendsGroupMembers );
for ( int j = 0; j < nFriendsGroupMembers; ++j )
{
printf( " - Member %d - ID: %lld\n", j, friends[j].ConvertToUint64() );
}
}
}
GetFriendsGroupIDByIndex
FriendsGroupID_t GetFriendsGroupIDByIndex( int iFG );
取得位於指定索引的好友群組 ID。
備註: 呼叫此函式前,必須先呼叫
GetFriendsGroupCount。
傳回: FriendsGroupID_t[[/apitype]
如索引無效,則傳回 k_FriendsGroupID_Invalid。
GetFriendsGroupMembersCount
int GetFriendsGroupMembersCount( FriendsGroupID_t friendsGroupID );
取得指定好友群組中的好友人數。
此函式應在使用
GetFriendsGroupMembersList 取得好友名單前呼叫。
傳回: int
指定好友群組中的好友數量。
另外請見: GetFriendsGroupCountGetFriendsGroupMembersList
void GetFriendsGroupMembersList( FriendsGroupID_t friendsGroupID, CSteamID *pOutSteamIDMembers, int nMembersCount );
取得指定好友群組中的好友數量。
如果好友數量少於要求中的,那些位置便會是無效的 Steam ID。
呼叫此函式前,必須先呼叫
GetFriendsGroupMembersCount 以將
pOutSteamIDMembers
陣列設定成正確的大小!
另外請見: GetFriendsGroupCountGetFriendsGroupName
const char * GetFriendsGroupName( FriendsGroupID_t friendsGroupID );
取得指定好友群組的名稱。
傳回: const char *
UTF-8 格式的好友群組名稱。 如果群組 ID 無效,則傳回
NULL。
另外請見: GetFriendsGroupCountGetFriendSteamLevel
int GetFriendSteamLevel( CSteamID steamIDFriend );
名稱 | 型別 | 說明 |
steamIDFriend | CSteamID | 使用者的 Steam ID。 |
取得指定使用者的 Steam 等級。
您可使用本機使用者的 Steam ID(
ISteamUser::GetSteamID)取得他們的等級。
傳回: int
如果能取得,傳回 Steam 等級。
如果無法立刻取得指定使用者的 Steam 等級,則傳回
0,並排入 Steam 伺服器的下載佇列。 下載下來後,
PersonaStateChange_t 回呼便會與
m_nChangeFlags
一同發出,當中包含
k_EPersonaChangeSteamLevel
。
GetLargeFriendAvatar
int GetLargeFriendAvatar( CSteamID steamIDFriend );
取得指定使用者的大型(128 * 128 px)個人圖示的控制代碼。
You can pass in
ISteamUser::GetSteamID to get the current user's avatar.
備註: 此函式只能取得本機使用者可知的使用者個人圖示。 使用者可自動得知好友、要求的排行榜上的人,或是同一來源中的人(Steam 群組、聊天室、大廳,或遊戲伺服器)。 如果並不知道的話,便須呼叫
RequestUserInformation 將個人圖示存入本機快取。
傳回: int
觸發
AvatarImageLoaded_t 回呼。
與
ISteamUtils::GetImageSize 和
ISteamUtils::GetImageRGBA 搭配使用的 Steam 圖像控制代碼。
若使用者未設置個人圖像,則傳回
0。
若個人圖示資料尚未載入,但要求將其下載下來,則傳回
-1。 若發生此狀況,請先等待
AvatarImageLoaded_t 回呼,然後再進行一次呼叫。
另外請見: GetMediumFriendAvatar、
GetSmallFriendAvatarGetMediumFriendAvatar
int GetMediumFriendAvatar( CSteamID steamIDFriend );
取得指定使用者的中型(64 * 64 px)個人圖示的控制代碼。
You can pass in
ISteamUser::GetSteamID to get the current user's avatar.
備註: 此函式只能取得本機使用者可知的使用者個人圖示。 使用者可自動得知好友、要求的排行榜上的人,或是同一來源中的人(Steam 群組、聊天室、大廳,或遊戲伺服器)。 如果並不知道的話,便須呼叫
RequestUserInformation 將個人圖示存入本機快取。
傳回: int
與
ISteamUtils::GetImageSize 和
ISteamUtils::GetImageRGBA 搭配使用的圖像控制代碼。
若使用者未設置個人圖像,則傳回
0。
另外請見: GetLargeFriendAvatar、
GetSmallFriendAvatarGetPersonaName
const char * GetPersonaName();
Gets the current user's persona (display) name.
This is the same name that is displayed the user's community profile page.
要取得其他使用者的個人暱稱,請使用
GetFriendPersonaName。
傳回: const char *
The current user's persona name in UTF-8 format. 保證不為
NULL。
GetPersonaState
EPersonaState GetPersonaState();
取得目前使用者的好友狀態。
要取得其他使用者的狀態,請使用
GetFriendPersonaState。
傳回: EPersonaState目前使用者的好友狀態 (線上,離線,遊戲中…等)。
GetPlayerNickname
const char * GetPlayerNickname( CSteamID steamIDPlayer );
名稱 | 型別 | 說明 |
steamIDPlayer | CSteamID | 使用者的 Steam ID。 |
取得目前使用者為指定使用者設定的暱稱。
傳回: const char *
NULL ,如果沒有替該使用者設定暱稱。
GetSmallFriendAvatar
int GetSmallFriendAvatar( CSteamID steamIDFriend );
取得指定使用者的小型(32 * 32 px)個人圖示的控制代碼。
You can pass in
ISteamUser::GetSteamID to get the current user's avatar.
備註: 此函式只能取得本機使用者可知的使用者個人圖示。 使用者可自動得知好友、要求的排行榜上的人,或是同一來源中的人(Steam 群組、聊天室、大廳,或遊戲伺服器)。 如果並不知道的話,便須呼叫
RequestUserInformation 將個人圖示存入本機快取。
傳回: int
與
ISteamUtils::GetImageSize 和
ISteamUtils::GetImageRGBA 搭配使用的圖像控制代碼。
若使用者未設置個人圖像,則傳回
0。
另外請見: GetLargeFriendAvatar、
GetMediumFriendAvatarGetUserRestrictions
uint32 GetUserRestrictions();
檢查目前使用者是否被禁止聊天。
如果被禁止,則無法傳送或接收任何文字 / 語音交談訊息,也不能見到自訂的個人圖示。
被禁止聊天的使用者無法新增好友或加入任何群組。
遭禁止的使用者依然可顯示為線上,並傳送 / 接收遊戲邀請。
傳回: uint32請見:
EUserRestrictionHasFriend
bool HasFriend( CSteamID steamIDFriend, int iFriendFlags );
名稱 | 型別 | 說明 |
steamIDFriend | CSteamID | 要檢查好友狀態的 Steam 使用者。 |
iFriendFlags | int | 一個或以上的 EFriendFlags 的組合聯集(二進位制的「or」)。 |
檢查使用者是否符合指定的條件 (例如好友、封鎖、同一伺服器上的使用者等等)。
傳回: bool
true ,如果使用者符合任何
iFriendFlags
中列出的條件;否則傳回 false。
InviteUserToGame
bool InviteUserToGame( CSteamID steamIDFriend, const char *pchConnectString );
以特別的邀請字串,邀請好友或群組成員加入目前的遊戲。
如果目標使用者接受了邀請,啟動遊戲時便會將 pchConnectString 加入命令列中。
若該使用者已在執行遊戲,對方便會收到帶有該連接字串的
GameRichPresenceJoinRequested_t 回呼。
傳回: bool
觸發
GameRichPresenceJoinRequested_t 回呼。
true ,如果邀請傳送成功。
false ,如果發生以下狀況:
- 提供給
steamIDFriend
的 Steam ID 無效。
- 提供給
steamIDFriend
的 Steam ID 並非好友,或並不與目前使用者在同樣的 Steam 群組中。
- 提供給
pchConnectString
的值過長。
另外請見: ISteamMatchmaking::InviteUserToLobbyIsClanChatAdmin
bool IsClanChatAdmin( CSteamID steamIDClanChat, CSteamID steamIDUser );
名稱 | 型別 | 說明 |
steamIDClanChat | CSteamID | Steam 群組聊天室的 Steam ID。 |
steamIDUser | CSteamID | 要檢查管理員狀態的使用者 Steam ID。 |
檢查 Steam 群組中的使用者是否為管理員。
傳回: bool
true ,如果指定的使用者是管理員。
false ,如果該使用者並非管理員、目前使用者並不在指定的聊天室,或指定的使用者不在聊天室中。
IsClanPublic
bool IsClanPublic( CSteamID steamIDClan );
名稱 | 型別 | 說明 |
steamIDClan | CSteamID | Steam 群組的 Steam ID。 |
檢查 Steam 群組是否公開。
傳回: bool
true ,如果指定的群組為公開群組。
false ,如果指定的群組並非公開群組。
IsClanOfficialGameGroup
bool IsClanOfficialGameGroup( CSteamID steamIDClan );
名稱 | 型別 | 說明 |
steamIDClan | CSteamID | Steam 群組的 Steam ID。 |
檢查 Steam 群組是否為官方遊戲群組或社群中心。
傳回: bool
true ,如果指定的群組是官方遊戲群組或社群中心。
false ,如果指定的群組並非官方遊戲群組或社群中心。
IsClanChatWindowOpenInSteam
bool IsClanChatWindowOpenInSteam( CSteamID steamIDClanChat );
名稱 | 型別 | 說明 |
steamIDClanChat | CSteamID | 要檢查的 Steam 群組聊天室的 Steam ID。 |
檢查該 Steam 群組聊天室是否有在 Steam UI 中開啟。
傳回: bool
true ,如果指定的 Steam 群組聊天室有在 Steam UI 中開啟;否則傳回
false。
如果指定的 Steam 群組聊天室不可知,也傳回
false。
另外請見: OpenClanChatWindowInSteam、
CloseClanChatWindowInSteamIsFollowing
SteamAPICall_t IsFollowing( CSteamID steamID );
名稱 | 型別 | 說明 |
steamID | CSteamID | 用於檢查是否為關注中的 Steam ID。 |
檢查目前使用者是否正在關注指定的使用者。
傳回: 用於
FriendsIsFollowing_t 呼叫結果的
SteamAPICall_t。
範例:class CIsFollowingExample
{
public:
CIsFollowingExample();
void CheckWhichFriendsWeAreFollowing();
private:
void OnFriendsIsFollowing( FriendsIsFollowing_t *pCallback, bool bIOFailure );
CCallResult< CIsFollowingExample, FriendsIsFollowing_t > m_SteamCallResultFriendsIsFollowing;
int m_nFriends;
int m_iFriendIndex;
};
CIsFollowingExample::CIsFollowingExample()
{
m_nFriends = SteamFriends()->GetFriendCount( k_EFriendFlagImmediate );
if ( m_nFriends == -1 )
{
printf( "GetFriendCount returned -1, the current user is not logged in.\n" );
m_nFriends = 0;
}
m_iFriendIndex = 0;
}
void CIsFollowingExample::CheckWhichFriendsWeAreFollowing()
{
if ( m_iFriendIndex < m_nFriends )
{
CSteamID steamID = SteamFriends()->GetFriendByIndex( m_iFriendIndex, k_EFriendFlagImmediate );
printf( "Checking if we follow %lld (%d of %d).\n", steamID.ConvertToUint64(), m_iFriendIndex, m_nFriends );
SteamAPICall_t handle = SteamFriends()->IsFollowing( steamID );
m_SteamCallResultFriendsIsFollowing.Set( handle, this, &CIsFollowingExample::OnFriendsIsFollowing );
}
}
void CIsFollowingExample::OnFriendsIsFollowing( FriendsIsFollowing_t *pCallback, bool bIOFailure )
{
if ( pCallback->m_eResult != k_EResultOK || bIOFailure )
{
printf( "OnFriendsIsFollowing failed for %lld with m_eResult: %d and bIOFailure: %d!\n", pCallback->m_steamID.ConvertToUint64(), pCallback->m_eResult, bIOFailure );
return;
}
if ( pCallback->m_bIsFollowing )
printf( "We are following %lld\n", pCallback->m_steamID.ConvertToUint64() );
// 以遞迴方式檢查整個好友名單
m_iFriendIndex++;
CheckWhichFriendsWeAreFollowing();
}
IsUserInSource
bool IsUserInSource( CSteamID steamIDUser, CSteamID steamIDSource );
檢查指定的使用者是否在來源中(Steam 群組、聊天室、大廳,或遊戲伺服器)。
傳回: bool
true ,如果本機使用者可見到
steamIDUser
為成員之一,或是在
steamIDSource
之中;否則傳回
false。
JoinClanChatRoom
SteamAPICall_t JoinClanChatRoom( CSteamID steamIDClan );
名稱 | 型別 | 說明 |
steamIDClan | CSteamID | 要加入的 Steam 群組的 Steam ID。 |
讓使用者在遊戲中加入 Steam 群組(隊伍)的交談。
此函式的行為會有些複雜,因為無法預測使用者是否在遊戲外或內嵌介面中已經加入群組聊天。
您可使用
ActivateGameOverlayToUser 來開啟內嵌介面版本的聊天。
若加入了 Steam 群組聊天,請注意以下回呼:
傳回: 用於
JoinClanChatRoomCompletionResult_t 呼叫結果的
SteamAPICall_t。
觸發
GameConnectedChatJoin_t 回呼。
觸發
GameConnectedClanChatMsg_t 回呼。
另外請見: LeaveClanChatRoom、
GetClanChatMemberCount、
GetChatMemberByIndex、
SendClanChatMessage、
GetClanChatMessage、
IsClanChatAdmin、
IsClanChatWindowOpenInSteamLeaveClanChatRoom
bool LeaveClanChatRoom( CSteamID steamIDClan );
名稱 | 型別 | 說明 |
steamIDClan | CSteamID | 要離開的 Steam 群組的 Steam ID。 |
離開先前使用者以
JoinClanChatRoom 加入的 Steam 群組聊天。
傳回: bool
觸發
GameConnectedChatLeave_t 回呼。
true ,如果使用者在指定的聊天室;否則傳回
false。
OpenClanChatWindowInSteam
bool OpenClanChatWindowInSteam( CSteamID steamIDClanChat );
名稱 | 型別 | 說明 |
steamIDClanChat | CSteamID | 要開啟的 Steam 群組聊天室的 Steam ID。 |
在 Steam UI 中開啟指定的 Steam 群組聊天室。
傳回: bool
true ,如果使用者成功進入指定的 Steam 群組聊天室。
false ,如果發生以下狀況:
- 提供的 Steam 群組聊天室不存在,或使用者沒有加入權限
- 目前的使用者有速度限制
- 目前的使用者被禁止聊天
另外請見: IsClanChatWindowOpenInSteam、
CloseClanChatWindowInSteamReplyToFriendMessage
bool ReplyToFriendMessage( CSteamID steamIDFriend, const char *pchMsgToSend );
名稱 | 型別 | 說明 |
steamIDFriend | CSteamID | 要傳送訊息的好友 Steam ID。 |
pchMsgToSend | const char * | 要傳送的 UTF-8 格式訊息。 |
傳送一則訊息給 Steam 好友。
傳回: bool
true ,如果訊息傳送成功。
false ,如果目前的使用者被禁止交談。
RequestClanOfficerList
SteamAPICall_t RequestClanOfficerList( CSteamID steamIDClan );
名稱 | 型別 | 說明 |
steamIDClan | CSteamID | 要取得幹部名單的 Steam 群組。 |
要求一位 Steam 群組幹部(管理員和板務)的資訊。
備註: 使用者須為 Steam 群組的成員,才能取得資訊。
備註: 無法自動下載幹部的個人圖示。 如果幹部的個人圖示無法使用,請呼叫
RequestUserInformation 來下載個人圖示。
傳回: 用於
ClanOfficerListResponse_t 呼叫結果的
SteamAPICall_t。
另外請見: GetClanOwner、
GetClanOfficerCount、
GetClanOfficerByIndex範例:class CClanOfficerListExample
{
public:
void RequestOfficerList();
private:
void OnClanOfficerListResponse( ClanOfficerListResponse_t *pCallback, bool bIOFailure );
CCallResult< CClanOfficerListExample, ClanOfficerListResponse_t > m_SteamCallResultClanOfficerListResponse;
};
void CClanOfficerListExample::RequestOfficerList()
{
printf( "Requesting the Clan Officer List\n" );
const CSteamID SteamworksDevGroup = 103582791433474333ull;
SteamAPICall_t handle = SteamFriends()->RequestClanOfficerList( SteamworksDevGroup );
m_SteamCallResultClanOfficerListResponse.Set( handle, this, &CClanOfficerListExample::OnClanOfficerListResponse );
}
void CClanOfficerListExample::OnClanOfficerListResponse( ClanOfficerListResponse_t *pCallback, bool bIOFailure )
{
if ( !pCallback->m_bSuccess || bIOFailure )
{
printf( "ClanOfficerListResponse failed for %lld!", pCallback->m_steamIDClan.ConvertToUint64() );
return;
}
printf( "Got a ClanOfficerListResponse for: %s (%lld)\n", SteamFriends()->GetClanName( pCallback->m_steamIDClan ), pCallback->m_steamIDClan.ConvertToUint64() );
CSteamID ownerSteamID = SteamFriends()->GetClanOwner(pCallback->m_steamIDClan);
printf( " The owner of the clan is: %s (%lld) and there are %d officers.\n", SteamFriends()->GetFriendPersonaName( ownerSteamID ),
ownerSteamID.ConvertToUint64(), pCallback->m_cOfficers );
int nOfficers = SteamFriends()->GetClanOfficerCount( pCallback->m_steamIDClan );
printf( " GetClanOfficerCount reports: %d", nOfficers );
for ( int i = 0; i < nOfficers; ++i )
{
CSteamID officerSteamID = SteamFriends()->GetClanOfficerByIndex( pCallback->m_steamIDClan, i );
printf( " Officer %d: %s (%lld)\n", i, SteamFriends()->GetFriendPersonaName(officerSteamID), officerSteamID.ConvertToUint64() );
}
}
RequestFriendRichPresence
void RequestFriendRichPresence( CSteamID steamIDFriend );
名稱 | 型別 | 說明 |
steamIDFriend | CSteamID | 要要求豐富狀態的使用者的 Steam ID。 |
要求指定使用者的豐富狀態資料。
此函式是用來取得非目前使用者好友的使用者的豐富狀態資訊,例如在同一大廳或遊戲伺服器的使用者。
此函式有速度限制,如果使用者太經常呼叫此函式,則會不向伺服器要求新資料,直接發出回呼。
傳回: InputSourceName
觸發
FriendRichPresenceUpdate_t 回呼。
另外請見: GetFriendRichPresence、
SetRichPresenceRequestUserInformation
bool RequestUserInformation( CSteamID steamIDUser, bool bRequireNameOnly );
名稱 | 型別 | 說明 |
steamIDUser | CSteamID | 要求資訊的使用者。 |
bRequireNameOnly | bool | 是否只需要個人暱稱(true)? 或暱稱與圖示皆需要(false)? |
要求指定使用者的個人暱稱,也可同時要求個人圖示。
備註: 備註:下載個人圖示相當緩慢,並且會占用本機快取,所以如果不需要個人圖示,便不要要求。
傳回: bool
觸發
PersonaStateChange_t 回呼。
true 表示資料要求已送出,而收到資料時將會發出
PersonaStateChange_t 回呼。
false 表示我們已經有了該使用者的詳細資料,而需要這些資訊的函式可立即使用。
SendClanChatMessage
bool SendClanChatMessage( CSteamID steamIDClanChat, const char *pchText );
名稱 | 型別 | 說明 |
steamIDClanChat | CSteamID | 要將訊息傳送至的群組聊天的 Steam ID。 |
pchText | const char * | 要傳送的 UTF-8 格式訊息。 訊息可長達 2048 個字元。 |
發送一個訊息至 Steam 群組聊天室。
傳回: bool
true ,如果訊息傳送成功。
false ,如果發生以下狀況:
- 目前的使用者並不在指定的群組聊天中
- 目前的使用者並未連線至 Steam
- 目前的使用者有速度限制
- 目前的使用者被禁止聊天
-
pchText
中的訊息超過了 2048 個字元
SetInGameVoiceSpeaking
void SetInGameVoiceSpeaking( CSteamID steamIDUser, bool bSpeaking );
名稱 | 型別 | 說明 |
steamIDUser | CSteamID | 未使用。 |
bSpeaking | bool | 使用者在遊戲中開始(true)或停止(false)了說話? |
讓 Steam 知道使用者目前是否正在遊戲中使用語音交談。
此函式將停止 Steam UI 中所有語音通訊的麥克風。
SetListenForFriendsMessages
bool SetListenForFriendsMessages( bool bInterceptEnabled );
名稱 | 型別 | 說明 |
bInterceptEnabled | bool | 開啟(true)或關閉(false)接收好友訊息? |
監聽 Steam 好友的聊天訊息。
您可用來顯示於遊戲介面中。 For example, the chat system in Dota 2.
After enabling this you will receive
GameConnectedFriendChatMsg_t callbacks whenever the user receives a chat message. 您可使用
GetFriendMessage 從回呼中取出實際的訊息資料。 您可使用
ReplyToFriendMessage 來傳送訊息。
傳回: bool
觸發
GameConnectedFriendChatMsg_t 回呼。
永遠傳回
true。
SetPersonaName
SteamAPICall_t SetPersonaName( const char *pchPersonaName );
名稱 | 型別 | 說明 |
pchPersonaName | const char * | 使用者的新顯示名稱。 不可比 k_cchPersonaNameMax 個位元組長。 |
Sets the current user's persona name, stores it on the server and publishes the changes to all friends who are online.
變更將立刻在本機生效,並送出一個
PersonaStateChange_t 回呼,預先假定函式已成功。
如果伺服器變更名稱失敗,除了呼叫結果中的最終結果以外,另外送出一個
PersonaStateChange_t 回呼改回原來的名稱。
傳回: 用於
SetPersonaNameResponse_t 呼叫結果的
SteamAPICall_t。
SetPlayedWith
void SetPlayedWith( CSteamID steamIDUserPlayedWith );
名稱 | 型別 | 說明 |
steamIDUserPlayedWith | CSteamID | 曾經一同遊戲過的另一位使用者。 |
將目標使用者標記為「一同遊戲過」。
備註: 目前的使用者必須與另一位玩家一同在遊戲中才能產生關聯。
您可於 Steam 社群的
此處或
Steam 內嵌介面檢視您最近一同遊戲過的玩家。
SetRichPresence
bool SetRichPresence( const char *pchKey, const char *pchValue );
設定目前使用者的豐富狀態索引碼 / 值,並自動分享給所有遊玩相同遊戲好友。
如
k_cchMaxRichPresenceKeys 中所規範的,每位使用者最多可有 20 個索引碼。
檢視和加入遊戲則有兩種特殊的索引碼:
- 「status」 - 出現於 Steam 好友名單中「看遊戲資訊」對話方塊的 UTF-8 字串
- 「connect」 - 讓好友能連線至遊戲的指令列 UTF-8 字串。 這將啟用「看遊戲資訊」對話方塊中的「加入遊戲」按鈕,位於右鍵點擊 Steam 好友名單時的選單,以及玩家的 Steam 社群個人檔案中。 Be sure your app implements ISteamApps::GetLaunchCommandLine so you can disable the popup warning when launched via a command line.
新 Steam 聊天另有三個特殊索引碼:
- 「steam_display」- 為一個豐富狀態的在地化索引碼命名,該索引碼將在 Steam 用戶端使用者介面中以使用者選擇的語言顯示。 請見豐富狀態在地化以了解更多詳情,其中包含測試此豐富狀態資料的頁面連結。 如果 steam_display 並未設定為有效的在地化標籤,則豐富狀態將不會在 Steam 用戶端中顯示。
- 「steam_player_group」- 設定時,向 Steam 用戶端表示該玩家為特定群組成員。 同一群組中的玩家在 Steam 使用者介面中各處可組織在一起。 此字串能辨識團隊、伺服器,或任何與您遊戲相關的群組。 字串本身不會對使用者顯示。
- 「steam_player_group_size」- 設定時,說明 steam_player_group 中的玩家總人數。 若並非所有成員都在某玩家的好友名單中, Steam 用戶端可能會用此數字來顯示某群組的額外資料 (例如,「Bob、Pete 和其他 4 人」)。
您可使用 ClearRichPresence 清除目前使用者所有的索引碼。
如要取得好友的豐富狀態索引碼,請見:GetFriendRichPresence。
傳回: bool
true ,如果豐富狀態設定成功。
false ,如果發生以下狀況:
RequestEquippedProfileItems
SteamAPICall_t RequestEquippedProfileItems( CSteamID steamID);
名稱 | 型別 | 說明 |
steamID | CSteamID | The user that you want to retrieve equipped items for. |
Requests the list of equipped Steam Community profile items for the given user from Steam.
Returns: SteamAPICall_t to be used with a EquippedProfileItems_t call result.BHasEquippedProfileItem
bool BHasEquippedProfileItem( CSteamID steamID, ECommunityProfileItemType itemType);
After calling RequestEquippedProfileItems, you can use this function to check if the user has a type of profile item equipped or not.
Returns: bool
true if the itemType is equipped for the user
false if the itemType is not equipped for the user
See Also: RequestEquippedProfileItems, GetProfileItemPropertyString, GetProfileItemPropertyUintGetProfileItemPropertyString
bool GetProfileItemPropertyString( CSteamID steamID, ECommunityProfileItemType itemType, ECommunityProfileItemProperty prop);
Returns a string property for a user's equipped profile item.
Returns: const char *
See Also: RequestEquippedProfileItems, GetProfileItemPropertyUintGetProfileItemPropertyUint
bool GetProfileItemPropertyUint( CSteamID steamID, ECommunityProfileItemType itemType, ECommunityProfileItemProperty prop);
Returns an unsigned integer property for a user's equipped profile item.
Returns: uint32
See Also: RequestEquippedProfileItems, GetProfileItemPropertyString回呼
These are callbacks which can be fired by calling SteamAPI_RunCallbacks. Many of these will be fired directly in response to the member functions of ISteamFriends
.AvatarImageLoaded_t
Called when a large avatar is loaded if you have tried requesting it when it was unavailable.
名稱 | 型別 | 說明 |
m_steamID | CSteamID | The Steam ID that the avatar has been loaded for. |
m_iImage | int | The Steam image handle of the now loaded image. |
m_iWide | int | Width of the loaded image. |
m_iTall | int | Height of the loaded image. |
關聯函式: GetLargeFriendAvatarClanOfficerListResponse_t
Marks the return of a request officer list call.
名稱 | 型別 | 說明 |
m_steamIDClan | CSteamID | The Steam group that we just got the officer list for. |
m_cOfficers | int | The number of officers in the group. This is the same as GetClanOfficerCount. |
m_bSuccess | uint8 | Was the call successful? If it wasn't this may indicate a temporary loss of connection to Steam. If this returns true, this does not necessarily mean that all of the info for this Steam group has been downloaded. |
關聯函式: RequestClanOfficerListDownloadClanActivityCountsResult_t
Called when a Steam group activity has been received.
名稱 | 型別 | 說明 |
m_bSuccess | bool | Was the call successful? |
關聯函式: DownloadClanActivityCountsFriendRichPresenceUpdate_t
Called when Rich Presence data has been updated for a user, this can happen automatically when friends in the same game update their rich presence, or after a call to RequestFriendRichPresence.
名稱 | 型別 | 說明 |
m_steamIDFriend | CSteamID | The Steam ID of the user who's rich presence has changed. |
m_nAppID | AppId_t | The App ID of the game. This should always be the current game. |
關聯函式: RequestFriendRichPresenceFriendsEnumerateFollowingList_t
Returns the result of EnumerateFollowingList.
名稱 | 型別 | 說明 |
m_eResult | EResult | The result of the operation. |
m_rgSteamID | CSteamID[k_cEnumerateFollowersMax] | The list of users that we are following. |
m_nResultsReturned | int32 | The number of results returned in m_rgSteamID . |
m_nTotalResultCount | int32 | The total number of people we are following. If this is greater than m_nResultsReturned Then you should make a subsequent call to EnumerateFollowingList with m_nResultsReturned as the index to get the next portion of followers. |
關聯函式: EnumerateFollowingListFriendsGetFollowerCount_t
Returns the result of GetFollowerCount.
名稱 | 型別 | 說明 |
m_eResult | EResult | The result of the operation. |
m_steamID | CSteamID | The Steam ID of the user we requested the follower count for. |
m_nCount | int | The number of followers the user has. |
關聯函式: GetFollowerCountFriendsIsFollowing_t
Returns the result of IsFollowing.
名稱 | 型別 | 說明 |
m_eResult | EResult | The result of the operation. |
m_steamID | CSteamID | The Steam ID that was checked. |
m_bIsFollowing | bool | Are we following the user? (true) or not? (false) |
Associated Functions: IsFollowingGameConnectedChatJoin_t
Called when a user has joined a Steam group chat that we are in.
名稱 | 型別 | 說明 |
m_steamIDClanChat | CSteamID | The Steam ID of the chat that a user has joined. |
m_steamIDUser | CSteamID | The Steam ID of the user that has joined the chat. |
Associated Functions: JoinClanChatRoomGameConnectedChatLeave_t
Called when a user has left a Steam group chat that the we are in.
名稱 | 型別 | 說明 |
m_steamIDClanChat | CSteamID | The Steam ID of the chat that a user has left. |
m_steamIDUser | CSteamID | The Steam ID of the user that has left the chat. |
m_bKicked | bool | Was the user kicked by an officer (true), or not (false)? |
m_bDropped | bool | Was the user's connection to Steam dropped (true), or did they leave via other means (false)? |
Associated Functions: LeaveClanChatRoomGameConnectedClanChatMsg_t
Called when a chat message has been received in a Steam group chat that we are in.
名稱 | 型別 | 說明 |
m_steamIDClanChat | CSteamID | The Steam ID of the chat that the message was received in. |
m_steamIDUser | CSteamID | The Steam ID of the user that sent the message. |
m_iMessageID | int | The index of the message to get the actual data from with GetClanChatMessage. |
Associated Functions: JoinClanChatRoomGameConnectedFriendChatMsg_t
Called when chat message has been received from a friend.
名稱 | 型別 | 說明 |
m_steamIDUser | CSteamID | The Steam ID of the friend that sent the message. |
m_iMessageID | int | The index of the message to get the actual data from with GetFriendMessage. |
Associated Functions: SetListenForFriendsMessagesGameLobbyJoinRequested_t
Called when the user tries to join a lobby from their friends list or from an invite. The game client should attempt to connect to specified lobby when this is received. If the game isn't running yet then the game will be automatically launched with the command line parameter +connect_lobby <64-bit lobby Steam ID>
instead.
名稱 | 型別 | 說明 |
m_steamIDLobby | CSteamID | The Steam ID of the lobby to connect to. |
m_steamIDFriend | CSteamID | The friend they joined through. This will be invalid if not directly via a friend. |
NOTE: This callback is made when joining a lobby. If the user is attempting to join a game but not a lobby, then the callback GameRichPresenceJoinRequested_t will be made.GameOverlayActivated_t
Posted when the Steam 內嵌介面 activates or deactivates. The game can use this to pause or resume single player games.
名稱 | 型別 | 說明 |
m_bActive | uint8 | 1 if it's just been activated, otherwise 0. |
GameRichPresenceJoinRequested_t
Called when the user tries to join a game from their friends list or after a user accepts an invite by a friend with InviteUserToGame.
名稱 | 型別 | 說明 |
m_steamIDFriend | CSteamID | The friend they joined through. This will be invalid if not directly via a friend. |
m_rgchConnect | char[k_cchMaxRichPresenceValueLength] | The value associated with the "connect" Rich Presence key. |
Associated Functions: InviteUserToGame
NOTE: This callback is made when joining a game. If the user is attempting to join a lobby, then the callback GameLobbyJoinRequested_t will be made.GameServerChangeRequested_t
Called when the user tries to join a different game server from their friends list. The game client should attempt to connect to the specified server when this is received.
名稱 | 型別 | 說明 |
m_rgchServer | char[64] | Server address (e.g. "127.0.0.1:27015", "tf2.valvesoftware.com") |
m_rgchPassword | char[64] | Server password, if any. |
JoinClanChatRoomCompletionResult_t
Posted when the user has attempted to join a Steam group chat via JoinClanChatRoom
名稱 | 型別 | 說明 |
m_steamIDClanChat | CSteamID | The Steam ID of the chat that the user has joined. |
m_eChatRoomEnterResponse | EChatRoomEnterResponse | The result of the operation. |
Associated Functions: JoinClanChatRoomPersonaStateChange_t
Called whenever a friends' status changes.
名稱 | Type | 說明 |
m_ulSteamID | uint64 | Steam ID of the user who changed. |
m_nChangeFlags | int | A bit-wise union of EPersonaChange values. |
Associated Functions: RequestUserInformationSetPersonaNameResponse_t
Reports the result of an attempt to change the current user's persona name.
名稱 | Type | 說明 |
m_bSuccess | bool | true if name change completed successfully. |
m_bLocalSuccess | bool | true if name change was retained locally. We might not have been able to communicate with Steam. |
m_result | EResult | The result of the operation. |
Associated Functions: SetPersonaName結構
These are structs which functions in ISteamFriends may return and/or interact with.FriendGameInfo_t
Information about the game a friend is playing.
Obtainable from: GetFriendGamePlayed.
名稱 | Type | 說明 |
m_gameID | CGameID | The game ID that the friend is playing. |
m_unGameIP | uint32 | The IP of the server the friend is playing on. |
m_usGamePort | uint16 | The port of the server the friend is playing on. |
m_usQueryPort | uint16 | The query port of the server the friend is playing on. |
m_steamIDLobby | CSteamID | The Steam ID of the lobby the friend is in. |
FriendSessionStateInfo_t
Information about user sessions. (Steam Internal usage only.)
名稱 | Type | 說明 |
m_uiOnlineSessionInstances | uint32 | |
m_uiPublishedToFriendsSessionInstance | uint8 | |
EquippedProfileItemsChanged_t
Callback for when a user's equipped Steam Community profile items have changed. This can be for the current user or their friends.
EquippedProfileItems_t
CallResult from RequestEquippedProfileItems. Also sent as a Callback.
名稱 | Type | 說明 |
m_eResult | EResult | |
m_bHasAnimatedAvatar | CSteamID | |
m_bHasAvatarFrame | bool | |
m_bHasProfileModifier | bool | |
m_bHasProfileBackground | bool | |
m_bHasMiniProfileBackground | bool | |
列舉
These are enums which are defined for use with ISteamFriends.EFriendFlags
Flags for enumerating friends list, or quickly checking the relationship between users.
名稱 | Value | 說明 |
k_EFriendFlagNone | 0x00 | None. |
k_EFriendFlagBlocked | 0x01 | Users that the current user has blocked from contacting. |
k_EFriendFlagFriendshipRequested | 0x02 | Users that have sent a friend invite to the current user. |
k_EFriendFlagImmediate | 0x04 | The current user's "regular" friends. |
k_EFriendFlagClanMember | 0x08 | Users that are in one of the same (small) Steam groups as the current user. |
k_EFriendFlagOnGameServer | 0x10 | Users that are on the same game server; as set by SetPlayedWith. |
k_EFriendFlagRequestingFriendship | 0x80 | Users that the current user has sent friend invites to. |
k_EFriendFlagRequestingInfo | 0x100 | Users that are currently sending additional info about themselves after a call to RequestUserInformation |
k_EFriendFlagIgnored | 0x200 | Users that the current user has ignored from contacting them. |
k_EFriendFlagIgnoredFriend | 0x400 | Users that have ignored the current user; but the current user still knows about them. |
k_EFriendFlagChatMember | 0x1000 | Users in one of the same chats. |
k_EFriendFlagAll | 0xFFFF | Returns all friend flags. |
EFriendRelationship
Declares the set of relationships that Steam users may have.
名稱 | Value | Description |
k_EFriendRelationshipNone | 0 | The users have no relationship. |
k_EFriendRelationshipBlocked | 1 | The user has just clicked Ignore on an friendship invite. This doesn't get stored. |
k_EFriendRelationshipRequestRecipient | 2 | The user has requested to be friends with the current user. |
k_EFriendRelationshipFriend | 3 | A "regular" friend. |
k_EFriendRelationshipRequestInitiator | 4 | The current user has sent a friend invite. |
k_EFriendRelationshipIgnored | 5 | The current user has explicit blocked this other user from comments/chat/etc. This is stored. |
k_EFriendRelationshipIgnoredFriend | 6 | The user has ignored the current user. |
k_EFriendRelationshipSuggested_DEPRECATED | 7 | Deprecated -- Unused. |
k_EFriendRelationshipMax | 8 | The total number of friend relationships used for looping and verification. |
EOverlayToStoreFlag
These values are passed as parameters to the store with ActivateGameOverlayToStore and modify the behavior when the page opens.
Name | Value | Description |
k_EOverlayToStoreFlag_None | 0 | No |
k_EOverlayToStoreFlag_AddToCart | 1 | Deprecated, now works the same as k_EOverlayToStoreFlag_AddToCartAndShow. |
k_EOverlayToStoreFlag_AddToCartAndShow | 2 | Add the specified app ID to the users cart and show the store page. |
EPersonaChange
used in PersonaStateChange_t::m_nChangeFlags to describe what's changed about a user
these flags describe what the client has learned has changed recently, so on startup you'll see a name, avatar & relationship change for every friend
Name | Value | Description |
k_EPersonaChangeName | 0x0001 | |
k_EPersonaChangeStatus | 0x0002 | |
k_EPersonaChangeComeOnline | 0x0004 | |
k_EPersonaChangeGoneOffline | 0x0008 | |
k_EPersonaChangeGamePlayed | 0x0010 | |
k_EPersonaChangeGameServer | 0x0020 | |
k_EPersonaChangeAvatar | 0x0040 | |
k_EPersonaChangeJoinedSource | 0x0080 | |
k_EPersonaChangeLeftSource | 0x0100 | |
k_EPersonaChangeRelationshipChanged | 0x0200 | |
k_EPersonaChangeNameFirstSet | 0x0400 | |
k_EPersonaChangeFacebookInfo | 0x0800 | |
k_EPersonaChangeNickname | 0x1000 | |
k_EPersonaChangeSteamLevel | 0x2000 | |
EPersonaState
List of states a Steam friend can be in.
Name | Value | Description |
k_EPersonaStateOffline | 0 | Friend is not currently logged on. |
k_EPersonaStateOnline | 1 | Friend is logged on. |
k_EPersonaStateBusy | 2 | Friend is logged on, but set to "Do not disturb." |
k_EPersonaStateAway | 3 | Auto-away feature. |
k_EPersonaStateSnooze | 4 | Auto-away for a long time. |
k_EPersonaStateLookingToTrade | 5 | Online, trading. |
k_EPersonaStateLookingToPlay | 6 | Online, wanting to play. |
k_EPersonaStateMax | 7 | The total number of states. Only used for looping and validation. |
EUserRestriction
User restriction flags. These are returned by GetUserRestrictions.
Name | Value | Description |
k_nUserRestrictionNone | 0 | No known chat/content restriction. |
k_nUserRestrictionUnknown | 1 | We don't know yet, the user is offline. |
k_nUserRestrictionAnyChat | 2 | User is not allowed to (or can't) send/recv any chat. |
k_nUserRestrictionVoiceChat | 4 | User is not allowed to (or can't) send/recv voice chat. |
k_nUserRestrictionGroupChat | 8 | User is not allowed to (or can't) send/recv group chat. |
k_nUserRestrictionRating | 16 | User is too young according to rating in current region. |
k_nUserRestrictionGameInvites | 32 | User cannot send or recv game invites, for example if they are on mobile. |
k_nUserRestrictionTrading | 64 | User cannot participate in trading, for example if they are on a console or mobile. |
ECommunityProfileItemType
Steam Community profile item types
ECommunityProfileItemProperty
Properties on a Steam Community profile item. See GetProfileItemPropertyString and GetProfileItemPropertyUint.
EActivateGameOverlayToWebPageMode
Game Overlay web page modes
Name | Value | Description |
k_EActivateGameOverlayToWebPageMode_Default | 0 | Browser will open next to all other windows that the user has open in the overlay. The window will remain open, even if the user closes then re-opens the overlay. |
k_EActivateGameOverlayToWebPageMode_Modal | 1 | Browser will be opened in a special overlay configuration which hides all other windows that the user has open in the overlay. When the user closes the overlay, the browser window will also close. When the user closes the browser window, the overlay will automatically close. |
Typedefs
These are typedefs which are defined for use with ISteamFriends.
Name | Base type | Description |
FriendsGroupID_t | int16 | Friends group (tags) identifier. |
常數
These are constants which are defined for use with ISteamFriends.
Name | Type | Value | Description |
k_cchMaxFriendsGroupName | int | 64 | The maximum length that a friends group name can be (not including the null-terminator!) |
k_cchMaxRichPresenceKeyLength | int | 64 | The maximum length that a rich presence key can be. |
k_cchMaxRichPresenceKeys | int | 20 | The maximum amount of rich presence keys that can be set. |
k_cchMaxRichPresenceValueLength | int | 256 | The maximum length that a rich presence value can be. |
k_cchPersonaNameMax | int | 128 | Maximum number of UTF-8 bytes in a users persona (display) name. |
k_cEnumerateFollowersMax | int | 50 | The maximum number of followers that will be returned in a FriendsEnumerateFollowingList_t call result at once. |
k_cFriendsGroupLimit | int | 100 | Deprecated - Unused. |
k_cubChatMetadataMax | uint32 | 8192 | Maximum size in bytes that chat room, lobby, or chat/lobby member metadata may have. |
k_cwchPersonaNameMax | int | 32 | The maximum amount of UTF-16 characters in a users persona (display) name. |
k_FriendsGroupID_Invalid | FriendsGroupID_t | -1 | Invalid friends group identifier. |
STEAMFRIENDS_INTERFACE_VERSION | const char * | "SteamFriends015" | |
豐富狀態在地化
Localization for rich presence is a list of token names and values provided for each supported language. Token names begin a # and can contain any alphanumeric character and underscores. Token values contain localized text, and may also contain substitutions, which specify portions of the string to be replaced by other rich presence values.
- 最簡單的索引碼即是純在地化文字:
"#Status_AtMainMenu" "At the Main Menu"
在上例中,如果 steam_display
使用 SetRichPresence 設置為 #Status_AtMainMenu
,則 "At the Main Menu
" 將在 Steam 用戶端中與玩家資訊一起顯示。
- 取代範例如下:
"#StatusWithScore" "Score: %score%"
在此例中,如果 steam_display
使用 SetRichPresence 設置為 "#StatusWithScore
",且 "score
" 使用同一個 API 設置為 "3
",則 "Score: 3
" 將在 Steam 用戶端中與玩家資訊一起顯示。
- 取代也可能透過將子字串放在括號中來觸發額外的在地化。 例如:
"#PlayingHero" "Playing: {#Hero_%hero%}"
"#Hero_Tidehunter" "Tidehunter"
以括號分隔的子字串會先進行取代,因而產生的標籤會接著在地化。 在此例中,如果 steam_display
設置為 "#PlayingHero
",且 "hero
" 設置為 "Tidehunter
",則 Steam 用戶端將在地化 "#Hero_Tidehunter
" 並顯示 "Playing: Tidehunter
"。
備註:用於取代的豐富狀態索引碼只能包含英數字字元、底線及冒號。
若搜尋不到在地化索引碼,系統將嘗試以英文遞補。 若英文也搜尋不到,則 Steam 用戶端將不會顯示豐富狀態。 同樣的,如果某索引碼指定使用某個未設置的豐富狀態索引碼進行取代,則 Steam 用戶端不會顯示豐富狀態。
遊戲開發者應於編輯 Steamworks 設定頁面中,社群分頁之下的豐富狀態欄位提供豐富狀態在地化檔案。
若要測試,可使用 http://www.steamcommunity.com/dev/testrichpresence 對已登入的使用者顯示在地化的豐富狀態字串,也可顯示一些有關不完整或不正確資料的訊息。 字串將在地化為 Steam 網站所設定的任一語言。
每種語言亦可分別上傳檔案,範例如下:
"lang"
{
"english"
{
"tokens"
{
"#StatusWithoutScore" "{#Status_%gamestatus%}"
"#StatusWithScore" "{#Status_%gamestatus%}: %score%"
"#Status_AtMainMenu" "At the main menu"
"#Status_WaitingForMatch" "Waiting for match"
"#Status_Winning" "Winning"
"#Status_Losing" "Losing"
"#Status_Tied" "Tied"
}
}
}
一次可上傳多種語言, 只有目前在檔案中的語言會被覆寫。
"lang"
{
"english"
{
"tokens"
{
"#StatusWithoutScore" "{#Status_%gamestatus%}"
"#StatusWithScore" "{#Status_%gamestatus%}: %score%"
"#Status_AtMainMenu" "At the main menu"
"#Status_WaitingForMatch" "Waiting for match"
"#Status_Winning" "Winning"
"#Status_Losing" "Losing"
"#Status_Tied" "Tied"
}
}
"french"
{
"tokens"
{
"#Status_AtMainMenu" "Au menu principal"
"#Status_WaitingForMatch" "En attente de match"
"#Status_Winning" "Gagnant"
"#Status_Losing" "Perdant"
"#Status_Tied" "Egalité"
}
}
}