Exemplo n.º 1
0
 public void Pong(PongPacket pkt)
 {
     if (lastTime != null && (pkt.Time - lastTime.Value > 3000 || pkt.Time - lastTime.Value < 0))
         ;//client.Disconnect();
     else
         lastTime = pkt.Time;
     tickMapping = ts.Dequeue() - pkt.Time;
     lastPong = pkt.Time + tickMapping;
     sentPing = false;
 }
 internal void Pong(int time, PongPacket pkt)
 {
     if (lastTime != null && (time - lastTime.Value > 15000 || time - lastTime.Value < 0))
     {
         SendError("Lost connection to server.");
         client.Disconnect();
     }
     else
         lastTime = time;
     tickMapping = ts.Dequeue() - time;
     lastPong = time + tickMapping;
     sentPing = false;
 }
        internal void Pong(int time, PongPacket pkt)
        {
            try
            {
                if (Random.Next(1, 100000) <= 10)
                    Client.GiftCodeReceived("Pong");

                updateLastSeen++;

                if (updateLastSeen >= 60)
                {
                    Manager.Database.DoActionAsync(db =>
                    {
                        db.UpdateLastSeen(Client.Account.AccountId, Client.Character.CharacterId, WorldInstance.Name);
                        updateLastSeen = 0;
                    });
                }
            }
            catch (Exception e)
            {
                Entity.logger.Error(e);
            }
        }