Ejemplo n.º 1
0
        public void ProcessRoom()
        {
            if (isCrashed || mDisposed)
            {
                return;
            }

            try
            {
                if (RoleplayManager.UnloadRoomsAutomatically && this.GetRoomUserManager().GetRoomUsers().Count == 0 && this.GetRoomUserManager().GetBotList().ToList().Count == 0)
                {
                    this.IdleTime++;
                }
                else if (this.IdleTime > 0)
                {
                    this.IdleTime = 0;
                }

                if (this.RoomData.HasActivePromotion && this.RoomData.Promotion.HasExpired)
                {
                    this.RoomData.EndPromotion();
                }

                if (this.IdleTime >= 60 && !this.RoomData.HasActivePromotion)
                {
                    PlusEnvironment.GetGame().GetRoomManager().UnloadRoom(this);
                    return;
                }

                try { GetRoomItemHandler().OnCycle(); }
                catch (Exception e)
                {
                    Logging.LogException("[Quarto ID: " + RoomId + "] está atualmente tendo problemas ao andar nos itens da sala." + e.ToString());
                }

                try { GetRoomUserManager().OnCycle(); }
                catch (Exception e)
                {
                    Logging.LogException("[Quarto ID: " + RoomId + "] está atualmente tendo problemas ao andar na sala." + e.ToString());
                }

                #region Status Updates
                try
                {
                    GetRoomUserManager().SerializeStatusUpdates();
                }
                catch (Exception e)
                {
                    Logging.LogException("[Quarto ID: " + RoomId + "] está atualmente tendo problemas para salvar os status dos usuários da sala." + e.ToString());
                }
                #endregion

                #region Game Item Cycle
                try
                {
                    if (_gameItemHandler != null)
                    {
                        _gameItemHandler.OnCycle();
                    }
                }
                catch (Exception e)
                {
                    Logging.LogException("[Quarto ID: " + RoomId + "] está atualmente tendo problemas para funcionar os itens do jogo." + e.ToString());
                }
                #endregion

                try { GetWired().OnCycle(); }
                catch (Exception e)
                {
                    Logging.LogException("[Quarto ID: " + RoomId + "] está atualmente com problemas nos Wireds." + e.ToString());
                }
            }
            catch (Exception e)
            {
                Logging.WriteLine("[Quarto ID: " + RoomId + "] travou.");
                Logging.LogException("[Quarto ID: " + RoomId + "] travou." + e.ToString());
                OnRoomCrash(e);
            }
        }
Ejemplo n.º 2
0
        public void ProcessRoom()
        {
            if (isCrashed || mDisposed)
            {
                return;
            }

            try
            {
                if (GetRoomUserManager().GetRoomUsers().Count == 0)
                {
                    IdleTime++;
                }
                else if (IdleTime > 0)
                {
                    IdleTime = 0;
                }

                if (HasActivePromotion && Promotion.HasExpired)
                {
                    EndPromotion();
                }

                if (IdleTime >= 60 && !HasActivePromotion)
                {
                    PlusEnvironment.GetGame().GetRoomManager().UnloadRoom(Id);
                    return;
                }

                try { GetRoomItemHandler().OnCycle(); }
                catch (Exception e)
                {
                    ExceptionLogger.LogException(e);
                }

                try { GetRoomUserManager().OnCycle(); }
                catch (Exception e)
                {
                    ExceptionLogger.LogException(e);
                }

                #region Status Updates
                try
                {
                    GetRoomUserManager().SerializeStatusUpdates();
                }
                catch (Exception e)
                {
                    ExceptionLogger.LogException(e);
                }
                #endregion

                #region Game Item Cycle
                try
                {
                    if (_gameItemHandler != null)
                    {
                        _gameItemHandler.OnCycle();
                    }
                }
                catch (Exception e)
                {
                    ExceptionLogger.LogException(e);
                }
                #endregion

                try { GetWired().OnCycle(); }
                catch (Exception e)
                {
                    ExceptionLogger.LogException(e);
                }
            }
            catch (Exception e)
            {
                ExceptionLogger.LogException(e);
                OnRoomCrash(e);
            }
        }
Ejemplo n.º 3
0
        public void ProcessRoom()
        {
            if (isCrashed || mDisposed)
            {
                return;
            }

            try
            {
                if (this.GetRoomUserManager().GetRoomUsers().Count == 0)
                {
                    this.IdleTime++;
                }
                else if (this.IdleTime > 0)
                {
                    this.IdleTime = 0;
                }

                if (this.RoomData.HasActivePromotion && this.RoomData.Promotion.HasExpired)
                {
                    this.RoomData.EndPromotion();
                }

                if (this.IdleTime >= 60 && !this.RoomData.HasActivePromotion)
                {
                    PlusEnvironment.GetGame().GetRoomManager().UnloadRoom(this);
                    return;
                }

                try { GetRoomItemHandler().OnCycle(); }
                catch (Exception e)
                {
                    Logging.LogException("Room ID [" + RoomId + "] is currently having issues cycling the room items." + e.ToString());
                }

                try { GetRoomUserManager().OnCycle(); }
                catch (Exception e)
                {
                    Logging.LogException("Room ID [" + RoomId + "] is currently having issues cycling the room users." + e.ToString());
                }

                #region Status Updates
                try
                {
                    GetRoomUserManager().SerializeStatusUpdates();
                }
                catch (Exception e)
                {
                    Logging.LogException("Room ID [" + RoomId + "] is currently having issues cycling the room user statuses." + e.ToString());
                }
                #endregion

                #region Game Item Cycle
                try
                {
                    if (_gameItemHandler != null)
                    {
                        _gameItemHandler.OnCycle();
                    }
                }
                catch (Exception e)
                {
                    Logging.LogException("Room ID [" + RoomId + "] is currently having issues cycling the game items." + e.ToString());
                }
                #endregion

                try { GetWired().OnCycle(); }
                catch (Exception e)
                {
                    Logging.LogException("Room ID [" + RoomId + "] is currently having issues cycling wired." + e.ToString());
                }
            }
            catch (Exception e)
            {
                Logging.WriteLine("Room ID [" + RoomId + "] has crashed.");
                Logging.LogException("Room ID [" + RoomId + "] has crashed." + e.ToString());
                OnRoomCrash(e);
            }
        }