/// <summary> /// <para> returns results closest to the specified value. Multiple near filters can be added, with early filters taking precedence</para> /// </summary> public static void AddRequestLobbyListNearValueFilter(string pchKeyToMatch, int nValueToBeCloseTo) { InteropHelp.TestIfAvailableClient(); using (var pchKeyToMatch2 = new InteropHelp.UTF8StringHandle(pchKeyToMatch)) { NativeMethods.ISteamMatchmaking_AddRequestLobbyListNearValueFilter(CSteamAPIContext.GetSteamMatchmaking(), pchKeyToMatch2, nValueToBeCloseTo); } }
public static void SetLobbyMemberData(CSteamID steamIDLobby, string pchKey, string pchValue) { InteropHelp.TestIfAvailableClient(); using InteropHelp.UTF8StringHandle pchKey2 = new InteropHelp.UTF8StringHandle(pchKey); using InteropHelp.UTF8StringHandle pchValue2 = new InteropHelp.UTF8StringHandle(pchValue); NativeMethods.ISteamMatchmaking_SetLobbyMemberData(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, pchKey2, pchValue2); }
/// <summary> /// <para> numerical comparison</para> /// </summary> public static void AddRequestLobbyListNumericalFilter(string pchKeyToMatch, int nValueToMatch, ELobbyComparison eComparisonType) { InteropHelp.TestIfAvailableClient(); using (var pchKeyToMatch2 = new InteropHelp.UTF8StringHandle(pchKeyToMatch)) { NativeMethods.ISteamMatchmaking_AddRequestLobbyListNumericalFilter(CSteamAPIContext.GetSteamMatchmaking(), pchKeyToMatch2, nValueToMatch, eComparisonType); } }
/// <summary> /// <para> removes a metadata key from the lobby</para> /// </summary> public static bool DeleteLobbyData(CSteamID steamIDLobby, string pchKey) { InteropHelp.TestIfAvailableClient(); using (var pchKey2 = new InteropHelp.UTF8StringHandle(pchKey)) { return(NativeMethods.ISteamMatchmaking_DeleteLobbyData(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, pchKey2)); } }
public static bool GetLobbyDataByIndex(CSteamID steamIDLobby, int iLobbyData, out string pchKey, int cchKeyBufferSize, out string pchValue, int cchValueBufferSize) { InteropHelp.TestIfAvailableClient(); IntPtr intPtr = Marshal.AllocHGlobal(cchKeyBufferSize); IntPtr intPtr2 = Marshal.AllocHGlobal(cchValueBufferSize); bool flag = NativeMethods.ISteamMatchmaking_GetLobbyDataByIndex(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, iLobbyData, intPtr, cchKeyBufferSize, intPtr2, cchValueBufferSize); pchKey = (flag ? InteropHelp.PtrToStringUTF8(intPtr) : null); Marshal.FreeHGlobal(intPtr); pchValue = (flag ? InteropHelp.PtrToStringUTF8(intPtr2) : null); Marshal.FreeHGlobal(intPtr2); return(flag); }
/// <summary> /// <para> returns a lobby metadata key/values pair by index, of range [0, GetLobbyDataCount())</para> /// </summary> public static bool GetLobbyDataByIndex(CSteamID steamIDLobby, int iLobbyData, out string pchKey, int cchKeyBufferSize, out string pchValue, int cchValueBufferSize) { InteropHelp.TestIfAvailableClient(); IntPtr pchKey2 = Marshal.AllocHGlobal(cchKeyBufferSize); IntPtr pchValue2 = Marshal.AllocHGlobal(cchValueBufferSize); bool ret = NativeMethods.ISteamMatchmaking_GetLobbyDataByIndex(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, iLobbyData, pchKey2, cchKeyBufferSize, pchValue2, cchValueBufferSize); pchKey = ret ? InteropHelp.PtrToStringUTF8(pchKey2) : null; Marshal.FreeHGlobal(pchKey2); pchValue = ret ? InteropHelp.PtrToStringUTF8(pchValue2) : null; Marshal.FreeHGlobal(pchValue2); return(ret); }
/// <summary> /// <para> sets the game server associated with the lobby</para> /// <para> usually at this point, the users will join the specified game server</para> /// <para> either the IP/Port or the steamID of the game server has to be valid, depending on how you want the clients to be able to connect</para> /// </summary> public static void SetLobbyGameServer(CSteamID steamIDLobby, uint unGameServerIP, ushort unGameServerPort, CSteamID steamIDGameServer) { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamMatchmaking_SetLobbyGameServer(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, unGameServerIP, unGameServerPort, steamIDGameServer); }
/// <summary> /// <para> Refreshes metadata for a lobby you're not necessarily in right now</para> /// <para> you never do this for lobbies you're a member of, only if your</para> /// <para> this will send down all the metadata associated with a lobby</para> /// <para> this is an asynchronous call</para> /// <para> returns false if the local user is not connected to the Steam servers</para> /// <para> results will be returned by a LobbyDataUpdate_t callback</para> /// <para> if the specified lobby doesn't exist, LobbyDataUpdate_t::m_bSuccess will be set to false</para> /// </summary> public static bool RequestLobbyData(CSteamID steamIDLobby) { InteropHelp.TestIfAvailableClient(); return(NativeMethods.ISteamMatchmaking_RequestLobbyData(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby)); }
/// <summary> /// <para> returns the details of the game server</para> /// <para> iGame is of range [0,GetFavoriteGameCount())</para> /// <para> *pnIP, *pnConnPort are filled in the with IP:port of the game server</para> /// <para> *punFlags specify whether the game server was stored as an explicit favorite or in the history of connections</para> /// <para> *pRTime32LastPlayedOnServer is filled in the with the Unix time the favorite was added</para> /// </summary> public static bool GetFavoriteGame(int iGame, out AppId_t pnAppID, out uint pnIP, out ushort pnConnPort, out ushort pnQueryPort, out uint punFlags, out uint pRTime32LastPlayedOnServer) { InteropHelp.TestIfAvailableClient(); return(NativeMethods.ISteamMatchmaking_GetFavoriteGame(CSteamAPIContext.GetSteamMatchmaking(), iGame, out pnAppID, out pnIP, out pnConnPort, out pnQueryPort, out punFlags, out pRTime32LastPlayedOnServer)); }
/// <summary> /// <para> Get a chat message as specified in a LobbyChatMsg_t callback</para> /// <para> iChatID is the LobbyChatMsg_t::m_iChatID value in the callback</para> /// <para> *pSteamIDUser is filled in with the CSteamID of the member</para> /// <para> *pvData is filled in with the message itself</para> /// <para> return value is the number of bytes written into the buffer</para> /// </summary> public static int GetLobbyChatEntry(CSteamID steamIDLobby, int iChatID, out CSteamID pSteamIDUser, byte[] pvData, int cubData, out EChatEntryType peChatEntryType) { InteropHelp.TestIfAvailableClient(); return(NativeMethods.ISteamMatchmaking_GetLobbyChatEntry(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, iChatID, out pSteamIDUser, pvData, cubData, out peChatEntryType)); }
/// <summary> /// <para> Create a lobby on the Steam servers.</para> /// <para> If private, then the lobby will not be returned by any RequestLobbyList() call; the CSteamID</para> /// <para> of the lobby will need to be communicated via game channels or via InviteUserToLobby()</para> /// <para> this is an asynchronous request</para> /// <para> results will be returned by LobbyCreated_t callback and call result; lobby is joined & ready to use at this point</para> /// <para> a LobbyEnter_t callback will also be received (since the local user is joining their own lobby)</para> /// </summary> public static SteamAPICall_t CreateLobby(ELobbyType eLobbyType, int cMaxMembers) { InteropHelp.TestIfAvailableClient(); return((SteamAPICall_t)NativeMethods.ISteamMatchmaking_CreateLobby(CSteamAPIContext.GetSteamMatchmaking(), eLobbyType, cMaxMembers)); }
/// <summary> /// <para> adds the game server to the local list; updates the time played of the server if it already exists in the list</para> /// </summary> public static int AddFavoriteGame(AppId_t nAppID, uint nIP, ushort nConnPort, ushort nQueryPort, uint unFlags, uint rTime32LastPlayedOnServer) { InteropHelp.TestIfAvailableClient(); return(NativeMethods.ISteamMatchmaking_AddFavoriteGame(CSteamAPIContext.GetSteamMatchmaking(), nAppID, nIP, nConnPort, nQueryPort, unFlags, rTime32LastPlayedOnServer)); }
/// <summary> /// <para> sets whether or not a lobby is joinable - defaults to true for a new lobby</para> /// <para> if set to false, no user can join, even if they are a friend or have been invited</para> /// </summary> public static bool SetLobbyJoinable(CSteamID steamIDLobby, bool bLobbyJoinable) { InteropHelp.TestIfAvailableClient(); return(NativeMethods.ISteamMatchmaking_SetLobbyJoinable(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, bLobbyJoinable)); }
/// <summary> /// <para> game server favorites storage</para> /// <para> saves basic details about a multiplayer game server locally</para> /// <para> returns the number of favorites servers the user has stored</para> /// </summary> public static int GetFavoriteGameCount() { InteropHelp.TestIfAvailableClient(); return(NativeMethods.ISteamMatchmaking_GetFavoriteGameCount(CSteamAPIContext.GetSteamMatchmaking())); }
/// <summary> /// <para> returns the CSteamID of a user in the lobby</para> /// <para> iMember is of range [0,GetNumLobbyMembers())</para> /// <para> note that the current user must be in a lobby to retrieve CSteamIDs of other users in that lobby</para> /// </summary> public static CSteamID GetLobbyMemberByIndex(CSteamID steamIDLobby, int iMember) { InteropHelp.TestIfAvailableClient(); return((CSteamID)NativeMethods.ISteamMatchmaking_GetLobbyMemberByIndex(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, iMember)); }
/// <summary> /// <para> Invite another user to the lobby</para> /// <para> the target user will receive a LobbyInvite_t callback</para> /// <para> will return true if the invite is successfully sent, whether or not the target responds</para> /// <para> returns false if the local user is not connected to the Steam servers</para> /// <para> if the other user clicks the join link, a GameLobbyJoinRequested_t will be posted if the user is in-game,</para> /// <para> or if the game isn't running yet the game will be launched with the parameter +connect_lobby <64-bit lobby id></para> /// </summary> public static bool InviteUserToLobby(CSteamID steamIDLobby, CSteamID steamIDInvitee) { InteropHelp.TestIfAvailableClient(); return(NativeMethods.ISteamMatchmaking_InviteUserToLobby(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, steamIDInvitee)); }
/// <summary> /// <para> Leave a lobby; this will take effect immediately on the client side</para> /// <para> other users in the lobby will be notified by a LobbyChatUpdate_t callback</para> /// </summary> public static void LeaveLobby(CSteamID steamIDLobby) { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamMatchmaking_LeaveLobby(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby); }
/// <summary> /// <para> Joins an existing lobby</para> /// <para> this is an asynchronous request</para> /// <para> results will be returned by LobbyEnter_t callback & call result, check m_EChatRoomEnterResponse to see if was successful</para> /// <para> lobby metadata is available to use immediately on this call completing</para> /// </summary> public static SteamAPICall_t JoinLobby(CSteamID steamIDLobby) { InteropHelp.TestIfAvailableClient(); return((SteamAPICall_t)NativeMethods.ISteamMatchmaking_JoinLobby(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby)); }
/// <summary> /// <para> returns the details of a game server set in a lobby - returns false if there is no game server set, or that lobby doesn't exist</para> /// </summary> public static bool GetLobbyGameServer(CSteamID steamIDLobby, out uint punGameServerIP, out ushort punGameServerPort, out CSteamID psteamIDGameServer) { InteropHelp.TestIfAvailableClient(); return(NativeMethods.ISteamMatchmaking_GetLobbyGameServer(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, out punGameServerIP, out punGameServerPort, out psteamIDGameServer)); }
/// <summary> /// <para> link two lobbies for the purposes of checking player compatibility</para> /// <para> you must be the lobby owner of both lobbies</para> /// </summary> public static bool SetLinkedLobby(CSteamID steamIDLobby, CSteamID steamIDLobbyDependent) { InteropHelp.TestIfAvailableClient(); return(NativeMethods.ISteamMatchmaking_SetLinkedLobby(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, steamIDLobbyDependent)); }
/// <summary> /// <para> returns the current limit on the # of users who can join the lobby; returns 0 if no limit is defined</para> /// </summary> public static int GetLobbyMemberLimit(CSteamID steamIDLobby) { InteropHelp.TestIfAvailableClient(); return(NativeMethods.ISteamMatchmaking_GetLobbyMemberLimit(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby)); }
/// <summary> /// <para> removes the game server from the local storage; returns true if one was removed</para> /// </summary> public static bool RemoveFavoriteGame(AppId_t nAppID, uint nIP, ushort nConnPort, ushort nQueryPort, uint unFlags) { InteropHelp.TestIfAvailableClient(); return(NativeMethods.ISteamMatchmaking_RemoveFavoriteGame(CSteamAPIContext.GetSteamMatchmaking(), nAppID, nIP, nConnPort, nQueryPort, unFlags)); }
/// <summary> /// <para> returns the current lobby owner</para> /// <para> you must be a member of the lobby to access this</para> /// <para> there always one lobby owner - if the current owner leaves, another user will become the owner</para> /// <para> it is possible (bur rare) to join a lobby just as the owner is leaving, thus entering a lobby with self as the owner</para> /// </summary> public static CSteamID GetLobbyOwner(CSteamID steamIDLobby) { InteropHelp.TestIfAvailableClient(); return((CSteamID)NativeMethods.ISteamMatchmaking_GetLobbyOwner(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby)); }
/// <summary> /// <para> sets how many results to return, the lower the count the faster it is to download the lobby results & details to the client</para> /// </summary> public static void AddRequestLobbyListResultCountFilter(int cMaxResults) { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamMatchmaking_AddRequestLobbyListResultCountFilter(CSteamAPIContext.GetSteamMatchmaking(), cMaxResults); }
/// <summary> /// <para> changes who the lobby owner is</para> /// <para> you must be the lobby owner for this to succeed, and steamIDNewOwner must be in the lobby</para> /// <para> after completion, the local user will no longer be the owner</para> /// </summary> public static bool SetLobbyOwner(CSteamID steamIDLobby, CSteamID steamIDNewOwner) { InteropHelp.TestIfAvailableClient(); return(NativeMethods.ISteamMatchmaking_SetLobbyOwner(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, steamIDNewOwner)); }
public static void AddRequestLobbyListCompatibleMembersFilter(CSteamID steamIDLobby) { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamMatchmaking_AddRequestLobbyListCompatibleMembersFilter(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby); }
/// <summary> /// <para> changes who the lobby owner is</para> /// <para> you must be the lobby owner for this to succeed, and steamIDNewOwner must be in the lobby</para> /// <para> after completion, the local user will no longer be the owner</para> /// </summary> public static void CheckForPSNGameBootInvite(uint iGameBootAttributes) { InteropHelp.TestIfAvailableClient(); NativeMethods.ISteamMatchmaking_CheckForPSNGameBootInvite(CSteamAPIContext.GetSteamMatchmaking(), iGameBootAttributes); }
/// <summary> /// <para> Gets per-user metadata for someone in this lobby</para> /// </summary> public static string GetLobbyMemberData(CSteamID steamIDLobby, CSteamID steamIDUser, string pchKey) { InteropHelp.TestIfAvailableClient(); using (var pchKey2 = new InteropHelp.UTF8StringHandle(pchKey)) { return(InteropHelp.PtrToStringUTF8(NativeMethods.ISteamMatchmaking_GetLobbyMemberData(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, steamIDUser, pchKey2))); } }
/// <summary> /// <para>/////</para> /// <para> Game lobby functions</para> /// <para> Get a list of relevant lobbies</para> /// <para> this is an asynchronous request</para> /// <para> results will be returned by LobbyMatchList_t callback & call result, with the number of lobbies found</para> /// <para> this will never return lobbies that are full</para> /// <para> to add more filter, the filter calls below need to be call before each and every RequestLobbyList() call</para> /// <para> use the CCallResult<> object in steam_api.h to match the SteamAPICall_t call result to a function in an object, e.g.</para> /// <para> class CMyLobbyListManager</para> /// <para> {</para> /// <para> CCallResult<CMyLobbyListManager, LobbyMatchList_t> m_CallResultLobbyMatchList;</para> /// <para> void FindLobbies()</para> /// <para> {</para> /// <para> // SteamMatchmaking()->AddRequestLobbyListFilter*() functions would be called here, before RequestLobbyList()</para> /// <para> SteamAPICall_t hSteamAPICall = SteamMatchmaking()->RequestLobbyList();</para> /// <para> m_CallResultLobbyMatchList.Set( hSteamAPICall, this, &CMyLobbyListManager::OnLobbyMatchList );</para> /// <para> }</para> /// <para> void OnLobbyMatchList( LobbyMatchList_t *pLobbyMatchList, bool bIOFailure )</para> /// <para> {</para> /// <para> // lobby list has be retrieved from Steam back-end, use results</para> /// <para> }</para> /// <para> }</para> /// </summary> public static SteamAPICall_t RequestLobbyList() { InteropHelp.TestIfAvailableClient(); return((SteamAPICall_t)NativeMethods.ISteamMatchmaking_RequestLobbyList(CSteamAPIContext.GetSteamMatchmaking())); }
/// <summary> /// <para> Broadcasts a chat message to the all the users in the lobby</para> /// <para> users in the lobby (including the local user) will receive a LobbyChatMsg_t callback</para> /// <para> returns true if the message is successfully sent</para> /// <para> pvMsgBody can be binary or text data, up to 4k</para> /// <para> if pvMsgBody is text, cubMsgBody should be strlen( text ) + 1, to include the null terminator</para> /// </summary> public static bool SendLobbyChatMsg(CSteamID steamIDLobby, byte[] pvMsgBody, int cubMsgBody) { InteropHelp.TestIfAvailableClient(); return(NativeMethods.ISteamMatchmaking_SendLobbyChatMsg(CSteamAPIContext.GetSteamMatchmaking(), steamIDLobby, pvMsgBody, cubMsgBody)); }