protected override void OnHandle(IPacket packet, NetState netState, ServerWorldState worldState)
        {
            MoveToPacket    packetToHandle  = (MoveToPacket)packet;
            ServerCharacter serverCharacter = (ServerCharacter)worldState.GetCharacter(netState.WorldId);

            if (serverCharacter != null)
            {
                serverCharacter.SetMoveToPosition(new Point(packetToHandle.X, packetToHandle.Y));
                worldState.SendStatChangeToMapCharacters(serverCharacter);
            }
        }
示例#2
0
        private void ServerCharacter_MoveToChanged(object sender, EventArgs e)
        {
            ServerCharacter character = (ServerCharacter)sender;
            MoveToPacket    packet    = new MoveToPacket(character.Id, character.MovingToPosition);

            foreach (ushort mapCharacterId in maptoCharacterRelations[character.CurrentMapId])
            {
                ServerCharacter characterToUpdate = ((ServerCharacter)characters[mapCharacterId]);
                NetState        clientSendTo      = characterToUpdate.Owner;

                clientSendTo.Send(packet);
            }
        }
        protected override void OnHandle(IPacket packet, ClientWorldState worldState)
        {
            MoveToPacket    incomingPacket = (MoveToPacket)packet;
            ClientCharacter mobileToUpdate = (ClientCharacter)worldState.GetCharacter(incomingPacket.MobileId);

            if (mobileToUpdate == null)
            {
                worldState.MissingCharacters.Add(incomingPacket.MobileId);
                return;
            }

            mobileToUpdate.ServerMoveToRecived(new Point(incomingPacket.X, incomingPacket.Y));
        }
示例#4
0
 internal void MoveTo(int characterId, Point moveToPoint)
 {
     moveToPacket = new MoveToPacket(characterId, moveToPoint); //Packets are sent on Update to reduce Spam
 }