Exemplo n.º 1
0
        public static void HandlePingTime(ClientConnection Client, byte last)
        {
            Account User        = Client.CurrentAccount;
            long    CurrentTime = Utility.CurrentTimeMilliseconds();

            Client.SendAsync(new PingTime_0X41(CurrentTime, last));
            if (User.isLogin && CurrentTime > User.LastCheckTime + 60000) //60s
            {
                User.LastCheckTime = CurrentTime;
                var expireitem = User.AvatarItems.Where(w => w.Value.expireTime != 0 && w.Value.expireTime < CurrentTime).ToDictionary(d => d.Key, d => d.Value);
                if (expireitem.Count > 0)
                {
                    foreach (var item in expireitem)
                    {
                        ItemHolder.ItemShopInfos.TryGetValue(item.Key, out var info);
                        if (!info.NotDeleteWhenExpired)
                        {
                            User.AvatarItems.TryRemove(item.Key, out _);
                        }
                    }
                    MyRoomHandle.getActiveFuncItem(User);
                    Client.SendAsync(new ExpiredItemInfo(expireitem.Values.FirstOrDefault(), last));
                }
            }
        }