├── .gitignore ├── .gitmodules ├── .travis.yml ├── JustAnotherVoiceChat.Server.Dummy ├── JustAnotherVoiceChat.Server.Dummy.csproj ├── nlog.config └── src │ ├── Client │ └── DummyClient.cs │ ├── Factories │ └── DummyClientFactory.cs │ ├── Interfaces │ └── IDummyClientRepository.cs │ ├── Program.cs │ └── ServerHandler.cs ├── JustAnotherVoiceChat.Server.GTMP.Resource ├── Client │ └── JustAnotherVoiceChat.js ├── JustAnotherVoiceChat.Server.GTMP.Resource.csproj ├── JustAnotherVoiceChat.Server.GTMP.Resource.csproj.DotSettings ├── LICENSE.txt ├── Properties │ └── AssemblyInfo.cs ├── Server │ ├── Helpers │ │ ├── RadioHandler.cs │ │ └── TelephoneHandler.cs │ ├── VoiceScript.Commands.cs │ ├── VoiceScript.GtmpEvents.cs │ ├── VoiceScript.VoiceEvents.cs │ └── VoiceScript.cs ├── meta.xml └── packages.config ├── JustAnotherVoiceChat.Server.GTMP ├── JustAnotherVoiceChat.Server.GTMP.csproj ├── JustAnotherVoiceChat.Server.GTMP.nuspec ├── LICENSE.txt ├── Properties │ └── AssemblyInfo.cs ├── packages.config └── src │ ├── Elements │ ├── Clients │ │ └── GtmpVoiceClient.cs │ ├── Server │ │ ├── GtmpVoiceServer.Events.cs │ │ ├── GtmpVoiceServer.Players.cs │ │ └── GtmpVoiceServer.cs │ └── Tasks │ │ └── GtmpPositionalTask.cs │ ├── Exceptions │ └── ServerNotSharedException.cs │ ├── Extensions │ └── ClientExtensions.cs │ ├── Factories │ ├── GtmpVoice.cs │ └── GtmpVoiceClientFactory.cs │ ├── GtmpVoiceDelegates.cs │ └── Interfaces │ ├── IGtmpVoiceClient.cs │ ├── IGtmpVoiceClientFactory.cs │ └── IGtmpVoiceServer.cs ├── JustAnotherVoiceChat.Server.Testing ├── JustAnotherVoiceChat.Server.Testing.csproj └── src │ └── FakeAction.cs ├── JustAnotherVoiceChat.Server.Wrapper.Tests ├── JustAnotherVoiceChat.Server.Wrapper.Tests.csproj └── src │ ├── Fakes │ ├── FakeVoiceClient.cs │ ├── FakeVoiceClientFactory.cs │ ├── FakeVoiceServer.cs │ ├── Interfaces │ │ └── IFakeVoiceClient.cs │ └── VoiceWrapperEventInvoker.cs │ ├── JustAnotherVoiceChatFixture.cs │ ├── VectorFixture.cs │ ├── VoiceServerClientFixtures.cs │ ├── VoiceServerEventFixtures.cs │ ├── VoiceServerFixtures.cs │ └── VoiceServerNativeFixture.cs ├── JustAnotherVoiceChat.Server.Wrapper ├── JustAnotherVoiceChat.Server.Wrapper.csproj ├── Properties │ └── AssemblyInfo.cs └── src │ ├── Delegates │ ├── Delegates.cs │ └── NativeDelegates.cs │ ├── Elements │ ├── Client │ │ ├── VoiceClient.EventListener.cs │ │ ├── VoiceClient.Muting.cs │ │ ├── VoiceClient.Native.Positional.cs │ │ └── VoiceClient.cs │ ├── Models │ │ ├── ClientConnectingEventArgs.cs │ │ └── VoiceServerConfiguration.cs │ ├── Server │ │ ├── Helpers │ │ │ └── VoiceTaskExecutor.cs │ │ ├── VoiceServer.Clients.cs │ │ ├── VoiceServer.Events.Dispatcher.cs │ │ ├── VoiceServer.Events.Native.cs │ │ ├── VoiceServer.Events.cs │ │ ├── VoiceServer.Positional.cs │ │ ├── VoiceServer.Tasks.cs │ │ └── VoiceServer.cs │ ├── Tasks │ │ └── PositionalVoiceTask.cs │ └── Wrapper │ │ ├── NativeLibary.cs │ │ ├── VoiceWrapper.Clients.cs │ │ ├── VoiceWrapper.Events.cs │ │ ├── VoiceWrapper.Muting.cs │ │ ├── VoiceWrapper.Positional.cs │ │ └── VoiceWrapper.Server.cs │ ├── Enums │ ├── LogLevel.cs │ └── StatusCode.cs │ ├── Exceptions │ ├── ClientNotConnectedException.cs │ ├── InvalidClientException.cs │ ├── VoiceServerAlreadyStartedException.cs │ └── VoiceServerNotStartedException.cs │ ├── Interfaces │ ├── IVoiceClient.cs │ ├── IVoiceClientFactory.cs │ ├── IVoiceServer.cs │ ├── IVoiceTask.cs │ ├── IVoiceTaskExecutor.cs │ └── IVoiceWrapper.cs │ ├── JustAnotherVoiceChat.cs │ ├── Math │ └── Vector3.cs │ └── Structs │ ├── ClientPosition.cs │ └── VoiceHandle.cs ├── JustAnotherVoiceChat.Server.sln ├── JustAnotherVoiceChat.Server.sln.licenseheader ├── JustAnotherVoiceChat.Server ├── CMakeLists.txt ├── include │ ├── api.h │ ├── client.h │ ├── internal.h │ ├── justAnotherVoiceChat.h │ ├── log.h │ └── server.h ├── src │ ├── CMakeLists.txt │ ├── api.cpp │ ├── client.cpp │ ├── internal.cpp │ ├── log.cpp │ └── server.cpp └── tests │ ├── CMakeLists.txt │ ├── test.cpp │ ├── testClient.cpp │ ├── testClient.h │ ├── test_api.cpp │ └── test_api.h ├── LICENSE ├── README.md ├── appveyor.yml └── docs ├── communication.md ├── diagrams ├── client-communication.dia ├── connection-setup.dia ├── continues-communication.dia ├── general-communication.dia └── network-communication.dia ├── images ├── JAVIC_Logo_Standalone_64px.png ├── JAVIC_Wide_250px.png ├── client-communication.png ├── connection-setup.png ├── continues-communication.png ├── general-communication.png └── network-communication.png └── installation-gtmp.md /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "JustAnotherVoiceChat.Server/thirdparty/enet"] 2 | path = JustAnotherVoiceChat.Server/thirdparty/enet 3 | url = https://github.com/lsalzman/enet.git 4 | [submodule "JustAnotherVoiceChat.Server/thirdparty/cereal"] 5 | path = JustAnotherVoiceChat.Server/thirdparty/cereal 6 | url = https://github.com/USCiLab/cereal.git 7 | [submodule "JustAnotherVoiceChat.Server/thirdparty/linalg"] 8 | path = JustAnotherVoiceChat.Server/thirdparty/linalg 9 | url = https://github.com/sgorsten/linalg.git 10 | [submodule "JustAnotherVoiceChat.Server/thirdparty/JustAnotherVoiceChat"] 11 | path = JustAnotherVoiceChat.Server/thirdparty/JustAnotherVoiceChat 12 | url = https://github.com/AlternateLife/JustAnotherVoiceChat.git 13 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | os: 2 | - linux 3 | - osx 4 | 5 | compiler: 6 | - gcc 7 | - clang 8 | 9 | addons: 10 | apt: 11 | packages: 12 | texinfo 13 | 14 | language: cpp 15 | git: 16 | submodules: false 17 | 18 | before_install: 19 | - git config --global http.sslVerify "false" 20 | - git submodule update --init --recursive 21 | - git config --global http.sslVerify "true" 22 | 23 | script: 24 | - cd JustAnotherVoiceChat.Server 25 | - mkdir build 26 | - cd build 27 | - cmake .. 28 | - make 29 | -------------------------------------------------------------------------------- /JustAnotherVoiceChat.Server.Dummy/JustAnotherVoiceChat.Server.Dummy.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | Debug Windows 4 | Exe 5 | netcoreapp2.0 6 | 7 7 | false 8 | Debug Linux;Debug Windows;Release Linux;Release Windows 9 | 10 | 11 | TRACE;DEBUG;LINUX;NETCOREAPP2_0;NETCOREAPP2_0 12 | bin\Debug\Linux\ 13 | 14 | 15 | TRACE;DEBUG;NETCOREAPP2_0 16 | bin\Debug\Windows\ 17 | 18 | 19 | TRACE;RELEASE;NETCOREAPP2_0 20 | true 21 | bin\Release\Windows\ 22 | 23 | 24 | TRACE;RELEASE;LINUX;NETCOREAPP2_0 25 | true 26 | bin\Release\Linux\ 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | Always 37 | 38 | 39 | -------------------------------------------------------------------------------- /JustAnotherVoiceChat.Server.Dummy/nlog.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /JustAnotherVoiceChat.Server.Dummy/src/Client/DummyClient.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * File: DummyClient.cs 3 | * Date: 21.2.2018, 4 | * 5 | * MIT License 6 | * 7 | * Copyright (c) 2018 JustAnotherVoiceChat 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in all 17 | * copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | */ 27 | 28 | using JustAnotherVoiceChat.Server.Wrapper.Elements.Client; 29 | using JustAnotherVoiceChat.Server.Wrapper.Interfaces; 30 | using JustAnotherVoiceChat.Server.Wrapper.Math; 31 | using JustAnotherVoiceChat.Server.Wrapper.Structs; 32 | 33 | namespace JustAnotherVoiceChat.Server.Dummy.Client 34 | { 35 | public class DummyClient : VoiceClient 36 | { 37 | public override Vector3 Position { get; } = new Vector3(0, 1, 0); 38 | 39 | public DummyClient(IVoiceServer server, VoiceHandle handle) : base(server, handle) 40 | { 41 | 42 | } 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /JustAnotherVoiceChat.Server.Dummy/src/Factories/DummyClientFactory.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * File: DummyClientFactory.cs 3 | * Date: 21.2.2018, 4 | * 5 | * MIT License 6 | * 7 | * Copyright (c) 2018 JustAnotherVoiceChat 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in all 17 | * copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | */ 27 | 28 | using JustAnotherVoiceChat.Server.Dummy.Client; 29 | using JustAnotherVoiceChat.Server.Dummy.Interfaces; 30 | using JustAnotherVoiceChat.Server.Wrapper.Interfaces; 31 | using JustAnotherVoiceChat.Server.Wrapper.Structs; 32 | 33 | namespace JustAnotherVoiceChat.Server.Dummy.Repositories 34 | { 35 | public class DummyClientFactory : IDummyClientFactory 36 | { 37 | public DummyClient MakeClient(byte identifer, IVoiceServer server, VoiceHandle handle) 38 | { 39 | return new DummyClient(server, handle); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /JustAnotherVoiceChat.Server.Dummy/src/Interfaces/IDummyClientRepository.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * File: IDummyClientRepository.cs 3 | * Date: 21.2.2018, 4 | * 5 | * MIT License 6 | * 7 | * Copyright (c) 2018 JustAnotherVoiceChat 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in all 17 | * copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | */ 27 | 28 | using JustAnotherVoiceChat.Server.Dummy.Client; 29 | using JustAnotherVoiceChat.Server.Wrapper.Interfaces; 30 | 31 | namespace JustAnotherVoiceChat.Server.Dummy.Interfaces 32 | { 33 | public interface IDummyClientFactory : IVoiceClientFactory 34 | { 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /JustAnotherVoiceChat.Server.Dummy/src/ServerHandler.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * File: ServerHandler.cs 3 | * Date: 21.2.2018, 4 | * 5 | * MIT License 6 | * 7 | * Copyright (c) 2018 JustAnotherVoiceChat 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in all 17 | * copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | */ 27 | 28 | using System.Collections.Concurrent; 29 | using System.Threading; 30 | using JustAnotherVoiceChat.Server.Dummy.Client; 31 | using JustAnotherVoiceChat.Server.Dummy.Interfaces; 32 | using JustAnotherVoiceChat.Server.Wrapper.Elements.Models; 33 | using JustAnotherVoiceChat.Server.Wrapper.Elements.Server; 34 | using JustAnotherVoiceChat.Server.Wrapper.Interfaces; 35 | using NLog; 36 | 37 | namespace JustAnotherVoiceChat.Server.Dummy 38 | { 39 | public class ServerHandler : VoiceServer 40 | { 41 | private readonly Logger _logger = LogManager.GetCurrentClassLogger(); 42 | 43 | private readonly ConcurrentBag _voiceClients = new ConcurrentBag(); 44 | 45 | public ServerHandler(IDummyClientFactory clientRepository, VoiceServerConfiguration configuration) : base(clientRepository, configuration) 46 | { 47 | OnServerStarted += () => 48 | { 49 | _logger.Debug($"JustAnotherVoiceChat: Listening on {Configuration.Hostname}:{Configuration.Port}"); 50 | }; 51 | 52 | OnServerStopping += () => 53 | { 54 | _logger.Debug("JustAnotherVoiceChat: Stopping..."); 55 | }; 56 | 57 | OnClientConnected += c => 58 | { 59 | _logger.Debug("Client connected: " + c.Handle.Identifer); 60 | }; 61 | } 62 | 63 | public DummyClient PrepareClient() 64 | { 65 | return PrepareClient(1); 66 | } 67 | 68 | public void StartStresstest() 69 | { 70 | for (var i = 0; i < 20; i++) 71 | { 72 | new Thread(ClientPrepareThread).Start(); 73 | } 74 | for (var i = 0; i < 20; i++) 75 | { 76 | new Thread(ClientRemoveThread).Start(); 77 | } 78 | } 79 | 80 | public void ClientPrepareThread() 81 | { 82 | while (true) 83 | { 84 | var createdClient = PrepareClient(); 85 | 86 | if (createdClient == null) 87 | { 88 | _logger.Warn("Failed to create client!"); 89 | } 90 | else 91 | { 92 | _logger.Info("Created client: " + createdClient.Handle.Identifer); 93 | } 94 | 95 | _voiceClients.Add(createdClient); 96 | 97 | Thread.Sleep(1); 98 | } 99 | } 100 | 101 | public void ClientRemoveThread() 102 | { 103 | while (true) 104 | { 105 | Thread.Sleep(2); 106 | 107 | if (!_voiceClients.TryTake(out var client)) 108 | { 109 | continue; 110 | } 111 | 112 | if (RemoveClient(client)) 113 | { 114 | _logger.Info("Removed client: " + client.Handle.Identifer); 115 | } 116 | else 117 | { 118 | _logger.Warn("Failed to remove client: " + client.Handle.Identifer); 119 | } 120 | } 121 | } 122 | 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /JustAnotherVoiceChat.Server.GTMP.Resource/JustAnotherVoiceChat.Server.GTMP.Resource.csproj.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | True -------------------------------------------------------------------------------- /JustAnotherVoiceChat.Server.GTMP.Resource/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2006 Damien Miller (jBCrypt) 2 | Copyright (c) 2013 Ryan D. Emerle (.Net port) 3 | 4 | Permission to use, copy, modify, and distribute this software for any 5 | purpose with or without fee is hereby granted, provided that the above 6 | copyright notice and this permission notice appear in all copies. 7 | 8 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -------------------------------------------------------------------------------- /JustAnotherVoiceChat.Server.GTMP.Resource/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * File: AssemblyInfo.cs 3 | * Date: 22.2.2018, 4 | * 5 | * MIT License 6 | * 7 | * Copyright (c) 2018 JustAnotherVoiceChat 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in all 17 | * copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | */ 27 | 28 | using System.Reflection; 29 | using System.Runtime.InteropServices; 30 | 31 | // General Information about an assembly is controlled through the following 32 | // set of attributes. Change these attribute values to modify the information 33 | // associated with an assembly. 34 | [assembly: AssemblyTitle("JustAnotherVoiceChat.Server.GTMP.Resource")] 35 | [assembly: AssemblyDescription("")] 36 | [assembly: AssemblyConfiguration("")] 37 | [assembly: AssemblyCompany("")] 38 | [assembly: AssemblyProduct("JustAnotherVoiceChat.Server.GTMP.Resource")] 39 | [assembly: AssemblyCopyright("Copyright © 2018")] 40 | [assembly: AssemblyTrademark("")] 41 | [assembly: AssemblyCulture("")] 42 | 43 | // Setting ComVisible to false makes the types in this assembly not visible 44 | // to COM components. If you need to access a type in this assembly from 45 | // COM, set the ComVisible attribute to true on that type. 46 | [assembly: ComVisible(false)] 47 | 48 | // The following GUID is for the ID of the typelib if this project is exposed to COM 49 | [assembly: Guid("62D8EA73-E9AA-435F-B58C-139C69507B26")] 50 | 51 | // Version information for an assembly consists of the following four values: 52 | // 53 | // Major Version 54 | // Minor Version 55 | // Build Number 56 | // Revision 57 | // 58 | // You can specify all the values or you can default the Build and Revision Numbers 59 | // by using the '*' as shown below: 60 | // [assembly: AssemblyVersion("1.0.*")] 61 | [assembly: AssemblyVersion("1.0.0.0")] 62 | [assembly: AssemblyFileVersion("1.0.0.0")] 63 | -------------------------------------------------------------------------------- /JustAnotherVoiceChat.Server.GTMP.Resource/Server/Helpers/RadioHandler.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * File: RadioHandler.cs 3 | * Date: 24.2.2018, 4 | * 5 | * MIT License 6 | * 7 | * Copyright (c) 2018 JustAnotherVoiceChat 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in all 17 | * copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | */ 27 | 28 | using System; 29 | using GrandTheftMultiplayer.Server.API; 30 | using GrandTheftMultiplayer.Server.Elements; 31 | using GrandTheftMultiplayer.Shared.Math; 32 | using JustAnotherVoiceChat.Server.GTMP.Extensions; 33 | 34 | namespace JustAnotherVoiceChat.Server.GTMP.Resource.Helpers 35 | { 36 | public class RadioHandler : Script 37 | { 38 | 39 | private const string RadioStatus = "RADIO_ACTIVE"; 40 | private const string RadioChannel = "RADIO_CHANNEL"; 41 | 42 | public bool EnableRadio(Client sender, string channel) 43 | { 44 | if (sender == null) 45 | { 46 | throw new ArgumentNullException(nameof(sender)); 47 | } 48 | 49 | if (channel == null) 50 | { 51 | throw new ArgumentNullException(nameof(channel)); 52 | } 53 | 54 | sender.setData(RadioStatus, true); 55 | sender.setData(RadioChannel, channel); 56 | 57 | return true; 58 | } 59 | 60 | public bool DisableRadio(Client sender) 61 | { 62 | if (sender == null) 63 | { 64 | throw new ArgumentNullException(nameof(sender)); 65 | } 66 | 67 | sender.setData(RadioStatus, false); 68 | sender.setData(RadioChannel, "Off"); 69 | 70 | return true; 71 | } 72 | 73 | public bool UseRadio(Client sender, string channel, bool decision) 74 | { 75 | if (sender == null) 76 | { 77 | throw new ArgumentNullException(nameof(sender)); 78 | } 79 | 80 | if (channel == null) 81 | { 82 | throw new ArgumentNullException(nameof(channel)); 83 | } 84 | 85 | if (channel == "Off") 86 | { 87 | return false; 88 | } 89 | 90 | if (decision == true) 91 | { 92 | foreach (var reciever in API.getAllPlayers()) 93 | { 94 | if (reciever == null || reciever.IsNull) 95 | { 96 | continue; 97 | } 98 | 99 | if (reciever.getData(RadioChannel) == channel && reciever.getData(RadioStatus) == true) 100 | { 101 | reciever.SetRelativeSpeakerPosition(sender, new Vector3(1, 0, 0)); 102 | } 103 | } 104 | } 105 | else 106 | { 107 | foreach (var reciever in API.getAllPlayers()) 108 | { 109 | if (reciever == null || reciever.IsNull) 110 | { 111 | continue; 112 | } 113 | 114 | if (reciever.getData(RadioChannel) == channel && reciever.getData(RadioStatus) == true || reciever.hasData(RadioStatus) == false) 115 | { 116 | reciever.ResetRelativeSpeakerPosition(sender); 117 | } 118 | } 119 | } 120 | 121 | return true; 122 | } 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /JustAnotherVoiceChat.Server.GTMP.Resource/Server/VoiceScript.GtmpEvents.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * File: VoiceScript.GtmpEvents.cs 3 | * Date: 21.2.2018, 4 | * 5 | * MIT License 6 | * 7 | * Copyright (c) 2018 JustAnotherVoiceChat 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in all 17 | * copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | */ 27 | 28 | using GrandTheftMultiplayer.Server.Constant; 29 | using GrandTheftMultiplayer.Server.Elements; 30 | using JustAnotherVoiceChat.Server.GTMP.Extensions; 31 | 32 | namespace JustAnotherVoiceChat.Server.GTMP.Resource 33 | { 34 | public partial class VoiceScript 35 | { 36 | 37 | private void AttachToGtmpEvents(bool testingEvents) 38 | { 39 | API.onClientEventTrigger += OnClientEventTrigger; 40 | 41 | if (testingEvents) 42 | { 43 | API.onPlayerFinishedDownload += OnPlayerFinishedDownload; 44 | } 45 | } 46 | 47 | private void OnPlayerFinishedDownload(Client player) 48 | { 49 | player.setSkin(PedHash.FreemodeMale01); 50 | } 51 | 52 | private void OnClientEventTrigger(Client sender, string eventName, params object[] arguments) 53 | { 54 | if (eventName != "VOICE_ROTATION") 55 | { 56 | return; 57 | } 58 | 59 | sender.SetVoiceRotation((float) arguments[0]); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /JustAnotherVoiceChat.Server.GTMP.Resource/Server/VoiceScript.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * File: VoiceScript.cs 3 | * Date: 22.2.2018, 4 | * 5 | * MIT License 6 | * 7 | * Copyright (c) 2018 JustAnotherVoiceChat 8 | * 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy 10 | * of this software and associated documentation files (the "Software"), to deal 11 | * in the Software without restriction, including without limitation the rights 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | * copies of the Software, and to permit persons to whom the Software is 14 | * furnished to do so, subject to the following conditions: 15 | * 16 | * The above copyright notice and this permission notice shall be included in all 17 | * copies or substantial portions of the Software. 18 | * 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | * SOFTWARE. 26 | */ 27 | 28 | using GrandTheftMultiplayer.Server.API; 29 | using JustAnotherVoiceChat.Server.GTMP.Elements.Tasks; 30 | using JustAnotherVoiceChat.Server.GTMP.Factories; 31 | using JustAnotherVoiceChat.Server.GTMP.Interfaces; 32 | using JustAnotherVoiceChat.Server.GTMP.Resource.Helpers; 33 | using JustAnotherVoiceChat.Server.Wrapper.Elements.Models; 34 | 35 | namespace JustAnotherVoiceChat.Server.GTMP.Resource 36 | { 37 | public partial class VoiceScript : Script 38 | { 39 | 40 | private IGtmpVoiceServer _voiceServer; 41 | private RadioHandler _radioHandler; 42 | private TelephoneHandler _phoneHandler; 43 | 44 | public VoiceScript() 45 | { 46 | API.onResourceStop += OnResourceStop; 47 | API.onResourceStart += OnResourceStart; 48 | } 49 | 50 | private void OnResourceStart() 51 | { 52 | // Create a JustAnotherVoiceServer based GtmpVoice Server! 53 | var hostname = API.getResourceSetting("justanothervoicechat", "voice_host"); 54 | var port = API.getResourceSetting("justanothervoicechat", "voice_port"); 55 | 56 | var teamspeakServerId = API.getResourceSetting("justanothervoicechat", "voice_teamspeak_serverid"); 57 | var teamspeakChannelId = API.getResourceSetting("justanothervoicechat", "voice_teamspeak_channelid"); 58 | var teamspeakChannelPassword = API.getResourceSetting("justanothervoicechat", "voice_teamspeak_channelpassword"); 59 | 60 | _voiceServer = GtmpVoice.CreateServer(API, new VoiceServerConfiguration(hostname, port, teamspeakServerId, teamspeakChannelId, teamspeakChannelPassword)); 61 | 62 | // Enables 3D Voice 63 | _voiceServer.AddTask(new GtmpPositionalTask()); 64 | 65 | // Attach to some IVoiceServer events to react to certain them with certain actions. 66 | AttachToVoiceServerEvents(); 67 | 68 | // Attach to GTMP-Events, so the connection works and camera rotation updates. 69 | AttachToGtmpEvents(true); 70 | 71 | _radioHandler = new RadioHandler(); 72 | _phoneHandler = new TelephoneHandler(_voiceServer); 73 | 74 | // Startup VoiceServer, so players are able to connect. 75 | _voiceServer.Start(); 76 | } 77 | 78 | private void OnResourceStop() 79 | { 80 | API.onResourceStop -= OnResourceStop; 81 | API.onResourceStart -= OnResourceStart; 82 | 83 | _radioHandler = null; 84 | _phoneHandler = null; 85 | 86 | _voiceServer.Stop(); 87 | _voiceServer.Dispose(); 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /JustAnotherVoiceChat.Server.GTMP.Resource/meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |