Example #1
0
        public void Handle_StartSpectating()
        {
            var logLine = "[Power] ================== Begin Spectating 1st player ==================";

            _game.Stub(x => x.IsInMenu).Return(true);
            _powerHandler.Handle(logLine, _gameState, _game);
            _gameHandler.AssertWasCalled(x => x.SetGameMode(GameMode.Spectator));
            _gameState.AssertWasCalled(x => x.FoundSpectatorStart = false);
        }
        private static void ProcessNewLines()
        {
            foreach (var item in ToProcess.Where(item => item.Value != null))
            {
                if (_stop)
                {
                    break;
                }
                foreach (var line in item.Value.Where(line => line != null))
                {
                    if (_stop)
                    {
                        break;
                    }
                    _game.GameTime.Time = line.Time;
                    switch (line.Namespace)
                    {
                    case "Power":
                        PowerLineHandler.Handle(line.Line, _gameState, _game);
                        OnPowerLogLine.Execute(line.Line);
                        break;

                    case "Asset":
                        AssetHandler.Handle(line.Line, _gameState, _game);
                        OnAssetLogLine.Execute(line.Line);
                        break;

                    case "Bob":
                        BobHandler.Handle(line.Line, _gameState, _game);
                        OnBobLogLine.Execute(line.Line);
                        break;

                    case "Rachelle":
                        RachelleHandler.Handle(line.Line, _gameState, _game);
                        OnRachelleLogLine.Execute(line.Line);
                        break;

                    case "Arena":
                        ArenaHandler.Handle(line.Line, _gameState, _game);
                        OnArenaLogLine.Execute(line.Line);
                        break;

                    case "LoadingScreen":
                        LoadingScreenHandler.Handle(line.Line, _gameState, _game);
                        break;

                    case "Net":
                        NetHandler.Handle(line.Line, _gameState, _game);
                        break;

                    case "FullScreenFX":
                        FullScreenFxHandler.Handle(line, _game);
                        break;
                    }
                }
            }
            ToProcess.Clear();
            Helper.UpdateEverything(_game);
        }
Example #3
0
        private void Analyze(string log)
        {
            var logLines = log.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);

            foreach (var rawLogLine in logLines)
            {
                var logLine = new string(rawLogLine.Skip(25).ToArray());
                _gameState.CurrentOffset += logLine.Length + 1;

                if (logLine.StartsWith("["))
                {
                    GameV2.AddHSLogLine(logLine);
                    API.LogEvents.OnLogLine.Execute(logLine);
                }

                if (logLine.StartsWith("[Power] GameState."))
                {
                    _powerGameStateLineHandler.Handle(logLine, _gameState, _game);
                }
                else if (logLine.StartsWith("[Power]"))
                {
                    _powerLineHandler.Handle(logLine, _gameState, _game);
                }
                else if (logLine.StartsWith("[Asset]"))
                {
                    _assetHandler.Handle(logLine, _gameState, _game);
                }
                else if (logLine.StartsWith("[Bob]"))
                {
                    _bobHandler.Handle(logLine, _gameState, _game);
                }
                else if (logLine.StartsWith("[Rachelle]"))
                {
                    _rachelleHandler.Handle(logLine, _gameState, _game);
                }
                else if (logLine.StartsWith("[Zone]"))
                {
                    _zoneHandler.Handle(logLine, _gameState);
                }
                else if (logLine.StartsWith("[Arena]"))
                {
                    _arenaHandler.Handle(logLine, _gameState, _game);
                }

                if (_gameState.First)
                {
                    break;
                }
            }
        }
Example #4
0
        private static void ProcessNewLines()
        {
            foreach (var item in ToProcess.Where(item => item.Value != null))
            {
                foreach (var line in item.Value.Where(line => line != null))
                {
                    _game.GameTime.Time = line.Time;
                    switch (line.Namespace)
                    {
                    case "Power":
                        GameV2.AddHSLogLine(line.Line);
                        PowerLineHandler.Handle(line.Line, _gameState, _game);
                        API.LogEvents.OnPowerLogLine.Execute(line.Line);
                        break;

                    case "Zone":
                        ZoneHandler.Handle(line.Line, _gameState);
                        API.LogEvents.OnZoneLogLine.Execute(line.Line);
                        break;

                    case "Asset":
                        AssetHandler.Handle(line.Line, _gameState, _game);
                        API.LogEvents.OnAssetLogLine.Execute(line.Line);
                        break;

                    case "Bob":
                        BobHandler.Handle(line.Line, _gameState, _game);
                        API.LogEvents.OnBobLogLine.Execute(line.Line);
                        break;

                    case "Rachelle":
                        RachelleHandler.Handle(line.Line, _gameState, _game);
                        API.LogEvents.OnRachelleLogLine.Execute(line.Line);
                        break;

                    case "Arena":
                        ArenaHandler.Handle(line.Line, _gameState, _game);
                        API.LogEvents.OnArenaLogLine.Execute(line.Line);
                        break;

                    case "LoadingScreen":
                        LoadingScreenHandler.Handle(line.Line, _gameState, _game);
                        break;
                    }
                }
            }
            ToProcess.Clear();
            Helper.UpdateEverything(_game);
        }
Example #5
0
        private void OnNewLines(List <LogLine> lines)
        {
            foreach (var line in lines)
            {
                if (_stop)
                {
                    break;
                }
                _game.GameTime.Time = line.Time;
                switch (line.Namespace)
                {
                case "Achievements":
                    OnAchievementsLogLine.Execute(line.Line);
                    break;

                case "Power":
                    if (line.LineContent.StartsWith("GameState."))
                    {
                        _game.PowerLog.Add(line.Line);
                    }
                    else
                    {
                        _powerLineHandler.Handle(line.Line, _gameState, _game);
                        OnPowerLogLine.Execute(line.Line);
                    }
                    break;

                case "Gameplay":
                    _rachelleHandler.Handle(line.Line, _gameState, _game);
                    OnGameplayLogLine.Execute(line.Line);
                    break;

                case "Arena":
                    _arenaHandler.Handle(line, _gameState, _game);
                    OnArenaLogLine.Execute(line.Line);
                    break;

                case "LoadingScreen":
                    _loadingScreenHandler.Handle(line, _gameState, _game);
                    break;

                case "FullScreenFX":
                    _fullScreenFxHandler.Handle(line, _game);
                    break;
                }
            }
            Helper.UpdateEverything(_game);
        }