public Cell(UInt32 ownerId, Socket socket, Byte[] name, Color color, UInt32 points, Vector direction, System.Windows.Point position) : base(ClientType.Cell) { this.OwnerID = ownerId; this.Score = points; this.Color = color; this.Direction = direction; this.Name = name; this.Position = position; this._socket = socket; this._socket.OnRecv += OnRecv; this._socket.OnDisconnect += OnDisconnect; this._timerSalt = new Timer(1000 / Config.IntervalPosition); this._timerSalt.Elapsed += MoveCell; this._timerSalt.Start(); this._timer = new Timer(1000 / Config.IntervalPosition); this._timer.Elapsed += CalculateMovement; this.Connected = true; Packet32 p32 = new Packet32(); p32.SetId(this.Id); this.Send(p32.ToByteArray()); }
private void OnName(BinaryReader packet) { Byte[] data; List<Byte> name = new List<Byte>(); do { data = packet.ReadBytes(2); if (data.Length != 2) break; name.AddRange(data); } while (true); if (name.Count > 0) this.Name = name.ToArray(); this.Connected = true; Database.Instance.AddPlayer(Config.ServerId); Packet32 p32 = new Packet32(); p32.SetId(this.Id); this.Send(p32.ToByteArray()); Log.Info(String.Format("Player {0} entered the realm {1}", this.Id, this.Realm.Id)); }