예제 #1
0
        public static CharacterPositionClass Read(PacketHeader header, BinaryReader br)
        {
            CharacterPositionClass mtp = new CharacterPositionClass();

            mtp.CellIndex = br.ReadUInt32();
            return(mtp);
        }
예제 #2
0
 private void Client_OnUpdatePosition(object sender, CharacterPositionClass e)
 {
     TaskProcessor.AddTask(new Task(Task.TaskType.PlayerUpdatePosition, (Connection)sender, e));
 }
예제 #3
0
 public void UpdatePlayerPosition(Connection client, CharacterPositionClass cpc)
 {
     _maps[client.Character.MapID].UpdatePlayerPosition(client, cpc);
 }
예제 #4
0
 public void ProcessMoveRequest(Connection client, CharacterPositionClass mtp)
 {
     _maps[client.Character.MapID].ProcessMoveRequest(client, mtp);
 }
예제 #5
0
 public static CharacterPositionClass Read(PacketHeader header, BinaryReader br)
 {
     CharacterPositionClass mtp = new CharacterPositionClass();
     mtp.CellIndex = br.ReadUInt32();
     return mtp;
 }
예제 #6
0
        public void UpdatePlayerPosition(Connection client, CharacterPositionClass cpc)
        {
            client.Character.CellIndex = cpc.CellIndex;

            // Inform other clients
            ObserveMovementPacket omp = new ObserveMovementPacket(client.Character.WorldID, cpc.CellIndex, client.Character.MoveSpeed);
            foreach (Connection c in _players.Values)
            {
                if (c.AccountID != client.AccountID)
                {
                    // Send move update
                    c.SendPacket(omp);
                }
            }
        }
예제 #7
0
        public void ProcessMoveRequest(Connection client, CharacterPositionClass mtp)
        {
            // Check to see if we hit any npcs
            foreach (NPC npc in _npcs.Values)
            {
                if (npc.CellIndex == mtp.CellIndex)
                {
                    // Hit this npc - Check distance
                    Vector target = Utils.DecodeCellIndex(_mapID, mtp.CellIndex);
                    Vector start = Utils.DecodeCellIndex(_mapID, client.Character.CellIndex);
                    Vector toTarget = target - start;
                    double distSquared = toTarget.LengthSquared;
                    if (distSquared > 13)
                    {
                        // Out of range, just move there
                        client.SendPacket(new PlayerMovePacket(mtp.CellIndex, client.Character.MoveSpeed));
                    }
                    else
                    {
                        // Talk to NPC
                        npc.DoDialog(client);
                    }

                    // no matter what, we are done here
                    return;
                }
            }

            // Check to see if we hit monsters

            // Check to see if we hit other players

            // Just move
            client.SendPacket(new PlayerMovePacket(mtp.CellIndex, client.Character.MoveSpeed));
        }
예제 #8
0
 void UpdatePosition_Handler(PacketHeader header, BinaryReader br)
 {
     OnUpdatePosition(this, CharacterPositionClass.Read(header, br));
 }
예제 #9
0
 void MoveTo_Handler(PacketHeader header, BinaryReader br)
 {
     OnMoveTo(this, CharacterPositionClass.Read(header, br));
 }
예제 #10
0
 public void UpdatePlayerPosition(Connection client, CharacterPositionClass cpc)
 {
     _maps[client.Character.MapID].UpdatePlayerPosition(client, cpc);
 }
예제 #11
0
 public void ProcessMoveRequest(Connection client, CharacterPositionClass mtp)
 {
     _maps[client.Character.MapID].ProcessMoveRequest(client, mtp);
 }
예제 #12
0
 private void Client_OnUpdatePosition(object sender, CharacterPositionClass e)
 {
     TaskProcessor.AddTask(new Task(Task.TaskType.PlayerUpdatePosition, (Connection)sender, e));
 }