Esempio n. 1
0
        public override void LaunchLocalServer(Process process, ServerMode mode)
        {
            WeGameHelper.WriteDebugString(nameof(LaunchLocalServer));
            if (this._lobby.State != LobbyState.Inactive)
            {
                this._lobby.Leave();
            }
            ProcessStartInfo startInfo = process.StartInfo;

            startInfo.Arguments = startInfo.Arguments + " -steam -localsteamid " + (object)(ulong)SteamUser.GetSteamID().m_SteamID;
            if (mode.HasFlag((Enum)ServerMode.Lobby))
            {
                this._hasLocalHost = true;
                if (mode.HasFlag((Enum)ServerMode.FriendsCanJoin))
                {
                    process.StartInfo.Arguments += " -lobby friends";
                }
                else
                {
                    process.StartInfo.Arguments += " -lobby private";
                }
                if (mode.HasFlag((Enum)ServerMode.FriendsOfFriends))
                {
                    process.StartInfo.Arguments += " -friendsoffriends";
                }
            }
            SteamFriends.SetRichPresence("status", Language.GetTextValue("Social.StatusInGame"));
            Netplay.OnDisconnect += new Action(this.OnDisconnect);
            process.Start();
        }
        public override void LaunchLocalServer(Process process, ServerMode mode)
        {
            //IL_0039: Unknown result type (might be due to invalid IL or missing references)
            WeGameHelper.WriteDebugString("LaunchLocalServer");
            if (_lobby.State != 0)
            {
                _lobby.Leave();
            }
            ProcessStartInfo startInfo = process.StartInfo;

            startInfo.Arguments = startInfo.Arguments + " -steam -localsteamid " + SteamUser.GetSteamID().m_SteamID;
            if (mode.HasFlag(ServerMode.Lobby))
            {
                _hasLocalHost = true;
                if (mode.HasFlag(ServerMode.FriendsCanJoin))
                {
                    process.StartInfo.Arguments += " -lobby friends";
                }
                else
                {
                    process.StartInfo.Arguments += " -lobby private";
                }
                if (mode.HasFlag(ServerMode.FriendsOfFriends))
                {
                    process.StartInfo.Arguments += " -friendsoffriends";
                }
            }
            SteamFriends.SetRichPresence("status", Language.GetTextValue("Social.StatusInGame"));
            Netplay.OnDisconnect += OnDisconnect;
            process.Start();
        }
 private void OnSessionConnectFail(P2PSessionConnectFail_t result)
 {
     //IL_0011: Unknown result type (might be due to invalid IL or missing references)
     //IL_0012: Unknown result type (might be due to invalid IL or missing references)
     WeGameHelper.WriteDebugString(" OnSessionConnectFail");
     Close(result.m_steamIDRemote);
 }
        private void OnLobbyJoinRequest(GameLobbyJoinRequested_t result)
        {
            //IL_000e: Unknown result type (might be due to invalid IL or missing references)
            //IL_000f: Unknown result type (might be due to invalid IL or missing references)
            //IL_0043: Unknown result type (might be due to invalid IL or missing references)
            WeGameHelper.WriteDebugString(" OnLobbyJoinRequest");
            if (_lobby.State != 0)
            {
                _lobby.Leave();
            }
            string friendName = SteamFriends.GetFriendPersonaName(result.m_steamIDFriend);

            Main.QueueMainThreadAction(delegate
            {
                Main.OpenPlayerSelect(delegate(PlayerFileData playerData)
                {
                    //IL_003c: Unknown result type (might be due to invalid IL or missing references)
                    Main.ServerSideCharacter = false;
                    playerData.SetAsActive();
                    Main.menuMode   = 882;
                    Main.statusText = Language.GetTextValue("Social.JoiningFriend", friendName);
                    //_lobby.Join(result.m_steamIDLobby, OnLobbyEntered);
                });
            });
        }
Esempio n. 5
0
        private void OnLobbyEntered(LobbyEnter_t result, bool failure)
        {
            //IL_001e: Unknown result type (might be due to invalid IL or missing references)
            //IL_002c: Unknown result type (might be due to invalid IL or missing references)
            //IL_0082: Unknown result type (might be due to invalid IL or missing references)
            //IL_0094: Unknown result type (might be due to invalid IL or missing references)
            //IL_00a4: Unknown result type (might be due to invalid IL or missing references)
            //IL_00b2: Unknown result type (might be due to invalid IL or missing references)
            //IL_00ca: Unknown result type (might be due to invalid IL or missing references)
            //IL_00db: Unknown result type (might be due to invalid IL or missing references)
            //IL_0127: Unknown result type (might be due to invalid IL or missing references)
            WeGameHelper.WriteDebugString(" OnLobbyEntered");
            SteamNetworking.AllowP2PPacketRelay(true);
            SendAuthTicket(_lobby.Owner);
            int num = 0;
            P2PSessionState_t val = default(P2PSessionState_t);

            while (SteamNetworking.GetP2PSessionState(_lobby.Owner, ref val) && val.m_bConnectionActive != 1)
            {
                switch (val.m_eP2PSessionError)
                {
                case 2:
                    ClearAuthTicket();
                    return;

                case 1:
                    ClearAuthTicket();
                    return;

                case 3:
                    ClearAuthTicket();
                    return;

                case 5:
                    ClearAuthTicket();
                    return;

                case 4:
                    if (++num > 5)
                    {
                        ClearAuthTicket();
                        return;
                    }
                    SteamNetworking.CloseP2PSessionWithUser(_lobby.Owner);
                    SendAuthTicket(_lobby.Owner);
                    break;
                }
            }
            _connectionStateMap[_lobby.Owner] = ConnectionState.Connected;
            SteamFriends.SetPlayedWith(_lobby.Owner);
            SteamFriends.SetRichPresence("status", Language.GetTextValue("Social.StatusInGame"));
            Main.clrInput();
            Netplay.ServerPassword = "";
            Main.GetInputText("");
            Main.autoPass = false;
            Main.netMode  = 1;
            Netplay.OnConnectedToSocialServer(new SocialSocket(new SteamAddress(_lobby.Owner)));
        }
Esempio n. 6
0
 private static void LoadWeGame()
 {
     LoadModule <Terraria.Social.WeGame.CoreSocialModule>();
     Cloud   = LoadModule <Terraria.Social.WeGame.CloudSocialModule>();
     Friends = LoadModule <Terraria.Social.WeGame.FriendsSocialModule>();
     Overlay = LoadModule <Terraria.Social.WeGame.OverlaySocialModule>();
     Network = LoadModule <Terraria.Social.WeGame.NetClientSocialModule>();
     WeGameHelper.WriteDebugString("LoadWeGame modules");
 }
Esempio n. 7
0
 private static void LoadWeGame()
 {
     SocialAPI.LoadModule <Terraria.Social.WeGame.CoreSocialModule>();
     SocialAPI.Cloud   = (Terraria.Social.Base.CloudSocialModule)SocialAPI.LoadModule <Terraria.Social.WeGame.CloudSocialModule>();
     SocialAPI.Friends = (Terraria.Social.Base.FriendsSocialModule)SocialAPI.LoadModule <Terraria.Social.WeGame.FriendsSocialModule>();
     SocialAPI.Overlay = (Terraria.Social.Base.OverlaySocialModule)SocialAPI.LoadModule <Terraria.Social.WeGame.OverlaySocialModule>();
     SocialAPI.Network = (Terraria.Social.Base.NetSocialModule)SocialAPI.LoadModule <Terraria.Social.WeGame.NetServerSocialModule>();
     WeGameHelper.WriteDebugString("LoadWeGame modules");
 }
Esempio n. 8
0
 private static void LoadSteam()
 {
     LoadModule <Terraria.Social.Steam.CoreSocialModule>();
     Friends      = LoadModule <Terraria.Social.Steam.FriendsSocialModule>();
     Achievements = LoadModule <Terraria.Social.Steam.AchievementsSocialModule>();
     Cloud        = LoadModule <Terraria.Social.Steam.CloudSocialModule>();
     Overlay      = LoadModule <Terraria.Social.Steam.OverlaySocialModule>();
     Network      = LoadModule <Terraria.Social.Steam.NetClientSocialModule>();
     WeGameHelper.WriteDebugString("LoadSteam modules");
 }
Esempio n. 9
0
 private static void LoadSteam()
 {
     SocialAPI.LoadModule <Terraria.Social.Steam.CoreSocialModule>();
     SocialAPI.Friends      = (Terraria.Social.Base.FriendsSocialModule)SocialAPI.LoadModule <Terraria.Social.Steam.FriendsSocialModule>();
     SocialAPI.Achievements = (Terraria.Social.Base.AchievementsSocialModule)SocialAPI.LoadModule <Terraria.Social.Steam.AchievementsSocialModule>();
     SocialAPI.Cloud        = (Terraria.Social.Base.CloudSocialModule)SocialAPI.LoadModule <Terraria.Social.Steam.CloudSocialModule>();
     SocialAPI.Overlay      = (Terraria.Social.Base.OverlaySocialModule)SocialAPI.LoadModule <Terraria.Social.Steam.OverlaySocialModule>();
     SocialAPI.Network      = (Terraria.Social.Base.NetSocialModule)SocialAPI.LoadModule <Terraria.Social.Steam.NetClientSocialModule>();
     WeGameHelper.WriteDebugString("LoadSteam modules");
 }
Esempio n. 10
0
        private void OnP2PSessionRequest(P2PSessionRequest_t result)
        {
            WeGameHelper.WriteDebugString(" OnP2PSessionRequest");
            CSteamID steamIdRemote = (CSteamID)result.m_steamIDRemote;

            if (!this._connectionStateMap.ContainsKey(steamIdRemote) || this._connectionStateMap[steamIdRemote] == NetSocialModule.ConnectionState.Inactive)
            {
                return;
            }
            SteamNetworking.AcceptP2PSessionWithUser(steamIdRemote);
        }
Esempio n. 11
0
        private void OnLobbyEntered(LobbyEnter_t result, bool failure)
        {
            WeGameHelper.WriteDebugString(" OnLobbyEntered");
            SteamNetworking.AllowP2PPacketRelay(true);
            this.SendAuthTicket(this._lobby.Owner);
            int num = 0;
            P2PSessionState_t p2PsessionStateT;

            while (SteamNetworking.GetP2PSessionState(this._lobby.Owner, ref p2PsessionStateT) && p2PsessionStateT.m_bConnectionActive != 1)
            {
                switch ((byte)p2PsessionStateT.m_eP2PSessionError)
                {
                case 1:
                    this.ClearAuthTicket();
                    return;

                case 2:
                    this.ClearAuthTicket();
                    return;

                case 3:
                    this.ClearAuthTicket();
                    return;

                case 4:
                    if (++num > 5)
                    {
                        this.ClearAuthTicket();
                        return;
                    }
                    SteamNetworking.CloseP2PSessionWithUser(this._lobby.Owner);
                    this.SendAuthTicket(this._lobby.Owner);
                    continue;

                case 5:
                    this.ClearAuthTicket();
                    return;

                default:
                    continue;
                }
            }
            this._connectionStateMap[this._lobby.Owner] = NetSocialModule.ConnectionState.Connected;
            SteamFriends.SetPlayedWith(this._lobby.Owner);
            SteamFriends.SetRichPresence("status", Language.GetTextValue("Social.StatusInGame"));
            Main.clrInput();
            Netplay.ServerPassword = "";
            Main.GetInputText("", false);
            Main.autoPass = false;
            Main.netMode  = 1;
            Netplay.OnConnectedToSocialServer((ISocket) new SocialSocket((RemoteAddress) new SteamAddress(this._lobby.Owner)));
        }
Esempio n. 12
0
        private void OnP2PSessionRequest(P2PSessionRequest_t result)
        {
            //IL_0010: Unknown result type (might be due to invalid IL or missing references)
            //IL_0011: Unknown result type (might be due to invalid IL or missing references)
            //IL_0016: Unknown result type (might be due to invalid IL or missing references)
            //IL_001d: Unknown result type (might be due to invalid IL or missing references)
            //IL_002b: Unknown result type (might be due to invalid IL or missing references)
            //IL_0033: Unknown result type (might be due to invalid IL or missing references)
            WeGameHelper.WriteDebugString(" OnP2PSessionRequest");
            CSteamID steamIDRemote = result.m_steamIDRemote;

            if (_connectionStateMap.ContainsKey(steamIDRemote) && _connectionStateMap[steamIDRemote] != 0)
            {
                SteamNetworking.AcceptP2PSessionWithUser(steamIDRemote);
            }
        }
Esempio n. 13
0
        private void OnLobbyJoinRequest(GameLobbyJoinRequested_t result)
        {
            WeGameHelper.WriteDebugString(" OnLobbyJoinRequest");
            if (this._lobby.State != LobbyState.Inactive)
            {
                this._lobby.Leave();
            }
            string friendName = SteamFriends.GetFriendPersonaName((CSteamID)result.m_steamIDFriend);

            Main.QueueMainThreadAction((Action)(() => Main.OpenPlayerSelect((Main.OnPlayerSelected)(playerData =>
            {
                Main.ServerSideCharacter = false;
                playerData.SetAsActive();
                Main.menuMode = 882;
                Main.statusText = Language.GetTextValue("Social.JoiningFriend", (object)friendName);
                // ISSUE: method pointer
                this._lobby.Join((CSteamID)result.m_steamIDLobby, new CallResult <LobbyEnter_t> .APIDispatchDelegate((object)this, __methodptr(OnLobbyEntered)));
            }))));
        }
Esempio n. 14
0
        private void SendAuthTicket(CSteamID address)
        {
            WeGameHelper.WriteDebugString(" SendAuthTicket");
            if (HAuthTicket.op_Equality(this._authTicket, (HAuthTicket)HAuthTicket.Invalid))
            {
                this._authTicket = SteamUser.GetAuthSessionTicket(this._authData, this._authData.Length, ref this._authDataLength);
            }
            int length = (int)this._authDataLength + 3;

            byte[] numArray = new byte[length];
            numArray[0] = (byte)(length & (int)byte.MaxValue);
            numArray[1] = (byte)(length >> 8 & (int)byte.MaxValue);
            numArray[2] = (byte)93;
            for (int index = 0; (long)index < (long)this._authDataLength; ++index)
            {
                numArray[index + 3] = this._authData[index];
            }
            SteamNetworking.SendP2PPacket(address, numArray, (uint)length, (EP2PSend)2, 1);
        }
Esempio n. 15
0
        public void ConnectToLobby(ulong lobbyId)
        {
            CSteamID lobbySteamId = new CSteamID(lobbyId);

            if (!((CSteamID) ref lobbySteamId).IsValid())
            {
                return;
            }
            Main.OpenPlayerSelect((Main.OnPlayerSelected)(playerData =>
            {
                Main.ServerSideCharacter = false;
                playerData.SetAsActive();
                Main.menuMode   = 882;
                Main.statusText = Language.GetTextValue("Social.Joining");
                WeGameHelper.WriteDebugString(" CheckParameters, lobby.join");
                // ISSUE: method pointer
                this._lobby.Join(lobbySteamId, new CallResult <LobbyEnter_t> .APIDispatchDelegate((object)this, __methodptr(OnLobbyEntered)));
            }));
        }
Esempio n. 16
0
        public void ConnectToLobby(ulong lobbyId)
        {
            //IL_000f: Unknown result type (might be due to invalid IL or missing references)
            //IL_0014: Unknown result type (might be due to invalid IL or missing references)
            CSteamID lobbySteamId = new CSteamID(lobbyId);

            if (((CSteamID)(ref lobbySteamId)).IsValid())
            {
                Main.OpenPlayerSelect(delegate(PlayerFileData playerData)
                {
                    //IL_0041: Unknown result type (might be due to invalid IL or missing references)
                    Main.ServerSideCharacter = false;
                    playerData.SetAsActive();
                    Main.menuMode   = 882;
                    Main.statusText = Language.GetTextValue("Social.Joining");
                    WeGameHelper.WriteDebugString(" CheckParameters, lobby.join");
                    _lobby.Join(lobbySteamId, OnLobbyEntered);
                });
            }
        }
Esempio n. 17
0
        private void SendAuthTicket(CSteamID address)
        {
            //IL_0011: Unknown result type (might be due to invalid IL or missing references)
            //IL_0016: Unknown result type (might be due to invalid IL or missing references)
            //IL_0037: Unknown result type (might be due to invalid IL or missing references)
            //IL_003c: Unknown result type (might be due to invalid IL or missing references)
            //IL_008e: Unknown result type (might be due to invalid IL or missing references)
            WeGameHelper.WriteDebugString(" SendAuthTicket");
            if (_authTicket == HAuthTicket.Invalid)
            {
                _authTicket = SteamUser.GetAuthSessionTicket(_authData, _authData.Length, ref _authDataLength);
            }
            int num = (int)(_authDataLength + 3);

            byte[] array = new byte[num];
            array[0] = (byte)(num & 0xFF);
            array[1] = (byte)((num >> 8) & 0xFF);
            array[2] = 93;
            for (int i = 0; i < _authDataLength; i++)
            {
                array[i + 3] = _authData[i];
            }
            SteamNetworking.SendP2PPacket(address, array, (uint)num, (EP2PSend)2, 1);
        }
Esempio n. 18
0
 private void OnSessionConnectFail(P2PSessionConnectFail_t result)
 {
     WeGameHelper.WriteDebugString(" OnSessionConnectFail");
     this.Close((CSteamID)result.m_steamIDRemote);
 }