Exemplo n.º 1
0
        void Client_ReceiveAddUser(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            uint   identifier     = reader.ReadVariableUInt32();
            string name           = reader.ReadString();
            bool   bot            = reader.ReadBoolean();
            uint   userIdentifier = reader.ReadVariableUInt32();

            if (!reader.Complete())
            {
                return;
            }

            //check for already exists
            {
                Client_Player playerForCheck = Client_GetPlayer(identifier);

                if (playerForCheck != null)
                {
                    Log.Fatal("PlayerManager: Client_ReceiveAddUserToClient: Player " +
                              "with identifier \"{0}\" is already exists.", identifier);
                }
            }

            UserManagementClientNetworkService.UserInfo user = null;
            if (userIdentifier != 0)
            {
                user = GameNetworkClient.Instance.UserManagementService.GetUser(userIdentifier);
            }

            Client_Player player = new Client_Player(identifier, name, bot, user);

            client_players.Add(player);
        }
        void Server_ReceiveChangeMainControlledUnit(RemoteEntityWorld sender,
                                                    ReceiveDataReader reader)
        {
            //not safe. client can send networkUIN of any unit from any place.

            //check to ensure that other players can not send messages to another player
            if (!Server_CheckRemoteEntityWorldAssociatedWithThisIntellect(sender))
            {
                return;
            }

            uint unitNetworkUIN = reader.ReadVariableUInt32();

            if (!reader.Complete())
            {
                return;
            }

            Unit unit = Entities.Instance.GetByNetworkUIN(unitNetworkUIN) as Unit;

            //unit is not exists
            if (unit == null)
            {
                return;
            }

            ServerOrSingle_ChangeMainControlledUnit(unit);
        }
        void Server_ReceiveControlKeyPress(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            //check to ensure that other players can not send messages to another player
            if (!Server_CheckRemoteEntityWorldAssociatedWithThisIntellect(sender))
            {
                return;
            }

            GameControlKeys controlKey = (GameControlKeys)reader.ReadVariableUInt32();
            float           strength   = reader.ReadSingle();

            if (!reader.Complete())
            {
                return;
            }

            //check for invalid value
            if (!Enum.IsDefined(typeof(GameControlKeys), (int)controlKey))
            {
                return;
            }
            if (strength <= 0)
            {
                return;
            }

            ControlKeyPress(controlKey, strength);
        }
Exemplo n.º 4
0
        private bool ReceiveMessage_TextToClient(NetworkNode.ConnectedNode sender,
                                                 MessageType messageType, ReceiveDataReader reader, ref string additionalErrorMessage)
        {
            //get data from message
            uint   fromUserIdentifier = reader.ReadVariableUInt32();
            string text = reader.ReadString();

            if (!reader.Complete())
            {
                return(false);
            }

            //get user by identifier
            UserManagementClientNetworkService.UserInfo fromUser = userManagementService.GetUser(
                fromUserIdentifier);
            if (fromUser == null)
            {
                //error. no such user.
                return(true);
            }

            if (ReceiveText != null)
            {
                ReceiveText(this, fromUser, text);
            }

            return(true);
        }
Exemplo n.º 5
0
        private void Client_ReceiveIntellect(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            uint        networkUIN = reader.ReadVariableUInt32();
            bool        shouldDeleteAfterDetach = reader.ReadBoolean();
            FactionType ft = null;

            if (GameMap.Instance.GameType == GameMap.GameTypes.AssaultKnights)
            {
                string factionName = reader.ReadString();
                if (factionName != string.Empty)
                {
                    ft = (FactionType)EntityTypes.Instance.GetByName(factionName);
                }
            }
            if (!reader.Complete())
            {
                return;
            }

            Intellect i = null;

            if (networkUIN != 0)
            {
                i = (Intellect)Entities.Instance.GetByNetworkUIN(networkUIN);
                if (ft != null)
                {
                    i.Faction = ft;
                }
            }
            SetIntellect(i, shouldDeleteAfterDetach);
        }
Exemplo n.º 6
0
        private void Client_ReceiveHitCall(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            Vec3      hitPosition      = reader.ReadVec3();
            string    hitShapeBodyName = reader.ReadString();
            string    hitShapeName     = reader.ReadString();
            Vec3      hitNormal        = reader.ReadVec3();
            MapObject hitMapObject     = Entities.Instance.GetByNetworkUIN(reader.ReadVariableUInt32()) as MapObject;

            if (!reader.Complete())
            {
                return;
            }

            Position = hitPosition;
            Shape hitShape = null;

            if (PhysicsModel != null)
            {
                Body body = PhysicsModel.GetBody(hitShapeBodyName);
                if (body != null)
                {
                    hitShape = body.GetShape(hitShapeName);
                }
            }
            OnHit(hitShape, hitNormal, hitMapObject);
        }
Exemplo n.º 7
0
        void Client_ReceiveGameType(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            GameTypes value = (GameTypes)reader.ReadVariableUInt32();

            if (!reader.Complete())
            {
                return;
            }
            gameType = value;
        }
Exemplo n.º 8
0
		void Client_ReceiveRemoveUser( RemoteEntityWorld sender, ReceiveDataReader reader )
		{
			uint identifier = reader.ReadVariableUInt32();

			if( !reader.Complete() )
				return;

			Client_Player player = Client_GetPlayer( identifier );
			if( player == null )
				return;

			client_players.Remove( player );
		}
        void Client_ReceiveSetInstance(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            uint networkUIN = reader.ReadVariableUInt32();

            if (!reader.Complete())
            {
                return;
            }

            Entity entity = Entities.Instance.GetByNetworkUIN(networkUIN);

            SetInstance((PlayerIntellect)entity);
        }
        private void Client_ReceiveMoveBegin(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            uint userId = reader.ReadVariableUInt32();

            if (!reader.Complete())
            {
                return;
            }

            UserManagementClientNetworkService userService = GameNetworkClient.Instance.
                                                             UserManagementService;

            client_movingByUser = userService.GetUser(userId);
        }
        void Client_ReceiveMainNotActiveUnit(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            uint networkUIN = reader.ReadVariableUInt32();

            if (!reader.Complete())
            {
                return;
            }

            if (mainNotActiveUnit != null)
            {
                mainNotActiveUnit.Visible = true;
            }

            mainNotActiveUnit = Entities.Instance.GetByNetworkUIN(networkUIN) as Unit;
        }
Exemplo n.º 12
0
        void Client_ReceiveUpdateData(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            while (reader.BitPosition < reader.EndBitPosition)
            {
                uint  identifier = reader.ReadVariableUInt32();
                int   frags      = reader.ReadVariableInt32();
                float ping       = reader.ReadSingle();

                Client_Player player = Client_GetPlayer(identifier);

                if (player != null)
                {
                    player.Frags = frags;
                    player.Ping  = ping;
                }
            }
        }
        bool ReceiveMessage_AddUserToClient(NetworkNode.ConnectedNode sender,
                                            MessageType messageType, ReceiveDataReader reader, ref string additionalErrorMessage)
        {
            //get data from message
            uint   identifier   = reader.ReadVariableUInt32();
            string name         = reader.ReadString();
            bool   thisUserFlag = reader.ReadBoolean();

            if (!reader.Complete())
            {
                return(false);
            }

            AddUser(identifier, name, thisUserFlag);

            return(true);
        }
Exemplo n.º 14
0
        void Client_ReceiveControlledObject(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            uint networkUIN = reader.ReadVariableUInt32();

            if (!reader.Complete())
            {
                return;
            }

            if (networkUIN != 0)
            {
                ControlledObject = (Unit)Entities.Instance.GetByNetworkUIN(networkUIN);
            }
            else
            {
                ControlledObject = null;
            }
        }
Exemplo n.º 15
0
        void Client_ReceiveIntellect(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            uint networkUIN = reader.ReadVariableUInt32();
            bool shouldDeleteAfterDetach = reader.ReadBoolean();

            if (!reader.Complete())
            {
                return;
            }

            Intellect i = null;

            if (networkUIN != 0)
            {
                i = (Intellect)Entities.Instance.GetByNetworkUIN(networkUIN);
            }
            SetIntellect(i, shouldDeleteAfterDetach);
        }
Exemplo n.º 16
0
        private void Client_ReceiveRemoveUser(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            uint identifier = reader.ReadVariableUInt32();

            if (!reader.Complete())
            {
                return;
            }

            Client_Player player = Client_GetPlayer(identifier);

            if (player == null)
            {
                return;
            }

            uint ui = GameNetworkClient.Instance.UserManagementService.ThisUser.Identifier;

            client_players.Remove(player);
        }
Exemplo n.º 17
0
        private void Client_ReceiveUpdateData(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            while (reader.BitPosition < reader.EndBitPosition)
            {
                uint  identifier     = reader.ReadVariableUInt32();
                int   hitPoints      = reader.ReadVariableInt32();
                int   killPoints     = reader.ReadVariableInt32();
                int   assaultCredits = reader.ReadVariableInt32();
                float ping           = reader.ReadSingle();

                Client_Player player = Client_GetPlayer(identifier);

                if (player != null)
                {
                    player.HitPoints      = hitPoints;
                    player.KillPoints     = killPoints;
                    player.AssaultCredits = assaultCredits;
                    player.Ping           = ping;
                }
            }
        }
Exemplo n.º 18
0
        private bool ReceiveMessage_TextToServer(NetworkNode.ConnectedNode sender,
                                                 MessageType messageType, ReceiveDataReader reader, ref string additionalErrorMessage)
        {
            //get source user
            UserManagementServerNetworkService.UserInfo fromUser = userManagementService.
                                                                   GetUser(sender);

            //get data of message
            string text = reader.ReadString();
            uint   privateToUserIdentifier = reader.ReadVariableUInt32();

            if (!reader.Complete())
            {
                return(false);
            }

            //send text to the clients
            if (privateToUserIdentifier != 0)
            {
                //send text to the specific user

                UserManagementServerNetworkService.UserInfo privateToUser = userManagementService.
                                                                            GetUser(privateToUserIdentifier);
                if (privateToUser != null)
                {
                    SendText(fromUser, text, privateToUser);
                }
                else
                {
                    //no user anymore
                }
            }
            else
            {
                SendText(fromUser, text, null);
            }

            return(true);
        }
        bool ReceiveMessage_RemoveUserToClient(NetworkNode.ConnectedNode sender,
                                               MessageType messageType, ReceiveDataReader reader, ref string additionalErrorMessage)
        {
            //get data from message
            uint identifier = reader.ReadVariableUInt32();

            if (!reader.Complete())
            {
                return(false);
            }

            UserInfo user;

            users.TryGetValue(identifier, out user);

            if (user != null)
            {
                RemoveUser(user);
            }

            return(true);
        }
Exemplo n.º 20
0
        bool ReceiveMessage_TextToClient( NetworkNode.ConnectedNode sender,
			MessageType messageType, ReceiveDataReader reader, ref string additionalErrorMessage )
        {
            //get data from message
            uint fromUserIdentifier = reader.ReadVariableUInt32();
            string text = reader.ReadString();
            if( !reader.Complete() )
                return false;

            //get user by identifier
            UserManagementClientNetworkService.UserInfo fromUser = userManagementService.GetUser(
                fromUserIdentifier );
            if( fromUser == null )
            {
                //error. no such user.
                return true;
            }

            if( ReceiveText != null )
                ReceiveText( this, fromUser, text );

            return true;
        }
        void Client_ReceiveActiveWeapon(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            uint networkUIN = reader.ReadVariableUInt32();

            if (!reader.Complete())
            {
                return;
            }

            Weapon value = (Weapon)Entities.Instance.GetByNetworkUIN(networkUIN);

            if (activeWeaponAttachedObject != null)
            {
                Detach(activeWeaponAttachedObject);
                activeWeaponAttachedObject = null;
            }

            activeWeapon = value;

            if (activeWeapon != null)
            {
                CreateActiveWeaponAttachedObject();
            }
        }
        private bool ReceiveMessage_TextToServer(NetworkNode.ConnectedNode sender,
            MessageType messageType, ReceiveDataReader reader, ref string additionalErrorMessage)
        {
            //get source user
            UserManagementServerNetworkService.UserInfo fromUser = userManagementService.
                GetUser(sender);

            //get data of message
            string text = reader.ReadString();
            uint privateToUserIdentifier = reader.ReadVariableUInt32();
            if (!reader.Complete())
                return false;

            //send text to the clients
            if (privateToUserIdentifier != 0)
            {
                //send text to the specific user

                UserManagementServerNetworkService.UserInfo privateToUser = userManagementService.
                    GetUser(privateToUserIdentifier);
                if (privateToUser != null)
                {
                    SendText(fromUser, text, privateToUser);
                }
                else
                {
                    //no user anymore
                }
            }
            else
            {
                SendText(fromUser, text, null);
            }

            return true;
        }
Exemplo n.º 23
0
 void Client_ReceiveDieCall( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     MapObject prejudicial = Entities.Instance.GetByNetworkUIN( reader.ReadVariableUInt32() ) as MapObject;
     bool allowLatencyTime = reader.ReadBoolean();
     if( !reader.Complete() )
         return;
     Die( prejudicial, allowLatencyTime );
 }
Exemplo n.º 24
0
        private void Client_ReceiveIntellect(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            uint networkUIN = reader.ReadVariableUInt32();
            bool shouldDeleteAfterDetach = reader.ReadBoolean();
            FactionType ft = null;

            if (GameMap.Instance.GameType == GameMap.GameTypes.AssaultKnights)
            {
                string factionName = reader.ReadString();
                if (factionName != string.Empty)
                    ft = (FactionType)EntityTypes.Instance.GetByName(factionName);
            }
            if (!reader.Complete())
                return;

            Intellect i = null;
            if (networkUIN != 0)
            {
                i = (Intellect)Entities.Instance.GetByNetworkUIN(networkUIN);
                if (ft != null)
                    i.Faction = ft;
            }
            SetIntellect(i, shouldDeleteAfterDetach);
        }
Exemplo n.º 25
0
        void Client_ReceiveMoveBegin( RemoteEntityWorld sender, ReceiveDataReader reader )
        {
            uint userId = reader.ReadVariableUInt32();
            if( !reader.Complete() )
                return;

            UserManagementClientNetworkService userService = GameNetworkClient.Instance.
                UserManagementService;

            client_movingByUser = userService.GetUser( userId );
        }
Exemplo n.º 26
0
        void Client_ReceiveActiveWeapon( RemoteEntityWorld sender, ReceiveDataReader reader )
        {
            uint networkUIN = reader.ReadVariableUInt32();
            if( !reader.Complete() )
                return;

            Weapon value = (Weapon)Entities.Instance.GetByNetworkUIN( networkUIN );

            if( activeWeaponAttachedObject != null )
            {
                Detach( activeWeaponAttachedObject );
                activeWeaponAttachedObject = null;
            }

            activeWeapon = value;

            if( activeWeapon != null )
                CreateActiveWeaponAttachedObject();
        }
Exemplo n.º 27
0
        void Client_ReceiveMainNotActiveUnit( RemoteEntityWorld sender, ReceiveDataReader reader )
        {
            uint networkUIN = reader.ReadVariableUInt32();
            if( !reader.Complete() )
                return;

            if( mainNotActiveUnit != null )
                mainNotActiveUnit.Visible = true;

            mainNotActiveUnit = Entities.Instance.GetByNetworkUIN( networkUIN ) as Unit;
        }
Exemplo n.º 28
0
        void Client_ReceiveUpdateData( RemoteEntityWorld sender, ReceiveDataReader reader )
        {
            while( reader.BitPosition < reader.EndBitPosition )
            {
                uint identifier = reader.ReadVariableUInt32();
                int frags = reader.ReadVariableInt32();
                float ping = reader.ReadSingle();

                Client_Player player = Client_GetPlayer( identifier );

                if( player != null )
                {
                    player.Frags = frags;
                    player.Ping = ping;
                }
            }
        }
        private bool ReceiveMessage_RemoveUserToClient(NetworkNode.ConnectedNode sender,
            MessageType messageType, ReceiveDataReader reader, ref string additionalErrorMessage)
        {
            //get data from message
            uint identifier = reader.ReadVariableUInt32();
            if (!reader.Complete())
                return false;

            UserInfo user;
            users.TryGetValue(identifier, out user);

            if (user != null)
                RemoveUser(user);

            return true;
        }
Exemplo n.º 30
0
        void Client_ReceiveSetInstance( RemoteEntityWorld sender, ReceiveDataReader reader )
        {
            uint networkUIN = reader.ReadVariableUInt32();
            if( !reader.Complete() )
                return;

            Entity entity = Entities.Instance.GetByNetworkUIN( networkUIN );
            SetInstance( (PlayerIntellect)entity );
        }
Exemplo n.º 31
0
        void Client_ReceiveControlledObject( RemoteEntityWorld sender, ReceiveDataReader reader )
        {
            uint networkUIN = reader.ReadVariableUInt32();
            if( !reader.Complete() )
                return;

            if( networkUIN != 0 )
                ControlledObject = (Unit)Entities.Instance.GetByNetworkUIN( networkUIN );
            else
                ControlledObject = null;
        }
Exemplo n.º 32
0
        void Server_ReceiveControlKeyRelease( RemoteEntityWorld sender, ReceiveDataReader reader )
        {
            //check to ensure that other players can not send messages to another player
            if( !Server_CheckRemoteEntityWorldAssociatedWithThisIntellect( sender ) )
                return;

            GameControlKeys controlKey = (GameControlKeys)reader.ReadVariableUInt32();
            if( !reader.Complete() )
                return;

            //check for invalid value
            if( !Enum.IsDefined( typeof( GameControlKeys ), (int)controlKey ) )
                return;

            ControlKeyRelease( controlKey );
        }
Exemplo n.º 33
0
        void Server_ReceiveChangeMainControlledUnit( RemoteEntityWorld sender,
            ReceiveDataReader reader)
        {
            //not safe. client can send networkUIN of any unit from any place.

            //check to ensure that other players can not send messages to another player
            if( !Server_CheckRemoteEntityWorldAssociatedWithThisIntellect( sender ) )
                return;

            uint unitNetworkUIN = reader.ReadVariableUInt32();
            if( !reader.Complete() )
                return;

            Unit unit = Entities.Instance.GetByNetworkUIN( unitNetworkUIN ) as Unit;
            //unit is not exists
            if( unit == null )
                return;

            ServerOrSingle_ChangeMainControlledUnit( unit );
        }
Exemplo n.º 34
0
        private void Client_ReceiveHitCall(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            Vec3 hitPosition = reader.ReadVec3();
            string hitShapeBodyName = reader.ReadString();
            string hitShapeName = reader.ReadString();
            Vec3 hitNormal = reader.ReadVec3();
            MapObject hitMapObject = Entities.Instance.GetByNetworkUIN(reader.ReadVariableUInt32()) as MapObject;
            if (!reader.Complete())
                return;

            Position = hitPosition;
            Shape hitShape = null;
            if (PhysicsModel != null)
            {
                Body body = PhysicsModel.GetBody(hitShapeBodyName);
                if (body != null)
                    hitShape = body.GetShape(hitShapeName);
            }
            OnHit(hitShape, hitNormal, hitMapObject);
        }
Exemplo n.º 35
0
 void Client_ReceivePropertiesToClient( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     Size = reader.ReadVec2();
     Position = reader.ReadVec3();
     Segments = reader.ReadVec2i();
     RenderQueueGroup = (RenderQueueGroupID)reader.ReadVariableUInt32();
     ReflectionLevel = (ReflectionLevels)reader.ReadVariableUInt32();
     PhysicsHeight = reader.ReadSingle();
     DeepColor = reader.ReadColorValue();
     ShallowColor = reader.ReadColorValue();
     ReflectionColor = reader.ReadColorValue();
     ReflectionTextureSize = (ReflectionTextureSizes)reader.ReadVariableUInt32();
     FixedPipelineMap = reader.ReadString();
     FixedPipelineMapTiling = reader.ReadSingle();
     FixedPipelineColor = reader.ReadColorValue();
 }
Exemplo n.º 36
0
 void Client_ReceiveCreateSplash( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     WaterPlaneType.SplashTypes splashType = (WaterPlaneType.SplashTypes)reader.
         ReadVariableUInt32();
     Vec3 pos = reader.ReadVec3();
     if( !reader.Complete() )
         return;
     CreateSplash( splashType, pos );
 }
Exemplo n.º 37
0
 void Client_ReceiveGameType( RemoteEntityWorld sender, ReceiveDataReader reader )
 {
     GameTypes value = (GameTypes)reader.ReadVariableUInt32();
     if( !reader.Complete() )
         return;
     gameType = value;
 }
        private bool ReceiveMessage_AddUserToClient(NetworkNode.ConnectedNode sender,
            MessageType messageType, ReceiveDataReader reader, ref string additionalErrorMessage)
        {
            //get data from message
            uint identifier = reader.ReadVariableUInt32();
            string name = reader.ReadString();
            bool thisUserFlag = reader.ReadBoolean();
            if (!reader.Complete())
                return false;

            AddUser(identifier, name, thisUserFlag);

            return true;
        }
Exemplo n.º 39
0
        void Client_ReceiveBodiesPositions( RemoteEntityWorld sender, ReceiveDataReader reader )
        {
            //clear snapshots cache if entity is not created
            if( !IsPostCreated )
                client_receivePositionsSnapshots.Clear();

            //check for invalid snapshot cache
            if( client_receivePositionsSnapshots.Count != 0 )
            {
                Client_ReceivePositionsSnapshot lastSnapshot = client_receivePositionsSnapshots[
                    client_receivePositionsSnapshots.Count - 1 ];
                if( lastSnapshot.bodies == null )
                {
                    //remove snapshot cache
                    client_receivePositionsSnapshots.Clear();
                }
            }

            int count = (int)reader.ReadVariableUInt32();

            Client_ReceivePositionsSnapshot snapshot = new Client_ReceivePositionsSnapshot();
            snapshot.networkTickNumber = EntitySystemWorld.Instance.NetworkTickCounter;

            snapshot.bodies = new Client_ReceivePositionsSnapshot.BodyItem[ count ];

            //receive bodies positions and rotations
            for( int n = 0; n < count; n++ )
            {
                Client_ReceivePositionsSnapshot.BodyItem bodyItem = new
                    Client_ReceivePositionsSnapshot.BodyItem();

                //read position
                if( reader.ReadBoolean() )
                {
                    bodyItem.position = reader.ReadVec3();
                }
                else
                {
                    //get position from previous snapshot
                    if( client_receivePositionsSnapshots.Count != 0 )
                    {
                        bodyItem.position = client_receivePositionsSnapshots[
                            client_receivePositionsSnapshots.Count - 1 ].bodies[ n ].position;
                    }
                }

                //read rotation
                if( reader.ReadBoolean() )
                {
                    bodyItem.rotation = reader.ReadQuat( 16 );
                }
                else
                {
                    //get rotation from previous snapshot
                    if( client_receivePositionsSnapshots.Count != 0 )
                    {
                        bodyItem.rotation = client_receivePositionsSnapshots[
                            client_receivePositionsSnapshots.Count - 1 ].bodies[ n ].rotation;
                    }
                }

                snapshot.bodies[ n ] = bodyItem;
            }

            if( !reader.Complete() )
                return;

            client_receivePositionsSnapshots.Add( snapshot );

            if( IsPostCreated )
                Client_UpdatePositionsBySnapshots( false );
        }
Exemplo n.º 40
0
        void Client_ReceiveIntellect( RemoteEntityWorld sender, ReceiveDataReader reader )
        {
            uint networkUIN = reader.ReadVariableUInt32();
            bool shouldDeleteAfterDetach = reader.ReadBoolean();
            if( !reader.Complete() )
                return;

            Intellect i = null;
            if( networkUIN != 0 )
                i = (Intellect)Entities.Instance.GetByNetworkUIN( networkUIN );
            SetIntellect( i, shouldDeleteAfterDetach );
        }
Exemplo n.º 41
0
        void Client_ReceiveAddUser( RemoteEntityWorld sender, ReceiveDataReader reader )
        {
            uint identifier = reader.ReadVariableUInt32();
            string name = reader.ReadString();
            bool bot = reader.ReadBoolean();
            uint userIdentifier = reader.ReadVariableUInt32();

            if( !reader.Complete() )
                return;

            //check for already exists
            {
                Client_Player playerForCheck = Client_GetPlayer( identifier );

                if( playerForCheck != null )
                {
                    Log.Fatal( "PlayerManager: Client_ReceiveAddUserToClient: Player " +
                        "with identifier \"{0}\" is already exists.", identifier );
                }
            }

            UserManagementClientNetworkService.UserInfo user = null;
            if( userIdentifier != 0 )
                user = GameNetworkClient.Instance.UserManagementService.GetUser( userIdentifier );

            Client_Player player = new Client_Player( identifier, name, bot, user );
            client_players.Add( player );
        }
Exemplo n.º 42
0
        private void Client_ReceiveUpdateData(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            while (reader.BitPosition < reader.EndBitPosition)
            {
                uint identifier = reader.ReadVariableUInt32();
                int hitPoints = reader.ReadVariableInt32();
                int killPoints = reader.ReadVariableInt32();
                int assaultCredits = reader.ReadVariableInt32();
                float ping = reader.ReadSingle();

                Client_Player player = Client_GetPlayer(identifier);

                if (player != null)
                {
                    player.HitPoints = hitPoints;
                    player.KillPoints = killPoints;
                    player.AssaultCredits = assaultCredits;
                    player.Ping = ping;
                }
            }
        }
Exemplo n.º 43
0
        void Client_ReceiveRemoveUser( RemoteEntityWorld sender, ReceiveDataReader reader )
        {
            uint identifier = reader.ReadVariableUInt32();

            if( !reader.Complete() )
                return;

            Client_Player player = Client_GetPlayer( identifier );
            if( player == null )
                return;

            client_players.Remove( player );
        }
Exemplo n.º 44
0
        private void Client_ReceiveRemoveUser(RemoteEntityWorld sender, ReceiveDataReader reader)
        {
            uint identifier = reader.ReadVariableUInt32();

            if (!reader.Complete())
                return;

            Client_Player player = Client_GetPlayer(identifier);
            if (player == null)
                return;

            uint ui = GameNetworkClient.Instance.UserManagementService.ThisUser.Identifier;

            client_players.Remove(player);
        }