// This file is provided under The MIT License as part of Steamworks.NET. // Copyright (c) 2013-2019 Riley Labrecque // Please see the included LICENSE.txt for additional information. // This file is automatically generated. // Changes to this file will be reverted when you update Steamworks.NET #if UNITY_ANDROID || UNITY_IOS || UNITY_TIZEN || UNITY_TVOS || UNITY_WEBGL || UNITY_WSA || UNITY_PS4 || UNITY_WII || UNITY_XBOXONE || UNITY_SWITCH #define DISABLESTEAMWORKS #endif #if !DISABLESTEAMWORKS using System.Runtime.InteropServices; using IntPtr = System.IntPtr; namespace Steamworks { public static class SteamFriends { /// /// returns the local players name - guaranteed to not be NULL. /// this is the same name as on the users community profile page /// this is stored in UTF-8 format /// like all the other interface functions that return a char *, it's important that this pointer is not saved /// off; it will eventually be free'd or re-allocated /// public static string GetPersonaName() { InteropHelp.TestIfAvailableClient(); return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetPersonaName(CSteamAPIContext.GetSteamFriends())); } /// /// Sets the player name, stores it on the server and publishes the changes to all friends who are online. /// Changes take place locally immediately, and a PersonaStateChange_t is posted, presuming success. /// The final results are available through the return value SteamAPICall_t, using SetPersonaNameResponse_t. /// If the name change fails to happen on the server, then an additional global PersonaStateChange_t will be posted /// to change the name back, in addition to the SetPersonaNameResponse_t callback. /// public static SteamAPICall_t SetPersonaName(string pchPersonaName) { InteropHelp.TestIfAvailableClient(); using (var pchPersonaName2 = new InteropHelp.UTF8StringHandle(pchPersonaName)) { return (SteamAPICall_t)NativeMethods.ISteamFriends_SetPersonaName(CSteamAPIContext.GetSteamFriends(), pchPersonaName2); } } /// /// gets the status of the current user /// public static EPersonaState GetPersonaState() { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetPersonaState(CSteamAPIContext.GetSteamFriends()); } /// /// friend iteration /// takes a set of k_EFriendFlags, and returns the number of users the client knows about who meet that criteria /// then GetFriendByIndex() can then be used to return the id's of each of those users /// public static int GetFriendCount(EFriendFlags iFriendFlags) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetFriendCount(CSteamAPIContext.GetSteamFriends(), iFriendFlags); } /// /// returns the steamID of a user /// iFriend is a index of range [0, GetFriendCount()) /// iFriendsFlags must be the same value as used in GetFriendCount() /// the returned CSteamID can then be used by all the functions below to access details about the user /// public static CSteamID GetFriendByIndex(int iFriend, EFriendFlags iFriendFlags) { InteropHelp.TestIfAvailableClient(); return (CSteamID)NativeMethods.ISteamFriends_GetFriendByIndex(CSteamAPIContext.GetSteamFriends(), iFriend, iFriendFlags); } /// /// returns a relationship to a user /// public static EFriendRelationship GetFriendRelationship(CSteamID steamIDFriend) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetFriendRelationship(CSteamAPIContext.GetSteamFriends(), steamIDFriend); } /// /// returns the current status of the specified user /// this will only be known by the local user if steamIDFriend is in their friends list; on the same game server; in a chat room or lobby; or in a small group with the local user /// public static EPersonaState GetFriendPersonaState(CSteamID steamIDFriend) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetFriendPersonaState(CSteamAPIContext.GetSteamFriends(), steamIDFriend); } /// /// returns the name another user - guaranteed to not be NULL. /// same rules as GetFriendPersonaState() apply as to whether or not the user knowns the name of the other user /// note that on first joining a lobby, chat room or game server the local user will not known the name of the other users automatically; that information will arrive asyncronously /// public static string GetFriendPersonaName(CSteamID steamIDFriend) { InteropHelp.TestIfAvailableClient(); return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetFriendPersonaName(CSteamAPIContext.GetSteamFriends(), steamIDFriend)); } /// /// returns true if the friend is actually in a game, and fills in pFriendGameInfo with an extra details /// public static bool GetFriendGamePlayed(CSteamID steamIDFriend, out FriendGameInfo_t pFriendGameInfo) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetFriendGamePlayed(CSteamAPIContext.GetSteamFriends(), steamIDFriend, out pFriendGameInfo); } /// /// accesses old friends names - returns an empty string when their are no more items in the history /// public static string GetFriendPersonaNameHistory(CSteamID steamIDFriend, int iPersonaName) { InteropHelp.TestIfAvailableClient(); return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetFriendPersonaNameHistory(CSteamAPIContext.GetSteamFriends(), steamIDFriend, iPersonaName)); } /// /// friends steam level /// public static int GetFriendSteamLevel(CSteamID steamIDFriend) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetFriendSteamLevel(CSteamAPIContext.GetSteamFriends(), steamIDFriend); } /// /// Returns nickname the current user has set for the specified player. Returns NULL if the no nickname has been set for that player. /// DEPRECATED: GetPersonaName follows the Steam nickname preferences, so apps shouldn't need to care about nicknames explicitly. /// public static string GetPlayerNickname(CSteamID steamIDPlayer) { InteropHelp.TestIfAvailableClient(); return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetPlayerNickname(CSteamAPIContext.GetSteamFriends(), steamIDPlayer)); } /// /// friend grouping (tag) apis /// returns the number of friends groups /// public static int GetFriendsGroupCount() { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetFriendsGroupCount(CSteamAPIContext.GetSteamFriends()); } /// /// returns the friends group ID for the given index (invalid indices return k_FriendsGroupID_Invalid) /// public static FriendsGroupID_t GetFriendsGroupIDByIndex(int iFG) { InteropHelp.TestIfAvailableClient(); return (FriendsGroupID_t)NativeMethods.ISteamFriends_GetFriendsGroupIDByIndex(CSteamAPIContext.GetSteamFriends(), iFG); } /// /// returns the name for the given friends group (NULL in the case of invalid friends group IDs) /// public static string GetFriendsGroupName(FriendsGroupID_t friendsGroupID) { InteropHelp.TestIfAvailableClient(); return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetFriendsGroupName(CSteamAPIContext.GetSteamFriends(), friendsGroupID)); } /// /// returns the number of members in a given friends group /// public static int GetFriendsGroupMembersCount(FriendsGroupID_t friendsGroupID) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetFriendsGroupMembersCount(CSteamAPIContext.GetSteamFriends(), friendsGroupID); } /// /// gets up to nMembersCount members of the given friends group, if fewer exist than requested those positions' SteamIDs will be invalid /// public static void GetFriendsGroupMembersList(FriendsGroupID_t friendsGroupID, CSteamID[] pOutSteamIDMembers, int nMembersCount) { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamFriends_GetFriendsGroupMembersList(CSteamAPIContext.GetSteamFriends(), friendsGroupID, pOutSteamIDMembers, nMembersCount); } /// /// returns true if the specified user meets any of the criteria specified in iFriendFlags /// iFriendFlags can be the union (binary or, |) of one or more k_EFriendFlags values /// public static bool HasFriend(CSteamID steamIDFriend, EFriendFlags iFriendFlags) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_HasFriend(CSteamAPIContext.GetSteamFriends(), steamIDFriend, iFriendFlags); } /// /// clan (group) iteration and access functions /// public static int GetClanCount() { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetClanCount(CSteamAPIContext.GetSteamFriends()); } public static CSteamID GetClanByIndex(int iClan) { InteropHelp.TestIfAvailableClient(); return (CSteamID)NativeMethods.ISteamFriends_GetClanByIndex(CSteamAPIContext.GetSteamFriends(), iClan); } public static string GetClanName(CSteamID steamIDClan) { InteropHelp.TestIfAvailableClient(); return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetClanName(CSteamAPIContext.GetSteamFriends(), steamIDClan)); } public static string GetClanTag(CSteamID steamIDClan) { InteropHelp.TestIfAvailableClient(); return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetClanTag(CSteamAPIContext.GetSteamFriends(), steamIDClan)); } /// /// returns the most recent information we have about what's happening in a clan /// public static bool GetClanActivityCounts(CSteamID steamIDClan, out int pnOnline, out int pnInGame, out int pnChatting) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetClanActivityCounts(CSteamAPIContext.GetSteamFriends(), steamIDClan, out pnOnline, out pnInGame, out pnChatting); } /// /// for clans a user is a member of, they will have reasonably up-to-date information, but for others you'll have to download the info to have the latest /// public static SteamAPICall_t DownloadClanActivityCounts(CSteamID[] psteamIDClans, int cClansToRequest) { InteropHelp.TestIfAvailableClient(); return (SteamAPICall_t)NativeMethods.ISteamFriends_DownloadClanActivityCounts(CSteamAPIContext.GetSteamFriends(), psteamIDClans, cClansToRequest); } /// /// iterators for getting users in a chat room, lobby, game server or clan /// note that large clans that cannot be iterated by the local user /// note that the current user must be in a lobby to retrieve CSteamIDs of other users in that lobby /// steamIDSource can be the steamID of a group, game server, lobby or chat room /// public static int GetFriendCountFromSource(CSteamID steamIDSource) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetFriendCountFromSource(CSteamAPIContext.GetSteamFriends(), steamIDSource); } public static CSteamID GetFriendFromSourceByIndex(CSteamID steamIDSource, int iFriend) { InteropHelp.TestIfAvailableClient(); return (CSteamID)NativeMethods.ISteamFriends_GetFriendFromSourceByIndex(CSteamAPIContext.GetSteamFriends(), steamIDSource, iFriend); } /// /// returns true if the local user can see that steamIDUser is a member or in steamIDSource /// public static bool IsUserInSource(CSteamID steamIDUser, CSteamID steamIDSource) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_IsUserInSource(CSteamAPIContext.GetSteamFriends(), steamIDUser, steamIDSource); } /// /// User is in a game pressing the talk button (will suppress the microphone for all voice comms from the Steam friends UI) /// public static void SetInGameVoiceSpeaking(CSteamID steamIDUser, bool bSpeaking) { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamFriends_SetInGameVoiceSpeaking(CSteamAPIContext.GetSteamFriends(), steamIDUser, bSpeaking); } /// /// activates the game overlay, with an optional dialog to open /// valid options include "Friends", "Community", "Players", "Settings", "OfficialGameGroup", "Stats", "Achievements", /// "chatroomgroup/nnnn" /// public static void ActivateGameOverlay(string pchDialog) { InteropHelp.TestIfAvailableClient(); using (var pchDialog2 = new InteropHelp.UTF8StringHandle(pchDialog)) { NativeMethods.ISteamFriends_ActivateGameOverlay(CSteamAPIContext.GetSteamFriends(), pchDialog2); } } /// /// activates game overlay to a specific place /// valid options are /// "steamid" - opens the overlay web browser to the specified user or groups profile /// "chat" - opens a chat window to the specified user, or joins the group chat /// "jointrade" - opens a window to a Steam Trading session that was started with the ISteamEconomy/StartTrade Web API /// "stats" - opens the overlay web browser to the specified user's stats /// "achievements" - opens the overlay web browser to the specified user's achievements /// "friendadd" - opens the overlay in minimal mode prompting the user to add the target user as a friend /// "friendremove" - opens the overlay in minimal mode prompting the user to remove the target friend /// "friendrequestaccept" - opens the overlay in minimal mode prompting the user to accept an incoming friend invite /// "friendrequestignore" - opens the overlay in minimal mode prompting the user to ignore an incoming friend invite /// public static void ActivateGameOverlayToUser(string pchDialog, CSteamID steamID) { InteropHelp.TestIfAvailableClient(); using (var pchDialog2 = new InteropHelp.UTF8StringHandle(pchDialog)) { NativeMethods.ISteamFriends_ActivateGameOverlayToUser(CSteamAPIContext.GetSteamFriends(), pchDialog2, steamID); } } /// /// activates game overlay web browser directly to the specified URL /// full address with protocol type is required, e.g. http://www.steamgames.com/ /// public static void ActivateGameOverlayToWebPage(string pchURL, EActivateGameOverlayToWebPageMode eMode = EActivateGameOverlayToWebPageMode.k_EActivateGameOverlayToWebPageMode_Default) { InteropHelp.TestIfAvailableClient(); using (var pchURL2 = new InteropHelp.UTF8StringHandle(pchURL)) { NativeMethods.ISteamFriends_ActivateGameOverlayToWebPage(CSteamAPIContext.GetSteamFriends(), pchURL2, eMode); } } /// /// activates game overlay to store page for app /// public static void ActivateGameOverlayToStore(AppId_t nAppID, EOverlayToStoreFlag eFlag) { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamFriends_ActivateGameOverlayToStore(CSteamAPIContext.GetSteamFriends(), nAppID, eFlag); } /// /// Mark a target user as 'played with'. This is a client-side only feature that requires that the calling user is /// in game /// public static void SetPlayedWith(CSteamID steamIDUserPlayedWith) { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamFriends_SetPlayedWith(CSteamAPIContext.GetSteamFriends(), steamIDUserPlayedWith); } /// /// activates game overlay to open the invite dialog. Invitations will be sent for the provided lobby. /// public static void ActivateGameOverlayInviteDialog(CSteamID steamIDLobby) { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamFriends_ActivateGameOverlayInviteDialog(CSteamAPIContext.GetSteamFriends(), steamIDLobby); } /// /// gets the small (32x32) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set /// public static int GetSmallFriendAvatar(CSteamID steamIDFriend) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetSmallFriendAvatar(CSteamAPIContext.GetSteamFriends(), steamIDFriend); } /// /// gets the medium (64x64) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set /// public static int GetMediumFriendAvatar(CSteamID steamIDFriend) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetMediumFriendAvatar(CSteamAPIContext.GetSteamFriends(), steamIDFriend); } /// /// gets the large (184x184) avatar of the current user, which is a handle to be used in IClientUtils::GetImageRGBA(), or 0 if none set /// returns -1 if this image has yet to be loaded, in this case wait for a AvatarImageLoaded_t callback and then call this again /// public static int GetLargeFriendAvatar(CSteamID steamIDFriend) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetLargeFriendAvatar(CSteamAPIContext.GetSteamFriends(), steamIDFriend); } /// /// requests information about a user - persona name & avatar /// if bRequireNameOnly is set, then the avatar of a user isn't downloaded /// - it's a lot slower to download avatars and churns the local cache, so if you don't need avatars, don't request them /// if returns true, it means that data is being requested, and a PersonaStateChanged_t callback will be posted when it's retrieved /// if returns false, it means that we already have all the details about that user, and functions can be called immediately /// public static bool RequestUserInformation(CSteamID steamIDUser, bool bRequireNameOnly) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_RequestUserInformation(CSteamAPIContext.GetSteamFriends(), steamIDUser, bRequireNameOnly); } /// /// requests information about a clan officer list /// when complete, data is returned in ClanOfficerListResponse_t call result /// this makes available the calls below /// you can only ask about clans that a user is a member of /// note that this won't download avatars automatically; if you get an officer, /// and no avatar image is available, call RequestUserInformation( steamID, false ) to download the avatar /// public static SteamAPICall_t RequestClanOfficerList(CSteamID steamIDClan) { InteropHelp.TestIfAvailableClient(); return (SteamAPICall_t)NativeMethods.ISteamFriends_RequestClanOfficerList(CSteamAPIContext.GetSteamFriends(), steamIDClan); } /// /// iteration of clan officers - can only be done when a RequestClanOfficerList() call has completed /// returns the steamID of the clan owner /// public static CSteamID GetClanOwner(CSteamID steamIDClan) { InteropHelp.TestIfAvailableClient(); return (CSteamID)NativeMethods.ISteamFriends_GetClanOwner(CSteamAPIContext.GetSteamFriends(), steamIDClan); } /// /// returns the number of officers in a clan (including the owner) /// public static int GetClanOfficerCount(CSteamID steamIDClan) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetClanOfficerCount(CSteamAPIContext.GetSteamFriends(), steamIDClan); } /// /// returns the steamID of a clan officer, by index, of range [0,GetClanOfficerCount) /// public static CSteamID GetClanOfficerByIndex(CSteamID steamIDClan, int iOfficer) { InteropHelp.TestIfAvailableClient(); return (CSteamID)NativeMethods.ISteamFriends_GetClanOfficerByIndex(CSteamAPIContext.GetSteamFriends(), steamIDClan, iOfficer); } /// /// if current user is chat restricted, he can't send or receive any text/voice chat messages. /// the user can't see custom avatars. But the user can be online and send/recv game invites. /// a chat restricted user can't add friends or join any groups. /// public static uint GetUserRestrictions() { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetUserRestrictions(CSteamAPIContext.GetSteamFriends()); } /// /// Rich Presence data is automatically shared between friends who are in the same game /// Each user has a set of Key/Value pairs /// Note the following limits: k_cchMaxRichPresenceKeys, k_cchMaxRichPresenceKeyLength, k_cchMaxRichPresenceValueLength /// There are two magic keys: /// "status" - a UTF-8 string that will show up in the 'view game info' dialog in the Steam friends list /// "connect" - a UTF-8 string that contains the command-line for how a friend can connect to a game /// GetFriendRichPresence() returns an empty string "" if no value is set /// SetRichPresence() to a NULL or an empty string deletes the key /// You can iterate the current set of keys for a friend with GetFriendRichPresenceKeyCount() /// and GetFriendRichPresenceKeyByIndex() (typically only used for debugging) /// public static bool SetRichPresence(string pchKey, string pchValue) { InteropHelp.TestIfAvailableClient(); using (var pchKey2 = new InteropHelp.UTF8StringHandle(pchKey)) using (var pchValue2 = new InteropHelp.UTF8StringHandle(pchValue)) { return NativeMethods.ISteamFriends_SetRichPresence(CSteamAPIContext.GetSteamFriends(), pchKey2, pchValue2); } } public static void ClearRichPresence() { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamFriends_ClearRichPresence(CSteamAPIContext.GetSteamFriends()); } public static string GetFriendRichPresence(CSteamID steamIDFriend, string pchKey) { InteropHelp.TestIfAvailableClient(); using (var pchKey2 = new InteropHelp.UTF8StringHandle(pchKey)) { return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetFriendRichPresence(CSteamAPIContext.GetSteamFriends(), steamIDFriend, pchKey2)); } } public static int GetFriendRichPresenceKeyCount(CSteamID steamIDFriend) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetFriendRichPresenceKeyCount(CSteamAPIContext.GetSteamFriends(), steamIDFriend); } public static string GetFriendRichPresenceKeyByIndex(CSteamID steamIDFriend, int iKey) { InteropHelp.TestIfAvailableClient(); return InteropHelp.PtrToStringUTF8(NativeMethods.ISteamFriends_GetFriendRichPresenceKeyByIndex(CSteamAPIContext.GetSteamFriends(), steamIDFriend, iKey)); } /// /// Requests rich presence for a specific user. /// public static void RequestFriendRichPresence(CSteamID steamIDFriend) { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamFriends_RequestFriendRichPresence(CSteamAPIContext.GetSteamFriends(), steamIDFriend); } /// /// Rich invite support. /// If the target accepts the invite, a GameRichPresenceJoinRequested_t callback is posted containing the connect string. /// (Or you can configure yout game so that it is passed on the command line instead. This is a deprecated path; ask us if you really need this.) /// Invites can only be sent to friends. /// public static bool InviteUserToGame(CSteamID steamIDFriend, string pchConnectString) { InteropHelp.TestIfAvailableClient(); using (var pchConnectString2 = new InteropHelp.UTF8StringHandle(pchConnectString)) { return NativeMethods.ISteamFriends_InviteUserToGame(CSteamAPIContext.GetSteamFriends(), steamIDFriend, pchConnectString2); } } /// /// recently-played-with friends iteration /// this iterates the entire list of users recently played with, across games /// GetFriendCoplayTime() returns as a unix time /// public static int GetCoplayFriendCount() { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetCoplayFriendCount(CSteamAPIContext.GetSteamFriends()); } public static CSteamID GetCoplayFriend(int iCoplayFriend) { InteropHelp.TestIfAvailableClient(); return (CSteamID)NativeMethods.ISteamFriends_GetCoplayFriend(CSteamAPIContext.GetSteamFriends(), iCoplayFriend); } public static int GetFriendCoplayTime(CSteamID steamIDFriend) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetFriendCoplayTime(CSteamAPIContext.GetSteamFriends(), steamIDFriend); } public static AppId_t GetFriendCoplayGame(CSteamID steamIDFriend) { InteropHelp.TestIfAvailableClient(); return (AppId_t)NativeMethods.ISteamFriends_GetFriendCoplayGame(CSteamAPIContext.GetSteamFriends(), steamIDFriend); } /// /// chat interface for games /// this allows in-game access to group (clan) chats from in the game /// the behavior is somewhat sophisticated, because the user may or may not be already in the group chat from outside the game or in the overlay /// use ActivateGameOverlayToUser( "chat", steamIDClan ) to open the in-game overlay version of the chat /// public static SteamAPICall_t JoinClanChatRoom(CSteamID steamIDClan) { InteropHelp.TestIfAvailableClient(); return (SteamAPICall_t)NativeMethods.ISteamFriends_JoinClanChatRoom(CSteamAPIContext.GetSteamFriends(), steamIDClan); } public static bool LeaveClanChatRoom(CSteamID steamIDClan) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_LeaveClanChatRoom(CSteamAPIContext.GetSteamFriends(), steamIDClan); } public static int GetClanChatMemberCount(CSteamID steamIDClan) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetClanChatMemberCount(CSteamAPIContext.GetSteamFriends(), steamIDClan); } public static CSteamID GetChatMemberByIndex(CSteamID steamIDClan, int iUser) { InteropHelp.TestIfAvailableClient(); return (CSteamID)NativeMethods.ISteamFriends_GetChatMemberByIndex(CSteamAPIContext.GetSteamFriends(), steamIDClan, iUser); } public static bool SendClanChatMessage(CSteamID steamIDClanChat, string pchText) { InteropHelp.TestIfAvailableClient(); using (var pchText2 = new InteropHelp.UTF8StringHandle(pchText)) { return NativeMethods.ISteamFriends_SendClanChatMessage(CSteamAPIContext.GetSteamFriends(), steamIDClanChat, pchText2); } } public static int GetClanChatMessage(CSteamID steamIDClanChat, int iMessage, out string prgchText, int cchTextMax, out EChatEntryType peChatEntryType, out CSteamID psteamidChatter) { InteropHelp.TestIfAvailableClient(); IntPtr prgchText2 = Marshal.AllocHGlobal(cchTextMax); int ret = NativeMethods.ISteamFriends_GetClanChatMessage(CSteamAPIContext.GetSteamFriends(), steamIDClanChat, iMessage, prgchText2, cchTextMax, out peChatEntryType, out psteamidChatter); prgchText = ret != 0 ? InteropHelp.PtrToStringUTF8(prgchText2) : null; Marshal.FreeHGlobal(prgchText2); return ret; } public static bool IsClanChatAdmin(CSteamID steamIDClanChat, CSteamID steamIDUser) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_IsClanChatAdmin(CSteamAPIContext.GetSteamFriends(), steamIDClanChat, steamIDUser); } /// /// interact with the Steam (game overlay / desktop) /// public static bool IsClanChatWindowOpenInSteam(CSteamID steamIDClanChat) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_IsClanChatWindowOpenInSteam(CSteamAPIContext.GetSteamFriends(), steamIDClanChat); } public static bool OpenClanChatWindowInSteam(CSteamID steamIDClanChat) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_OpenClanChatWindowInSteam(CSteamAPIContext.GetSteamFriends(), steamIDClanChat); } public static bool CloseClanChatWindowInSteam(CSteamID steamIDClanChat) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_CloseClanChatWindowInSteam(CSteamAPIContext.GetSteamFriends(), steamIDClanChat); } /// /// peer-to-peer chat interception /// this is so you can show P2P chats inline in the game /// public static bool SetListenForFriendsMessages(bool bInterceptEnabled) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_SetListenForFriendsMessages(CSteamAPIContext.GetSteamFriends(), bInterceptEnabled); } public static bool ReplyToFriendMessage(CSteamID steamIDFriend, string pchMsgToSend) { InteropHelp.TestIfAvailableClient(); using (var pchMsgToSend2 = new InteropHelp.UTF8StringHandle(pchMsgToSend)) { return NativeMethods.ISteamFriends_ReplyToFriendMessage(CSteamAPIContext.GetSteamFriends(), steamIDFriend, pchMsgToSend2); } } public static int GetFriendMessage(CSteamID steamIDFriend, int iMessageID, out string pvData, int cubData, out EChatEntryType peChatEntryType) { InteropHelp.TestIfAvailableClient(); IntPtr pvData2 = Marshal.AllocHGlobal(cubData); int ret = NativeMethods.ISteamFriends_GetFriendMessage(CSteamAPIContext.GetSteamFriends(), steamIDFriend, iMessageID, pvData2, cubData, out peChatEntryType); pvData = ret != 0 ? InteropHelp.PtrToStringUTF8(pvData2) : null; Marshal.FreeHGlobal(pvData2); return ret; } /// /// following apis /// public static SteamAPICall_t GetFollowerCount(CSteamID steamID) { InteropHelp.TestIfAvailableClient(); return (SteamAPICall_t)NativeMethods.ISteamFriends_GetFollowerCount(CSteamAPIContext.GetSteamFriends(), steamID); } public static SteamAPICall_t IsFollowing(CSteamID steamID) { InteropHelp.TestIfAvailableClient(); return (SteamAPICall_t)NativeMethods.ISteamFriends_IsFollowing(CSteamAPIContext.GetSteamFriends(), steamID); } public static SteamAPICall_t EnumerateFollowingList(uint unStartIndex) { InteropHelp.TestIfAvailableClient(); return (SteamAPICall_t)NativeMethods.ISteamFriends_EnumerateFollowingList(CSteamAPIContext.GetSteamFriends(), unStartIndex); } public static bool IsClanPublic(CSteamID steamIDClan) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_IsClanPublic(CSteamAPIContext.GetSteamFriends(), steamIDClan); } public static bool IsClanOfficialGameGroup(CSteamID steamIDClan) { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_IsClanOfficialGameGroup(CSteamAPIContext.GetSteamFriends(), steamIDClan); } /// /// / Return the number of chats (friends or chat rooms) with unread messages. /// / A "priority" message is one that would generate some sort of toast or /// / notification, and depends on user settings. /// / /// / You can register for UnreadChatMessagesChanged_t callbacks to know when this /// / has potentially changed. /// public static int GetNumChatsWithUnreadPriorityMessages() { InteropHelp.TestIfAvailableClient(); return NativeMethods.ISteamFriends_GetNumChatsWithUnreadPriorityMessages(CSteamAPIContext.GetSteamFriends()); } } } #endif // !DISABLESTEAMWORKS