Example #1
0
        public OverwatchModel(DeviceManager deviceManager, LuaManager luaManager, PipeServer pipeServer,
                              MetroDialogService dialogService, DebugViewModel debugViewModel) : base(deviceManager, luaManager)
        {
            _pipeServer     = pipeServer;
            _dialogService  = dialogService;
            _debugViewModel = debugViewModel;

            Settings  = SettingsProvider.Load <OverwatchSettings>();
            DataModel = new OverwatchDataModel();
            ProcessNames.Add("Overwatch");

            LoadOverwatchCharacters();
            FindOverwatch();
        }
Example #2
0
        private void ParseSpecialKeys(OverwatchDataModel gameDataModel, CharacterColor?characterMatch, Color[,] colors)
        {
            if (characterMatch == null || characterMatch.Value.Character == OverwatchCharacter.None)
            {
                return;
            }

            // Ultimate is ready when Q is blinking
            var charCol      = characterMatch.Value.Color;
            var backlidColor = Color.FromRgb((byte)(charCol.R * 0.25), (byte)(charCol.G * 0.25),
                                             (byte)(charCol.B * 0.25));
            var ultReady = !backlidColor.Equals(colors[2, 2]);

            if (_ultimateUsed.AddSeconds(15) <= DateTime.Now)
            {
                // Player can change hero if H is blinking
                gameDataModel.CanChangeHero = !colors[3, 7].Equals(backlidColor);

                if (!_stickyUltimateReady.Value && ultReady && ControlsShown(colors))
                {
                    _ultimateReady             = DateTime.Now;
                    _stickyUltimateReady.Value = true;
                }
            }

            // If ult no longer ready but it was ready before, it was used.
            if (_stickyUltimateReady.Value && !ultReady)
            {
                _stickyUltimateReady.Value = false;
                if (_ultimateUsed.AddSeconds(15) <= DateTime.Now)
                {
                    _ultimateUsed = DateTime.Now;
                }
            }

            // UltimateUsed is true for 10 seconds after ultimate went on cooldown
            if (_ultimateUsed != DateTime.MinValue)
            {
                _stickyUltimateUsed.Value = _ultimateUsed.AddSeconds(10) >= DateTime.Now;
            }
        }
Example #3
0
        private CharacterColor?ParseCharacter(OverwatchDataModel gameDataModel, Color[,] colors)
        {
            var characterMatch = OverwatchCharacters.FirstOrDefault(c => c.Color == colors[0, 20]);

            // If a new character was chosen, let the other methods know
            if (characterMatch.Character != gameDataModel.Character)
            {
                _characterChange = DateTime.Now;
            }

            // If no character was found, this method shouldn't continue
            if (characterMatch.Character == OverwatchCharacter.None)
            {
                return(characterMatch);
            }

            // If WASD isn't orange (any of them will do), player is in character select
            _stickyStatus.Value = ControlsShown(colors) ? OverwatchStatus.InGame : OverwatchStatus.InCharacterSelect;

            // Update the datamodel
            gameDataModel.Character = characterMatch.Character;
            return(characterMatch);
        }
Example #4
0
        private void ParseGameSate(OverwatchDataModel gameDataModel, Color[,] colors)
        {
            if (_ultimateUsed.AddSeconds(5) >= DateTime.Now)
            {
                return;
            }

            if (colors[0, 0].Equals(Color.FromRgb(55, 30, 0)))
            {
                _stickyStatus.Value = OverwatchStatus.InMainMenu;
            }

            if (_stickyStatus.Value != OverwatchStatus.InMainMenu)
            {
                return;
            }

            gameDataModel.Character     = OverwatchCharacter.None;
            gameDataModel.Ability1Ready = false;
            gameDataModel.Ability2Ready = false;
            _stickyUltimateReady.Value  = false;
            _stickyUltimateUsed.Value   = false;
        }
Example #5
0
 private void ParseAbilities(OverwatchDataModel gameDataModel, Color[,] colors)
 {
     gameDataModel.Ability1Ready = colors[4, 1].Equals(Color.FromRgb(4, 141, 144));
     gameDataModel.Ability2Ready = colors[2, 4].Equals(Color.FromRgb(4, 141, 144));
 }
Example #6
0
 private void ParseAbilities(OverwatchDataModel gameDataModel, Color[,] colors)
 {
     gameDataModel.Ability1Ready = colors[4, 1].Equals(Color.FromRgb(4, 141, 144));
     gameDataModel.Ability2Ready = colors[2, 4].Equals(Color.FromRgb(4, 141, 144));
 }
Example #7
0
        private void ParseSpecialKeys(OverwatchDataModel gameDataModel, CharacterColor? characterMatch, Color[,] colors)
        {
            if ((characterMatch == null) || (characterMatch.Value.Character == OverwatchCharacter.None))
                return;

            // Ultimate is ready when Q is blinking
            var charCol = characterMatch.Value.Color;
            var backlidColor = Color.FromRgb((byte) (charCol.R*0.25), (byte) (charCol.G*0.25), (byte) (charCol.B*0.25));
            var ultReady = !backlidColor.Equals(colors[2, 2]);

            if (_ultimateUsed.AddSeconds(15) <= DateTime.Now)
            {
                // Player can change hero if H is blinking
                gameDataModel.CanChangeHero = !colors[3, 7].Equals(backlidColor);

                if (!_stickyUltimateReady.Value && ultReady && ControlsShown(colors))
                {
                    _ultimateReady = DateTime.Now;
                    _stickyUltimateReady.Value = true;
                }
            }

            // If ult no longer ready but it was ready before, it was used.
            if (_stickyUltimateReady.Value && !ultReady)
            {
                _stickyUltimateReady.Value = false;
                if (_ultimateUsed.AddSeconds(15) <= DateTime.Now)
                    _ultimateUsed = DateTime.Now;
            }

            // UltimateUsed is true for 10 seconds after ultimate went on cooldown
            if (_ultimateUsed != DateTime.MinValue)
                _stickyUltimateUsed.Value = _ultimateUsed.AddSeconds(10) >= DateTime.Now;
        }
Example #8
0
        private CharacterColor? ParseCharacter(OverwatchDataModel gameDataModel, Color[,] colors)
        {
            var characterMatch = OverwatchCharacters.FirstOrDefault(c => c.Color == colors[0, 20]);
            // If a new character was chosen, let the other methods know
            if (characterMatch.Character != gameDataModel.Character)
                _characterChange = DateTime.Now;

            // If no character was found, this method shouldn't continue
            if (characterMatch.Character == OverwatchCharacter.None)
                return characterMatch;

            // If WASD isn't orange (any of them will do), player is in character select
            _stickyStatus.Value = ControlsShown(colors) ? OverwatchStatus.InGame : OverwatchStatus.InCharacterSelect;

            // Update the datamodel
            gameDataModel.Character = characterMatch.Character;
            return characterMatch;
        }
Example #9
0
        private void ParseGameSate(OverwatchDataModel gameDataModel, Color[,] colors)
        {
            if (_ultimateUsed.AddSeconds(5) >= DateTime.Now)
                return;

            if (colors[0, 0].Equals(Color.FromRgb(55, 30, 0)))
                _stickyStatus.Value = OverwatchStatus.InMainMenu;

            if (_stickyStatus.Value != OverwatchStatus.InMainMenu)
                return;

            gameDataModel.Character = OverwatchCharacter.None;
            gameDataModel.Ability1Ready = false;
            gameDataModel.Ability2Ready = false;
            _stickyUltimateReady.Value = false;
            _stickyUltimateUsed.Value = false;
        }