diff --git a/Torch.Server/Managers/MultiplayerManagerDedicated.cs b/Torch.Server/Managers/MultiplayerManagerDedicated.cs index aa478d0..081f0b4 100644 --- a/Torch.Server/Managers/MultiplayerManagerDedicated.cs +++ b/Torch.Server/Managers/MultiplayerManagerDedicated.cs @@ -151,8 +151,11 @@ namespace Torch.Server.Managers //Largely copied from SE private void ValidateAuthTicketResponse(ulong steamId, JoinResult response, ulong steamOwner) { - //SteamNetworking.GetP2PSessionState(new CSteamID(steamId), out P2PSessionState_t state); - var ip = "0"; //state.GetRemoteIP(); + //SteamNetworking.GetP2PSessionState(new CSteamID(steamId), out P2PSessionState_t state); + //state.GetRemoteIP(); + MyP2PSessionState statehack = new MyP2PSessionState(); + VRage.Steam.MySteamService.Static.Peer2Peer.GetSessionState(steamId, ref statehack); + var ip = new IPAddress(BitConverter.GetBytes(statehack.RemoteIP).Reverse().ToArray()); Torch.CurrentSession.KeenSession.PromotedUsers.TryGetValue(steamId, out MyPromoteLevel promoteLevel); diff --git a/Torch/Commands/TorchCommands.cs b/Torch/Commands/TorchCommands.cs index 53f68b9..04707c4 100644 --- a/Torch/Commands/TorchCommands.cs +++ b/Torch/Commands/TorchCommands.cs @@ -33,14 +33,12 @@ namespace Torch.Commands [Permission(MyPromoteLevel.None)] public void GetIP(ulong steamId = 0) { - Context.Respond("Cannot obtain client IP."); - return; - if (steamId == 0) steamId = Context.Player.SteamUserId; - - SteamNetworking.GetP2PSessionState(new CSteamID(steamId), out P2PSessionState_t state); - var ip = new IPAddress(BitConverter.GetBytes(state.m_nRemoteIP).Reverse().ToArray()); + + VRage.GameServices.MyP2PSessionState statehack = new VRage.GameServices.MyP2PSessionState(); + VRage.Steam.MySteamService.Static.Peer2Peer.GetSessionState(steamId, ref statehack); + var ip = new IPAddress(BitConverter.GetBytes(statehack.RemoteIP).Reverse().ToArray()); Context.Respond($"Your IP is {ip}"); }