void OnLobbyChatMsg(LobbyChatMsg_t pCallback) { Debug.Log("[" + LobbyChatMsg_t.k_iCallback + " - LobbyChatMsg] - " + pCallback.m_ulSteamIDLobby + " -- " + pCallback.m_ulSteamIDUser + " -- " + pCallback.m_eChatEntryType + " -- " + pCallback.m_iChatID); CSteamID SteamIDUser; byte[] Data = new byte[4096]; EChatEntryType ChatEntryType; int ret = SteamMatchmaking.GetLobbyChatEntry((CSteamID)pCallback.m_ulSteamIDLobby, (int)pCallback.m_iChatID, out SteamIDUser, Data, Data.Length, out ChatEntryType); Debug.Log("SteamMatchmaking.GetLobbyChatEntry(" + (CSteamID)pCallback.m_ulSteamIDLobby + ", " + (int)pCallback.m_iChatID + ", out SteamIDUser, Data, Data.Length, out ChatEntryType) : " + ret + " -- " + SteamIDUser + " -- " + System.Text.Encoding.UTF8.GetString(Data) + " -- " + ChatEntryType); }
internal static void InstallEvents() { LobbyInvite_t.Install(x => OnLobbyInvite?.Invoke(new Friend(x.SteamIDUser), new Lobby(x.SteamIDLobby))); LobbyEnter_t.Install(x => OnLobbyEntered?.Invoke(new Lobby(x.SteamIDLobby))); LobbyCreated_t.Install(x => OnLobbyCreated?.Invoke(x.Result, new Lobby(x.SteamIDLobby))); LobbyGameCreated_t.Install(x => OnLobbyGameCreated?.Invoke(new Lobby(x.SteamIDLobby), x.IP, x.Port, x.SteamIDGameServer)); LobbyDataUpdate_t.Install(x => { if (x.Success == 0) { return; } if (x.SteamIDLobby == x.SteamIDMember) { OnLobbyDataChanged?.Invoke(new Lobby(x.SteamIDLobby)); } else { OnLobbyMemberDataChanged?.Invoke(new Lobby(x.SteamIDLobby), new Friend(x.SteamIDMember)); } }); LobbyChatUpdate_t.Install(x => { if ((x.GfChatMemberStateChange & (int)ChatMemberStateChange.Entered) != 0) { OnLobbyMemberJoined?.Invoke(new Lobby(x.SteamIDLobby), new Friend(x.SteamIDUserChanged)); } if ((x.GfChatMemberStateChange & (int)ChatMemberStateChange.Left) != 0) { OnLobbyMemberLeave?.Invoke(new Lobby(x.SteamIDLobby), new Friend(x.SteamIDUserChanged)); } if ((x.GfChatMemberStateChange & (int)ChatMemberStateChange.Disconnected) != 0) { OnLobbyMemberDisconnected?.Invoke(new Lobby(x.SteamIDLobby), new Friend(x.SteamIDUserChanged)); } if ((x.GfChatMemberStateChange & (int)ChatMemberStateChange.Kicked) != 0) { OnLobbyMemberKicked?.Invoke(new Lobby(x.SteamIDLobby), new Friend(x.SteamIDUserChanged), new Friend(x.SteamIDMakingChange)); } if ((x.GfChatMemberStateChange & (int)ChatMemberStateChange.Banned) != 0) { OnLobbyMemberBanned?.Invoke(new Lobby(x.SteamIDLobby), new Friend(x.SteamIDUserChanged), new Friend(x.SteamIDMakingChange)); } }); LobbyChatMsg_t.Install(OnLobbyChatMessageRecievedAPI); }
static private unsafe void OnLobbyChatMessageRecievedAPI(LobbyChatMsg_t callback) { SteamId steamid = default; ChatEntryType chatEntryType = default; var buffer = Helpers.TakeMemory(); var readData = Internal.GetLobbyChatEntry(callback.SteamIDLobby, (int)callback.ChatID, ref steamid, buffer, Helpers.MemoryBufferSize, ref chatEntryType); if (readData > 0) { OnChatMessage?.Invoke(new Lobby(callback.SteamIDLobby), new Friend(steamid), Helpers.MemoryToString(buffer)); } }
protected virtual void OnLobbyChatMessage(LobbyChatMsg_t result) { if (result.m_ulSteamIDLobby != this._lobby.Id.m_SteamID) { return; } if (result.m_eChatEntryType != 1) { return; } if (result.m_ulSteamIDUser != this._lobby.Owner.m_SteamID) { return; } byte[] message = this._lobby.GetMessage((int)result.m_iChatID); if (message.Length == 0) { return; } using (MemoryStream memoryStream = new MemoryStream(message)) { using (BinaryReader binaryReader = new BinaryReader(memoryStream)) { byte b = binaryReader.ReadByte(); byte b2 = b; if (b2 == 1) { while ((long)message.Length - memoryStream.Position >= 8L) { CSteamID cSteamID = new CSteamID(binaryReader.ReadUInt64()); if (cSteamID != SteamUser.GetSteamID()) { this._lobby.SetPlayedWith(cSteamID); } } } } } }
private static unsafe void OnLobbyChatMessageRecievedAPI(LobbyChatMsg_t callback) { // // Current member / type: System.Void Steamworks.SteamMatchmaking::OnLobbyChatMessageRecievedAPI(Steamworks.Data.LobbyChatMsg_t) // File path: D:\GameServers\Rust\RustDedicated_Data\Managed\Facepunch.Steamworks.dll // // Product version: 2019.1.118.0 // Exception in: System.Void OnLobbyChatMessageRecievedAPI(Steamworks.Data.LobbyChatMsg_t) // // Specified argument was out of the range of valid values. // Parameter name: Target of array indexer expression is not an array. // at ..() in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\Expressions\ArrayIndexerExpression.cs:line 129 // at ..() in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\Expressions\UnaryExpression.cs:line 109 // at ..() in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Ast\Expressions\UnaryExpression.cs:line 95 // at Telerik.JustDecompiler.Decompiler.ExpressionDecompilerStep.() in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Decompiler\ExpressionDecompilerStep.cs:line 143 // at Telerik.JustDecompiler.Decompiler.ExpressionDecompilerStep.(DecompilationContext , ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Decompiler\ExpressionDecompilerStep.cs:line 73 // at ..(MethodBody , , ILanguage ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Decompiler\DecompilationPipeline.cs:line 88 // at ..(MethodBody , ILanguage ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Decompiler\DecompilationPipeline.cs:line 70 // at Telerik.JustDecompiler.Decompiler.Extensions.( , ILanguage , MethodBody , DecompilationContext& ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Decompiler\Extensions.cs:line 95 // at Telerik.JustDecompiler.Decompiler.Extensions.(MethodBody , ILanguage , DecompilationContext& , ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Decompiler\Extensions.cs:line 58 // at ..(ILanguage , MethodDefinition , ) in C:\DeveloperTooling_JD_Agent1\_work\15\s\OpenSource\Cecil.Decompiler\Decompiler\WriterContextServices\BaseWriterContextService.cs:line 117 // // mailto: [email protected] }
internal static void InstallEvents() { LobbyInvite_t.Install((LobbyInvite_t x) => { Action <Friend, Lobby> onLobbyInvite = SteamMatchmaking.OnLobbyInvite; if (onLobbyInvite != null) { onLobbyInvite(new Friend(x.SteamIDUser), new Lobby(x.SteamIDLobby)); } else { } }, false); LobbyDataUpdate_t.Install((LobbyDataUpdate_t x) => { if (x.Success != 0) { if (x.SteamIDLobby != x.SteamIDMember) { Action <Lobby, Friend> onLobbyMemberDataChanged = SteamMatchmaking.OnLobbyMemberDataChanged; if (onLobbyMemberDataChanged != null) { onLobbyMemberDataChanged(new Lobby(x.SteamIDLobby), new Friend(x.SteamIDMember)); } else { } } else { Action <Lobby> onLobbyDataChanged = SteamMatchmaking.OnLobbyDataChanged; if (onLobbyDataChanged != null) { onLobbyDataChanged(new Lobby(x.SteamIDLobby)); } else { } } } }, false); LobbyChatUpdate_t.Install((LobbyChatUpdate_t x) => { if ((x.GfChatMemberStateChange & 1) != 0) { Action <Lobby, Friend> onLobbyMemberJoined = SteamMatchmaking.OnLobbyMemberJoined; if (onLobbyMemberJoined != null) { onLobbyMemberJoined(new Lobby(x.SteamIDLobby), new Friend(x.SteamIDUserChanged)); } else { } } if ((x.GfChatMemberStateChange & 2) != 0) { Action <Lobby, Friend> onLobbyMemberLeave = SteamMatchmaking.OnLobbyMemberLeave; if (onLobbyMemberLeave != null) { onLobbyMemberLeave(new Lobby(x.SteamIDLobby), new Friend(x.SteamIDUserChanged)); } else { } } if ((x.GfChatMemberStateChange & 4) != 0) { Action <Lobby, Friend> onLobbyMemberDisconnected = SteamMatchmaking.OnLobbyMemberDisconnected; if (onLobbyMemberDisconnected != null) { onLobbyMemberDisconnected(new Lobby(x.SteamIDLobby), new Friend(x.SteamIDUserChanged)); } else { } } if ((x.GfChatMemberStateChange & 8) != 0) { Action <Lobby, Friend, Friend> onLobbyMemberKicked = SteamMatchmaking.OnLobbyMemberKicked; if (onLobbyMemberKicked != null) { onLobbyMemberKicked(new Lobby(x.SteamIDLobby), new Friend(x.SteamIDUserChanged), new Friend(x.SteamIDMakingChange)); } else { } } if ((x.GfChatMemberStateChange & 16) != 0) { Action <Lobby, Friend, Friend> onLobbyMemberBanned = SteamMatchmaking.OnLobbyMemberBanned; if (onLobbyMemberBanned != null) { onLobbyMemberBanned(new Lobby(x.SteamIDLobby), new Friend(x.SteamIDUserChanged), new Friend(x.SteamIDMakingChange)); } else { } } }, false); LobbyChatMsg_t.Install(new Action <LobbyChatMsg_t>(SteamMatchmaking.OnLobbyChatMessageRecievedAPI), false); }
static private unsafe void OnLobbyChatMessageRecievedAPI(LobbyChatMsg_t callback) { SteamId steamid = default; ChatEntryType chatEntryType = default; var buffer = Helpers.TakeBuffer(1024 * 4); fixed(byte *p = buffer) { var readData = Internal.GetLobbyChatEntry(callback.SteamIDLobby, (int)callback.ChatID, ref steamid, (IntPtr)p, buffer.Length, ref chatEntryType); if (readData > 0) { OnChatMessage?.Invoke(new Lobby(callback.SteamIDLobby), new Friend(steamid), Encoding.UTF8.GetString(buffer, 0, readData)); } } }