Exemple #1
0
        public override sealed void UpdateLights(EffectFrame frame)
        {
            UpdateWrapperLights(frame);

            Queue <EffectLayer> layers = new Queue <EffectLayer>();

            if (this.Profile != null)
            {
                foreach (var layer in this.Profile.Settings.Layers.Reverse().ToArray())
                {
                    if (layer.Enabled && layer.LogicPass)
                    {
                        layers.Enqueue(layer.Render(_game_state));
                    }
                }

                //No need to repeat the code around this everytime this is inherited
                this.UpdateExtraLights(layers);

                //Scripts
                this.Profile.UpdateEffectScripts(layers, _game_state);
            }

            frame.AddLayers(layers.ToArray());
        }
        public override void UpdateLights(EffectFrame frame)
        {
            Queue <EffectLayer> layers = new Queue <EffectLayer>();

            DishonoredProfile settings = (DishonoredProfile)this.Application.Profile;

            Process[] process_search = Process.GetProcessesByName("Dishonored");

            if (process_search.Length != 0)
            {
                using (MemoryReader memread = new MemoryReader(process_search[0]))
                {
                    (_game_state as GameState_Dishonored).Player.MaximumHealth = memread.ReadInt(pointers.MaximumHealth.baseAddress, pointers.MaximumHealth.pointers);
                    (_game_state as GameState_Dishonored).Player.CurrentHealth = memread.ReadInt(pointers.CurrentHealth.baseAddress, pointers.CurrentHealth.pointers);
                    (_game_state as GameState_Dishonored).Player.MaximumMana   = memread.ReadInt(pointers.MaximumMana.baseAddress, pointers.MaximumMana.pointers);
                    (_game_state as GameState_Dishonored).Player.CurrentMana   = memread.ReadInt(pointers.CurrentMana.baseAddress, pointers.CurrentMana.pointers);
                    (_game_state as GameState_Dishonored).Player.ManaPots      = memread.ReadInt(pointers.ManaPots.baseAddress, pointers.ManaPots.pointers);
                    (_game_state as GameState_Dishonored).Player.HealthPots    = memread.ReadInt(pointers.HealthPots.baseAddress, pointers.HealthPots.pointers);
                }
            }

            foreach (var layer in this.Application.Profile.Layers.Reverse().ToArray())
            {
                if (layer.Enabled && layer.LogicPass)
                {
                    layers.Enqueue(layer.Render(_game_state));
                }
            }

            //Scripts
            this.Application.UpdateEffectScripts(layers);

            frame.AddLayers(layers.ToArray());
        }
Exemple #3
0
        public override void UpdateLights(EffectFrame frame)
        {
            Queue <EffectLayer> layers = new Queue <EffectLayer>();

            TERSettings settings = (TERSettings)this.Profile.Settings;

            foreach (var layer in settings.Layers.Reverse().ToArray())
            {
                if (layer.Enabled && layer.LogicPass)
                {
                    layers.Enqueue(layer.Render(_game_state));
                }
            }

            //Scripts
            this.Profile.UpdateEffectScripts(layers, _game_state);

            //ColorZones
            layers.Enqueue(new EffectLayer("TER - Color Zones").DrawColorZones((this.Profile.Settings as TERSettings).lighting_areas.ToArray()));

            frame.AddLayers(layers.ToArray());

            System.Diagnostics.Debug.WriteLine("\n=======================================");
            System.Diagnostics.Debug.WriteLine("UpdateLights() - 1");
            System.Diagnostics.Debug.WriteLine("=======================================\n");
        }
Exemple #4
0
        public override void UpdateLights(EffectFrame frame)
        {
            Queue <EffectLayer> layers = new Queue <EffectLayer>();

            PD2Settings settings = (PD2Settings)this.Profile.Settings;

            foreach (var layer in settings.Layers.Reverse().ToArray())
            {
                if (layer.Enabled && layer.LogicPass)
                {
                    layers.Enqueue(layer.Render(_game_state));
                }
            }

            //Scripts
            this.Profile.UpdateEffectScripts(layers, _game_state);

            //ColorZones
            layers.Enqueue(new EffectLayer("PD2 - Color Zones").DrawColorZones((this.Profile.Settings as PD2Settings).lighting_areas.ToArray()));

            frame.AddLayers(layers.ToArray());

            System.Diagnostics.Debug.WriteLine("PD2 -- UpdateLights() - 1");

            StackTrace stackTrace = new StackTrace();

            System.Diagnostics.Debug.WriteLine(stackTrace.GetFrame(1).GetMethod().Name);
        }
        public override void UpdateLights(EffectFrame frame)
        {
            Queue <EffectLayer> layers = new Queue <EffectLayer>();

            GenericApplicationSettings settings = (GenericApplicationSettings)this.Profile.Settings;

            ObservableCollection <Layer> timeLayers = settings.Layers;

            //Scripts
            this.Profile.UpdateEffectScripts(layers);

            if (HasProfile())
            {
                if ((Global.Configuration.nighttime_enabled &&
                     Utils.Time.IsCurrentTimeBetween(Global.Configuration.nighttime_start_hour, Global.Configuration.nighttime_start_minute, Global.Configuration.nighttime_end_hour, Global.Configuration.nighttime_end_minute)) ||
                    settings._simulateNighttime
                    )
                {
                    timeLayers = settings.Layers_NightTime;
                }
            }

            foreach (var layer in timeLayers.Reverse().ToArray())
            {
                if (layer.Enabled && layer.LogicPass)
                {
                    layers.Enqueue(layer.Render(_game_state));
                }
            }

            frame.AddLayers(layers.ToArray());
        }
        public override void UpdateLights(EffectFrame frame)
        {
            Queue <EffectLayer> layers = new Queue <EffectLayer>();

            GenericApplicationProfile settings = (GenericApplicationProfile)this.Application.Profile;

            ObservableCollection <Layer> timeLayers = settings.Layers;

            //Scripts
            //this.Application.UpdateEffectScripts(layers);

            if ((Global.Configuration.NighttimeEnabled &&
                 Utils.Time.IsCurrentTimeBetween(Global.Configuration.NighttimeStartHour, Global.Configuration.NighttimeStartMinute, Global.Configuration.NighttimeEndHour, Global.Configuration.NighttimeEndMinute)) ||
                settings._simulateNighttime
                )
            {
                timeLayers = settings.Layers_NightTime;
            }

            foreach (var layer in timeLayers.Reverse().ToArray())
            {
                if (layer.Enabled)
                {
                    layers.Enqueue(layer.Render(_game_state));
                }
            }

            frame.AddLayers(layers.ToArray());
        }
        public override void UpdateLights(EffectFrame frame)
        {
            Queue <EffectLayer> layers = new Queue <EffectLayer>();

            Borderlands2Profile settings = (Borderlands2Profile)this.Application.Profile;

            Process[] process_search = Process.GetProcessesByName("Borderlands2");

            if (process_search.Length != 0)
            {
                using (MemoryReader memread = new MemoryReader(process_search[0]))
                {
                    (_game_state as GameState_Borderlands2).Player.MaximumHealth = memread.ReadFloat(pointers.Health_maximum.baseAddress, pointers.Health_maximum.pointers);
                    (_game_state as GameState_Borderlands2).Player.CurrentHealth = memread.ReadFloat(pointers.Health_current.baseAddress, pointers.Health_current.pointers);
                    (_game_state as GameState_Borderlands2).Player.MaximumShield = memread.ReadFloat(pointers.Shield_maximum.baseAddress, pointers.Shield_maximum.pointers);
                    (_game_state as GameState_Borderlands2).Player.CurrentShield = memread.ReadFloat(pointers.Shield_current.baseAddress, pointers.Shield_current.pointers);
                }
            }

            foreach (var layer in this.Application.Profile.Layers.Reverse().ToArray())
            {
                if (layer.Enabled && layer.LogicPass)
                {
                    layers.Enqueue(layer.Render(_game_state));
                }
            }

            //Scripts
            this.Application.UpdateEffectScripts(layers);

            frame.AddLayers(layers.ToArray());
        }
Exemple #8
0
        public override void UpdateLights(EffectFrame frame)
        {
            Queue <EffectLayer> layers = new Queue <EffectLayer>();

            foreach (var layer in this.Application.Profile.Layers.Reverse().ToArray())
            {
                if (layer.Enabled && layer.LogicPass)
                {
                    layers.Enqueue(layer.Render(_game_state));
                }
            }

            layers.Enqueue(new EffectLayer("Color Zones").DrawColorZones((this.Application.Profile as DesktopProfile).lighting_areas.ToArray()));

            //Scripts before interactive and shortcut assistant layers
            //ProfilesManager.DesktopProfile.UpdateEffectScripts(layers);

            if (Global.Configuration.time_based_dimming_enabled)
            {
                if (
                    Utils.Time.IsCurrentTimeBetween(Global.Configuration.time_based_dimming_start_hour, Global.Configuration.time_based_dimming_end_hour)
                    )
                {
                    layers.Clear();

                    EffectLayer time_based_dim_layer = new EffectLayer("Time Based Dim");
                    time_based_dim_layer.Fill(Color.Black);

                    layers.Enqueue(time_based_dim_layer);
                }
            }

            frame.AddLayers(layers.ToArray());
        }
Exemple #9
0
        /// <summary>
        /// Adds new layers to the passed EffectFrame instance based on GameState information.
        /// </summary>
        /// <param name="frame">EffectFrame instance to which layers will be added</param>
        public virtual void UpdateLights(EffectFrame frame)
        {
            UpdateTick();

            var layers = new Queue <EffectLayer>(Application.Profile.Layers.Where(l => l.Enabled).Reverse().Select(l => l.Render(_game_state)));

            Application.UpdateEffectScripts(layers);
            frame.AddLayers(layers.ToArray());
        }
        public override void UpdateLights(EffectFrame frame)
        {
            Queue <EffectLayer> layers = new Queue <EffectLayer>();

            EffectLayer bitmap_layer = new EffectLayer("Overwatch - Bitmap");

            Devices.DeviceKeys[] allkeys = Enum.GetValues(typeof(Devices.DeviceKeys)).Cast <Devices.DeviceKeys>().ToArray();
            foreach (var key in allkeys)
            {
                if (key == Devices.DeviceKeys.LOGO && logo.Length == 4)
                {
                    int a, r, g, b;

                    b = logo[0];
                    g = logo[1];
                    r = logo[2];
                    a = logo[3];

                    bitmap_layer.Set(key, GetBoostedColor(Color.FromArgb(a, r, g, b)));
                }
                else if (key == Devices.DeviceKeys.Peripheral && peripheral.Length == 4)
                {
                    int a, r, g, b;

                    b = peripheral[0];
                    g = peripheral[1];
                    r = peripheral[2];
                    a = peripheral[3];

                    bitmap_layer.Set(key, GetBoostedColor(Color.FromArgb(a, r, g, b)));
                }
                else
                {
                    Devices.Logitech.Logitech_keyboardBitmapKeys logi_key = Devices.Logitech.LogitechDevice.ToLogitechBitmap(key);

                    if (logi_key != Devices.Logitech.Logitech_keyboardBitmapKeys.UNKNOWN)
                    {
                        int a, r, g, b;

                        b = bitmap[(int)logi_key];
                        g = bitmap[(int)logi_key + 1];
                        r = bitmap[(int)logi_key + 2];
                        a = bitmap[(int)logi_key + 3];

                        bitmap_layer.Set(key, GetBoostedColor(Color.FromArgb(a, r, g, b)));
                    }
                }
            }

            layers.Enqueue(bitmap_layer);

            //Scripts
            Global.Configuration.ApplicationProfiles[profilename].UpdateEffectScripts(layers, _game_state);

            frame.AddLayers(layers.ToArray());
        }
        public override void UpdateLights(EffectFrame frame)
        {
            UpdateWrapperLights(frame);

            Queue <EffectLayer> layers = new Queue <EffectLayer>();

            //Scripts
            if (!String.IsNullOrWhiteSpace(profilename))
            {
                Global.Configuration.ApplicationProfiles[profilename].UpdateEffectScripts(layers, _game_state);
            }

            frame.AddLayers(layers.ToArray());
        }
Exemple #12
0
        public override void UpdateLights(EffectFrame frame)
        {
            Queue <EffectLayer> layers   = new Queue <EffectLayer>();
            ApplicationProfile  settings = this.Application.Profile;

            foreach (var layer in Application.Profile.Layers.Reverse())
            {
                if (layer.Enabled && layer.LogicPass)
                {
                    layers.Enqueue(layer.Render(_game_state));
                }
            }

            frame.AddLayers(layers.ToArray());
        }
Exemple #13
0
        public override void UpdateLights(EffectFrame frame)
        {
            Queue <EffectLayer> layers = new Queue <EffectLayer>();

            if (File.Exists(configFile))
            {
                if (configContent != null && isGameStateDirty)
                {
                    try
                    {
                        var data = GetUsefulData(configContent);
                        if (data != null)//if this is null, no useful data was found
                        {
                            var player = (_game_state as GameState_Witcher3).Player;

                            player.Toxicity      = GetInt(data, "Toxicity");
                            player.Stamina       = GetInt(data, "Stamina");
                            player.MaximumHealth = GetInt(data, "MaxHealth");
                            player.CurrentHealth = GetInt(data, "CurrHealth");
                            if (Enum.TryParse(data.FirstOrDefault(d => d.Contains("ActiveSign")).Split('=').Last().Replace("ST_", ""), out WitcherSign sign))
                            {
                                ;
                            }
                            player.ActiveSign = sign;    //tries to parse the sign text into the enum

                            isGameStateDirty = false;
                        }
                    }
                    catch
                    { }
                }
            }

            foreach (var layer in this.Application.Profile.Layers.Reverse().ToArray())
            {
                if (layer.Enabled)
                {
                    layers.Enqueue(layer.Render(_game_state));
                }
            }

            //Scripts
            this.Application.UpdateEffectScripts(layers);

            frame.AddLayers(layers.ToArray());
        }
Exemple #14
0
        public override void UpdateLights(EffectFrame frame)
        {
            //Update wrapper lighting
            UpdateWrapperLights(frame);

            Queue <EffectLayer> layers = new Queue <EffectLayer>();

            //ColorZones
            EffectLayer cz_layer = new EffectLayer("BF3 - Color Zones");

            cz_layer.DrawColorZones((Global.Configuration.ApplicationProfiles[profilename].Settings as BF3Settings).lighting_areas.ToArray());
            layers.Enqueue(cz_layer);

            //Scripts
            Global.Configuration.ApplicationProfiles[profilename].UpdateEffectScripts(layers, _game_state);

            frame.AddLayers(layers.ToArray());
        }
        public override void UpdateLights(EffectFrame frame)
        {
            Queue <EffectLayer> layers = new Queue <EffectLayer>();

            RocketLeagueProfile settings = (RocketLeagueProfile)this.Application.Profile;

            Process[] process_search = Process.GetProcessesByName("RocketLeague");

            if (process_search.Length != 0)
            {
                using (MemoryReader memread = new MemoryReader(process_search[0]))
                {
                    PlayerTeam parsed_team = PlayerTeam.Undefined;
                    if (Enum.TryParse <PlayerTeam>(memread.ReadInt(pointers.Team.baseAddress, pointers.Team.pointers).ToString(), out parsed_team))
                    {
                        (_game_state as GameState_RocketLeague).Player.Team = parsed_team;
                    }


                    // Goal explosion preperation
                    (_game_state as GameState_RocketLeague).Match.YourTeam_LastScore = parsed_team == PlayerTeam.Blue ? (_game_state as GameState_RocketLeague).Match.BlueTeam_Score
                                                                                                          : (_game_state as GameState_RocketLeague).Match.OrangeTeam_Score;
                    (_game_state as GameState_RocketLeague).Match.EnemyTeam_LastScore = parsed_team == PlayerTeam.Orange ? (_game_state as GameState_RocketLeague).Match.BlueTeam_Score
                                                                                                                              : (_game_state as GameState_RocketLeague).Match.OrangeTeam_Score;

                    (_game_state as GameState_RocketLeague).Match.OrangeTeam_Score = memread.ReadInt(pointers.Orange_score.baseAddress, pointers.Orange_score.pointers);
                    (_game_state as GameState_RocketLeague).Match.BlueTeam_Score   = memread.ReadInt(pointers.Blue_score.baseAddress, pointers.Blue_score.pointers);
                    (_game_state as GameState_RocketLeague).Player.BoostAmount     = memread.ReadInt(pointers.Boost_amount.baseAddress, pointers.Boost_amount.pointers);
                }
            }

            foreach (var layer in this.Application.Profile.Layers.Reverse().ToArray())
            {
                if (layer.Enabled && layer.LogicPass)
                {
                    layers.Enqueue(layer.Render(_game_state));
                }
            }

            //Scripts
            this.Application.UpdateEffectScripts(layers);

            frame.AddLayers(layers.ToArray());
        }
Exemple #16
0
        public override void UpdateLights(EffectFrame frame)
        {
            //Update wrapper lighting
            UpdateWrapperLights(frame);

            Queue <EffectLayer> layers = new Queue <EffectLayer>();

            //ColorZones
            if (!((Global.Configuration.ApplicationProfiles[profilename].Settings as LoLSettings).disable_cz_on_dark && last_fill_color.Equals(Color.Black)))
            {
                EffectLayer cz_layer = new EffectLayer("League - Color Zones");
                cz_layer.DrawColorZones((Global.Configuration.ApplicationProfiles[profilename].Settings as LoLSettings).lighting_areas.ToArray());
                layers.Enqueue(cz_layer);
            }

            //Scripts
            Global.Configuration.ApplicationProfiles[profilename].UpdateEffectScripts(layers, _game_state);

            frame.AddLayers(layers.ToArray());
        }
Exemple #17
0
        public override void UpdateLights(EffectFrame frame)
        {
            Queue <EffectLayer> layers   = new Queue <EffectLayer>();
            Dota2Settings       settings = (Dota2Settings)this.Profile.Settings;

            foreach (var layer in settings.Layers.Reverse().ToArray())
            {
                if (layer.Enabled && layer.LogicPass)
                {
                    layers.Enqueue(layer.Render(_game_state));
                }
            }

            //Scripts
            this.Profile.UpdateEffectScripts(layers, _game_state);

            //ColorZones
            layers.Enqueue(new EffectLayer("Dota 2 - Color Zones").DrawColorZones((this.Profile.Settings as Dota2Settings).lighting_areas.ToArray()));

            frame.AddLayers(layers.ToArray());
        }
Exemple #18
0
        public override void UpdateLights(EffectFrame frame)
        {
            Queue <EffectLayer> layers = new Queue <EffectLayer>();

            RocketLeagueSettings settings = (RocketLeagueSettings)this.Profile.Settings;

            Process[] process_search = Process.GetProcessesByName("RocketLeague");

            if (process_search.Length != 0)
            {
                using (MemoryReader memread = new MemoryReader(process_search[0]))
                {
                    PlayerTeam parsed_team = PlayerTeam.Undefined;
                    if (Enum.TryParse <PlayerTeam>(memread.ReadInt(pointers.Team.baseAddress, pointers.Team.pointers).ToString(), out parsed_team))
                    {
                        (_game_state as GameState_RocketLeague).Player.Team = parsed_team;
                    }

                    (_game_state as GameState_RocketLeague).Match.OrangeTeam_Score = memread.ReadInt(pointers.Orange_score.baseAddress, pointers.Orange_score.pointers);
                    (_game_state as GameState_RocketLeague).Match.BlueTeam_Score   = memread.ReadInt(pointers.Blue_score.baseAddress, pointers.Blue_score.pointers);
                    (_game_state as GameState_RocketLeague).Player.BoostAmount     = memread.ReadFloat(pointers.Boost_amount.baseAddress, pointers.Boost_amount.pointers);
                }
            }

            foreach (var layer in this.Profile.Settings.Layers.Reverse().ToArray())
            {
                if (layer.Enabled && layer.LogicPass)
                {
                    layers.Enqueue(layer.Render(_game_state));
                }
            }

            //Scripts
            this.Profile.UpdateEffectScripts(layers);

            //ColorZones
            layers.Enqueue(new EffectLayer("Rocket League - Color Zones").DrawColorZones((this.Profile.Settings as RocketLeagueSettings).lighting_areas.ToArray()));

            frame.AddLayers(layers.ToArray());
        }
Exemple #19
0
        public override void UpdateLights(EffectFrame frame)
        {
            Queue <EffectLayer> layers = new Queue <EffectLayer>();

            GTA5Profile settings = (GTA5Profile)this.Application.Profile;

            foreach (var layer in Application.Profile.Layers.Reverse().ToArray())
            {
                if (layer.Enabled && layer.LogicPass)
                {
                    layers.Enqueue(layer.Render(_game_state));
                }
            }

            //Scripts
            this.Application.UpdateEffectScripts(layers, _game_state);

            //ColorZones
            layers.Enqueue(new EffectLayer("GTA 5 - Color Zones").DrawColorZones((this.Application.Profile as GTA5Profile).lighting_areas.ToArray()));

            frame.AddLayers(layers.ToArray());
        }
Exemple #20
0
        public override void UpdateLights(EffectFrame frame)
        {
            var layers = new Queue <EffectLayer>(Application.Profile.Layers.Where(l => l.Enabled).Reverse().Select(l => l.Render(_game_state)));

            //Scripts before interactive and shortcut assistant layers
            //ProfilesManager.DesktopProfile.UpdateEffectScripts(layers);

            if (Global.Configuration.TimeBasedDimmingEnabled)
            {
                if (Utils.Time.IsCurrentTimeBetween(Global.Configuration.TimeBasedDimmingStartHour, Global.Configuration.TimeBasedDimmingEndHour))
                {
                    layers.Clear();

                    EffectLayer time_based_dim_layer = new EffectLayer("Time Based Dim");
                    time_based_dim_layer.Fill(Color.Black);

                    layers.Enqueue(time_based_dim_layer);
                }
            }

            frame.AddLayers(layers.ToArray());
        }
Exemple #21
0
        public override void UpdateLights(EffectFrame frame)
        {
            Queue <EffectLayer> layers   = new Queue <EffectLayer>();
            ETS2Profile         settings = (ETS2Profile)this.Application.Profile;

            if (Process.GetProcessesByName(processName).Length > 0 && memAccessor != null)
            {
                // -- Below code adapted from the ETS2 Telemetry Server by Funbit (https://github.com/Funbit/ets2-telemetry-server) --
                IntPtr memPtr = IntPtr.Zero;

                try {
                    byte[] raw = new byte[Marshal.SizeOf(typeof(ETS2MemoryStruct))];
                    memAccessor.ReadArray(0, raw, 0, raw.Length);

                    memPtr = Marshal.AllocHGlobal(raw.Length);
                    Marshal.Copy(raw, 0, memPtr, raw.Length);
                    _game_state = new GameState_ETS2((ETS2MemoryStruct)Marshal.PtrToStructure(memPtr, typeof(ETS2MemoryStruct)));
                }
                finally {
                    if (memPtr != IntPtr.Zero)
                    {
                        Marshal.FreeHGlobal(memPtr);
                    }
                }
                // -- End ETS2 Telemetry Server code --
            }

            foreach (var layer in this.Application.Profile.Layers.Reverse().ToArray())
            {
                if (layer.Enabled && layer.LogicPass)
                {
                    layers.Enqueue(layer.Render(_game_state));
                }
            }

            this.Application.UpdateEffectScripts(layers);
            frame.AddLayers(layers.ToArray());
        }
Exemple #22
0
        public override void UpdateLights(EffectFrame frame)
        {
            Queue <EffectLayer> layers = new Queue <EffectLayer>();

            EffectLayer cz_layer = new EffectLayer("Color Zones");

            ColorZone[] zones = { };

            if (Global.Configuration.additional_profiles.ContainsKey(profilename))
            {
                if (!(Global.Configuration.nighttime_enabled &&
                      Utils.Time.IsCurrentTimeBetween(Global.Configuration.nighttime_start_hour, Global.Configuration.nighttime_start_minute, Global.Configuration.nighttime_end_hour, Global.Configuration.nighttime_end_minute))
                    )
                {
                    zones = (Global.Configuration.additional_profiles[profilename].Settings as GenericApplicationSettings).lighting_areas_day.ToArray();
                }
                else
                {
                    zones = (Global.Configuration.additional_profiles[profilename].Settings as GenericApplicationSettings).lighting_areas_night.ToArray();
                }
            }

            cz_layer.DrawColorZones(zones.ToArray());
            layers.Enqueue(cz_layer);

            //Scripts
            Global.Configuration.additional_profiles[profilename].UpdateEffectScripts(layers);

            EffectLayer sc_assistant_layer = new EffectLayer("Shortcut Assistant");

            if (Global.Configuration.additional_profiles.ContainsKey(profilename) && (Global.Configuration.additional_profiles[profilename].Settings as GenericApplicationSettings).shortcuts_assistant_enabled)
            {
                if (Global.held_modified == Keys.LControlKey || Global.held_modified == Keys.RControlKey)
                {
                    if (Global.held_modified == Keys.LControlKey)
                    {
                        sc_assistant_layer.Set(Devices.DeviceKeys.LEFT_CONTROL, (Global.Configuration.additional_profiles[profilename].Settings as GenericApplicationSettings).ctrl_key_color);
                    }
                    else
                    {
                        sc_assistant_layer.Set(Devices.DeviceKeys.RIGHT_CONTROL, (Global.Configuration.additional_profiles[profilename].Settings as GenericApplicationSettings).ctrl_key_color);
                    }
                    sc_assistant_layer.Set((Global.Configuration.additional_profiles[profilename].Settings as GenericApplicationSettings).ctrl_key_sequence, (Global.Configuration.additional_profiles[profilename].Settings as GenericApplicationSettings).ctrl_key_color);
                }
                else if (Global.held_modified == Keys.LMenu || Global.held_modified == Keys.RMenu)
                {
                    if (Global.held_modified == Keys.LMenu)
                    {
                        sc_assistant_layer.Set(Devices.DeviceKeys.LEFT_ALT, (Global.Configuration.additional_profiles[profilename].Settings as GenericApplicationSettings).alt_key_color);
                    }
                    else
                    {
                        sc_assistant_layer.Set(Devices.DeviceKeys.RIGHT_ALT, (Global.Configuration.additional_profiles[profilename].Settings as GenericApplicationSettings).alt_key_color);
                    }
                    sc_assistant_layer.Set((Global.Configuration.additional_profiles[profilename].Settings as GenericApplicationSettings).alt_key_sequence, (Global.Configuration.additional_profiles[profilename].Settings as GenericApplicationSettings).alt_key_color);
                }
            }
            layers.Enqueue(sc_assistant_layer);

            frame.AddLayers(layers.ToArray());
        }
Exemple #23
0
        public override void UpdateLights(EffectFrame frame)
        {
            Queue <EffectLayer> layers = new Queue <EffectLayer>();

            Process[] process_search = Process.GetProcessesByName("RocketLeague");

            if (process_search.Length != 0)
            {
                using (MemoryReader memread = new MemoryReader(process_search[0]))
                {
                    team = memread.ReadInt(pointers.Team.baseAddress, pointers.Team.pointers);

                    team1_score = memread.ReadInt(pointers.Orange_score.baseAddress, pointers.Orange_score.pointers); //Orange Team
                    team2_score = memread.ReadInt(pointers.Blue_score.baseAddress, pointers.Blue_score.pointers);     //Blue Team

                    boost_amount = memread.ReadFloat(pointers.Boost_amount.baseAddress, pointers.Boost_amount.pointers);
                }
            }


            if ((Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).bg_enabled)
            {
                EffectLayer bg_layer = new EffectLayer("Rocket League - Background");

                if (GameEvent_RocketLeague.team == 1 && (Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).bg_use_team_color)
                {
                    bg_layer.Fill((Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).bg_team_1);
                }
                else if (GameEvent_RocketLeague.team == 0 && (Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).bg_use_team_color)
                {
                    bg_layer.Fill((Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).bg_team_2);
                }
                else
                {
                    bg_layer.Fill((Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).bg_ambient_color);
                }

                if ((Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).bg_show_team_score_split)
                {
                    if (team1_score != 0 || team2_score != 0)
                    {
                        int total_score = team1_score + team2_score;


                        LinearGradientBrush the__split_brush =
                            new LinearGradientBrush(
                                new Point(0, 0),
                                new Point(Effects.canvas_biggest, 0),
                                Color.Red, Color.Red);
                        Color[] colors = new Color[]
                        {
                            (Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).bg_team_1,     //Orange
                            (Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).bg_team_1,     //Orange "Line"
                            (Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).bg_team_2,     //Blue "Line"
                            (Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).bg_team_2      //Blue
                        };
                        int     num_colors      = colors.Length;
                        float[] blend_positions = new float[num_colors];

                        if (team1_score > team2_score)
                        {
                            blend_positions[0] = 0.0f;
                            blend_positions[1] = ((float)team1_score / (float)total_score) - 0.01f;
                            blend_positions[2] = ((float)team1_score / (float)total_score) + 0.01f;
                            blend_positions[3] = 1.0f;
                        }
                        else if (team1_score < team2_score)
                        {
                            blend_positions[0] = 0.0f;
                            blend_positions[1] = (1.0f - ((float)team2_score / (float)total_score)) - 0.01f;
                            blend_positions[2] = (1.0f - ((float)team2_score / (float)total_score)) + 0.01f;
                            blend_positions[3] = 1.0f;
                        }
                        else
                        {
                            blend_positions[0] = 0.0f;
                            blend_positions[1] = 0.49f;
                            blend_positions[2] = 0.51f;
                            blend_positions[3] = 1.0f;
                        }

                        ColorBlend color_blend = new ColorBlend();
                        color_blend.Colors    = colors;
                        color_blend.Positions = blend_positions;
                        the__split_brush.InterpolationColors = color_blend;

                        bg_layer.Fill(the__split_brush);
                    }
                }

                layers.Enqueue(bg_layer);
            }

            if ((Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).boost_enabled)
            {
                EffectLayer boost_layer = new EffectLayer("Rocket League - Boost Indicator");

                double percentOccupied = boost_amount;

                ColorSpectrum boost_spec = new ColorSpectrum((Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).boost_low, (Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).boost_high);
                boost_spec.SetColorAt(0.75f, (Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).boost_mid);

                boost_layer.PercentEffect(boost_spec, (Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).boost_sequence, percentOccupied, 1.0D, PercentEffectType.Progressive_Gradual);

                if ((Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).boost_peripheral_use)
                {
                    boost_layer.Set(Devices.DeviceKeys.Peripheral, boost_spec.GetColorAt((float)Math.Round(percentOccupied, 1)));
                }

                layers.Enqueue(boost_layer);
            }

            //ColorZones
            EffectLayer cz_layer = new EffectLayer("Rocket League - Color Zones");

            cz_layer.DrawColorZones((Global.Configuration.ApplicationProfiles[profilename].Settings as RocketLeagueSettings).lighting_areas.ToArray());
            layers.Enqueue(cz_layer);

            //Scripts
            Global.Configuration.ApplicationProfiles[profilename].UpdateEffectScripts(layers);

            frame.AddLayers(layers.ToArray());
        }
Exemple #24
0
        public override void UpdateLights(EffectFrame frame)
        {
            Queue <EffectLayer> layers = new Queue <EffectLayer>();

            if ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_color_enabled)
            {
                EffectLayer bg_layer = new EffectLayer("GTA 5 - Background");

                Color bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_ambient;

                switch (curr_state)
                {
                case PlayerState.PlayingSP_Trevor:
                    bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_trevor;
                    break;

                case PlayerState.PlayingSP_Franklin:
                    bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_franklin;
                    break;

                case PlayerState.PlayingSP_Michael:
                    bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_michael;
                    break;

                case PlayerState.PlayingSP_Chop:
                    bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_chop;
                    break;

                case PlayerState.PlayingMP:
                    bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_online;
                    break;

                case PlayerState.PlayingMP_Mission:
                    bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_online_mission;
                    break;

                case PlayerState.PlayingMP_HeistFinale:
                    bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_online_heistfinale;
                    break;

                case PlayerState.PlayingMP_Spectator:
                    bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_online_spectator;
                    break;

                case PlayerState.PlayingRace_Gold:
                    bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_race_gold;
                    break;

                case PlayerState.PlayingRace_Silver:
                    bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_race_silver;
                    break;

                case PlayerState.PlayingRace_Bronze:
                    bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_race_bronze;
                    break;

                default:
                    bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_ambient;
                    break;
                }

                bg_layer.Fill(bg_color);

                if ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).bg_peripheral_use)
                {
                    bg_layer.Set(Devices.DeviceKeys.Peripheral, bg_color);
                }

                layers.Enqueue(bg_layer);
            }

            if ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).siren_enabled && have_cops)
            {
                EffectLayer sirens_layer = new EffectLayer("GTA 5 - Police Sirens");

                Color lefts  = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).left_siren_color;
                Color rights = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).right_siren_color;

                KeySequence left_siren_ks  = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).left_siren_sequence;
                KeySequence right_siren_ks = (Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).right_siren_sequence;

                //Switch sirens
                switch ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).siren_type)
                {
                case GTA5_PoliceEffects.Alt_Full:
                    switch (siren_keyframe % 2)
                    {
                    case 1:
                        rights = lefts;
                        break;

                    default:
                        lefts = rights;
                        break;
                    }
                    siren_keyframe = siren_keyframe % 2;

                    if ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).siren_peripheral_use)
                    {
                        sirens_layer.Set(Devices.DeviceKeys.Peripheral, lefts);
                    }
                    break;

                case GTA5_PoliceEffects.Alt_Half:
                    switch (siren_keyframe % 2)
                    {
                    case 1:
                        rights = lefts;
                        lefts  = Color.Black;

                        if ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).siren_peripheral_use)
                        {
                            sirens_layer.Set(Devices.DeviceKeys.Peripheral, rights);
                        }
                        break;

                    default:
                        lefts  = rights;
                        rights = Color.Black;

                        if ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).siren_peripheral_use)
                        {
                            sirens_layer.Set(Devices.DeviceKeys.Peripheral, lefts);
                        }
                        break;
                    }
                    siren_keyframe = siren_keyframe % 2;
                    break;

                case GTA5_PoliceEffects.Alt_Full_Blink:
                    switch (siren_keyframe % 4)
                    {
                    case 2:
                        rights = lefts;
                        break;

                    case 0:
                        lefts = rights;
                        break;

                    default:
                        lefts  = Color.Black;
                        rights = Color.Black;
                        break;
                    }
                    siren_keyframe = siren_keyframe % 4;

                    if ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).siren_peripheral_use)
                    {
                        sirens_layer.Set(Devices.DeviceKeys.Peripheral, lefts);
                    }
                    break;

                case GTA5_PoliceEffects.Alt_Half_Blink:
                    switch (siren_keyframe % 8)
                    {
                    case 6:
                        rights = lefts;
                        lefts  = Color.Black;

                        if ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).siren_peripheral_use)
                        {
                            sirens_layer.Set(Devices.DeviceKeys.Peripheral, rights);
                        }
                        break;

                    case 4:
                        rights = lefts;
                        lefts  = Color.Black;

                        if ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).siren_peripheral_use)
                        {
                            sirens_layer.Set(Devices.DeviceKeys.Peripheral, rights);
                        }
                        break;

                    case 2:
                        lefts  = rights;
                        rights = Color.Black;

                        if ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).siren_peripheral_use)
                        {
                            sirens_layer.Set(Devices.DeviceKeys.Peripheral, lefts);
                        }
                        break;

                    case 0:
                        lefts  = rights;
                        rights = Color.Black;

                        if ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).siren_peripheral_use)
                        {
                            sirens_layer.Set(Devices.DeviceKeys.Peripheral, lefts);
                        }
                        break;

                    default:
                        rights = Color.Black;
                        lefts  = Color.Black;

                        if ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).siren_peripheral_use)
                        {
                            sirens_layer.Set(Devices.DeviceKeys.Peripheral, lefts);
                        }
                        break;
                    }
                    siren_keyframe = siren_keyframe % 8;
                    break;

                default:
                    switch (siren_keyframe % 2)
                    {
                    case 1:
                        Color tempc = rights;
                        rights = lefts;
                        lefts  = tempc;
                        break;

                    default:
                        break;
                    }
                    siren_keyframe = siren_keyframe % 2;

                    if ((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).siren_peripheral_use)
                    {
                        sirens_layer.Set(Devices.DeviceKeys.Peripheral, lefts);
                    }
                    break;
                }

                sirens_layer.Set(left_siren_ks, lefts);
                sirens_layer.Set(right_siren_ks, rights);

                layers.Enqueue(sirens_layer);
            }

            //ColorZones
            EffectLayer cz_layer = new EffectLayer("GTA 5 - Color Zones");

            cz_layer.DrawColorZones((Global.Configuration.ApplicationProfiles[profilename].Settings as GTA5Settings).lighting_areas.ToArray());
            layers.Enqueue(cz_layer);

            EffectLayer debug_layer = new EffectLayer("GTA 5 - Debug");

            if (special_mode == 16711939)
            {
                debug_layer.Set(Devices.DeviceKeys.SPACE, Color.Red);
            }
            else if (special_mode == 16775939)
            {
                debug_layer.Set(Devices.DeviceKeys.SPACE, Color.Blue);
            }

            layers.Enqueue(debug_layer);

            //Scripts
            Global.Configuration.ApplicationProfiles[profilename].UpdateEffectScripts(layers, _game_state);

            frame.AddLayers(layers.ToArray());
        }
        internal virtual void UpdateWrapperLights(EffectFrame frame)
        {
            Queue <EffectLayer> layers = new Queue <EffectLayer>();

            EffectLayer colorfill_layer = new EffectLayer("Aurora Wrapper - Color Fill", last_fill_color);

            layers.Enqueue(colorfill_layer);

            EffectLayer bitmap_layer = new EffectLayer("Aurora Wrapper - Bitmap");

            Devices.DeviceKeys[] allkeys = Enum.GetValues(typeof(Devices.DeviceKeys)).Cast <Devices.DeviceKeys>().ToArray();
            foreach (var key in allkeys)
            {
                if (key == Devices.DeviceKeys.LOGO && logo.Length == 4)
                {
                    bitmap_layer.Set(key, Color.FromArgb(logo[3], logo[2], logo[1], logo[0]));
                }
                else if (key == Devices.DeviceKeys.Peripheral && peripheral.Length == 4)
                {
                    bitmap_layer.Set(key, Color.FromArgb(peripheral[3], peripheral[2], peripheral[1], peripheral[0]));
                }
                else if (key == Devices.DeviceKeys.G1 && g1.Length == 4)
                {
                    bitmap_layer.Set(key, Color.FromArgb(g1[3], g1[2], g1[1], g1[0]));
                }
                else if (key == Devices.DeviceKeys.G2 && g2.Length == 4)
                {
                    bitmap_layer.Set(key, Color.FromArgb(g2[3], g2[2], g2[1], g2[0]));
                }
                else if (key == Devices.DeviceKeys.G3 && g3.Length == 4)
                {
                    bitmap_layer.Set(key, Color.FromArgb(g3[3], g3[2], g3[1], g3[0]));
                }
                else if (key == Devices.DeviceKeys.G4 && g4.Length == 4)
                {
                    bitmap_layer.Set(key, Color.FromArgb(g4[3], g4[2], g4[1], g4[0]));
                }
                else if (key == Devices.DeviceKeys.G5 && g5.Length == 4)
                {
                    bitmap_layer.Set(key, Color.FromArgb(g5[3], g5[2], g5[1], g5[0]));
                }
                else
                {
                    Devices.Logitech.Logitech_keyboardBitmapKeys logi_key = Devices.Logitech.LogitechDevice.ToLogitechBitmap(key);

                    if (logi_key != Devices.Logitech.Logitech_keyboardBitmapKeys.UNKNOWN)
                    {
                        int a, r, g, b;

                        b = bitmap[(int)logi_key];
                        g = bitmap[(int)logi_key + 1];
                        r = bitmap[(int)logi_key + 2];
                        a = bitmap[(int)logi_key + 3];

                        bitmap_layer.Set(key, Color.FromArgb(a, r, g, b));
                    }
                }
            }

            layers.Enqueue(bitmap_layer);

            EffectLayer effects_layer = new EffectLayer("Aurora Wrapper - Effects");

            Devices.DeviceKeys[] effect_keys = key_effects.Keys.ToArray();
            long currentTime = Utils.Time.GetMillisecondsSinceEpoch();

            foreach (var key in effect_keys)
            {
                if (key_effects[key].duration != 0 && key_effects[key].timeStarted + key_effects[key].duration <= currentTime)
                {
                    key_effects.Remove(key);
                }
                else
                {
                    if (key_effects[key] is LogiFlashSingleKey)
                    {
                        effects_layer.Set((key_effects[key] as LogiFlashSingleKey).key, (key_effects[key] as LogiFlashSingleKey).GetColor(currentTime - (key_effects[key] as LogiFlashSingleKey).timeStarted));
                    }
                    else if (key_effects[key] is LogiPulseSingleKey)
                    {
                        effects_layer.Set((key_effects[key] as LogiPulseSingleKey).key, (key_effects[key] as LogiPulseSingleKey).GetColor(currentTime - (key_effects[key] as LogiPulseSingleKey).timeStarted));
                    }
                    else
                    {
                        effects_layer.Set((key_effects[key] as KeyEffect).key, (key_effects[key] as KeyEffect).GetColor(currentTime - (key_effects[key] as KeyEffect).timeStarted));
                    }
                }
            }

            layers.Enqueue(effects_layer);

            EffectLayer entire_effect_layer = new EffectLayer("Aurora Wrapper - EntireKB effect");

            if (current_effect != null)
            {
                if (current_effect is LogiFlashLighting)
                {
                    (current_effect as LogiFlashLighting).SetEffect(entire_effect_layer, currentTime - (current_effect as LogiFlashLighting).timeStarted);
                }
                else if (current_effect is LogiPulseLighting)
                {
                    (current_effect as LogiPulseLighting).SetEffect(entire_effect_layer, currentTime - (current_effect as LogiPulseLighting).timeStarted);
                }
                else
                {
                    current_effect.SetEffect(entire_effect_layer, currentTime - current_effect.timeStarted);
                }
            }

            layers.Enqueue(entire_effect_layer);

            frame.AddLayers(layers.ToArray());
        }
Exemple #26
0
        public override void UpdateLights(EffectFrame frame)
        {
            previoustime = currenttime;
            currenttime  = Utils.Time.GetMillisecondsSinceEpoch();

            Queue <EffectLayer> layers = new Queue <EffectLayer>();

            float time = (float)Math.Pow(Math.Sin(1.0D * (internalcounter++ / 10.0f)), 2.0d);

            EffectLayer cz_layer = new EffectLayer("Color Zones");

            cz_layer.DrawColorZones((Global.Configuration.desktop_profile.Settings as DesktopSettings).lighting_areas.ToArray());
            layers.Enqueue(cz_layer);

            if ((Global.Configuration.desktop_profile.Settings as DesktopSettings).cpu_usage_enabled)
            {
                EffectLayer cpu = new EffectLayer("CPU");

                if (currentCPUValue - previousCPUValue > 0.0f && transitionalCPUValue < currentCPUValue)
                {
                    transitionalCPUValue += (currentCPUValue - previousCPUValue) / 100.0f;
                }
                else if (currentCPUValue - previousCPUValue < 0.0f && transitionalCPUValue > currentCPUValue)
                {
                    transitionalCPUValue -= (previousCPUValue - currentCPUValue) / 100.0f;
                }
                else if (currentCPUValue - previousCPUValue == 0.0f && transitionalCPUValue != currentCPUValue)
                {
                    transitionalCPUValue = currentCPUValue;
                }

                Color cpu_used = (Global.Configuration.desktop_profile.Settings as DesktopSettings).cpu_used_color;
                Color cpu_free = (Global.Configuration.desktop_profile.Settings as DesktopSettings).cpu_free_color;

                if ((Global.Configuration.desktop_profile.Settings as DesktopSettings).cpu_free_color_transparent)
                {
                    cpu_free = Color.FromArgb(0, cpu_used);
                }

                cpu.PercentEffect(cpu_used, cpu_free, (Global.Configuration.desktop_profile.Settings as DesktopSettings).cpu_sequence, transitionalCPUValue, 100.0f, (Global.Configuration.desktop_profile.Settings as DesktopSettings).cpu_usage_effect_type);

                layers.Enqueue(cpu);
            }

            if ((Global.Configuration.desktop_profile.Settings as DesktopSettings).ram_usage_enabled)
            {
                EffectLayer memory = new EffectLayer("Memory");

                double percentFree     = ((double)memory_Available / (double)memory_Total);
                double percentOccupied = 1.0D - percentFree;

                Color ram_used = (Global.Configuration.desktop_profile.Settings as DesktopSettings).ram_used_color;
                Color ram_free = (Global.Configuration.desktop_profile.Settings as DesktopSettings).ram_free_color;

                if ((Global.Configuration.desktop_profile.Settings as DesktopSettings).ram_free_color_transparent)
                {
                    ram_free = Color.FromArgb(0, ram_used);
                }

                memory.PercentEffect(ram_used, ram_free, (Global.Configuration.desktop_profile.Settings as DesktopSettings).ram_sequence, percentOccupied, 1.0D, (Global.Configuration.desktop_profile.Settings as DesktopSettings).ram_usage_effect_type);

                layers.Enqueue(memory);
            }

            //Scripts before interactive and shortcut assistant layers
            Global.Configuration.desktop_profile.UpdateEffectScripts(layers);

            EffectLayer interactive_layer = new EffectLayer("Interactive Effects");

            foreach (var input in input_list.ToArray())
            {
                if (input == null)
                {
                    continue;
                }

                try
                {
                    if (input.type == input_item.input_type.Spectrum)
                    {
                        float transition_value = input.progress / Effects.canvas_width;

                        if (transition_value > 1.0f)
                        {
                            continue;
                        }

                        Color color = input.spectrum.GetColorAt(transition_value);

                        interactive_layer.Set(input.key, color);
                    }
                    else if (input.type == input_item.input_type.AnimationMix)
                    {
                        float time_value = input.progress / Effects.canvas_width;

                        if (time_value > 1.0f)
                        {
                            continue;
                        }

                        input.animation.Draw(interactive_layer.GetGraphics(), time_value);
                    }
                }
                catch (Exception exc)
                {
                    Global.logger.LogLine("Interative layer exception, " + exc, Logging_Level.Error);
                }
            }

            for (int x = input_list.Count - 1; x >= 0; x--)
            {
                try
                {
                    if (input_list[x].progress > Effects.canvas_width)
                    {
                        input_list.RemoveAt(x);
                    }
                    else
                    {
                        float trans_added = ((Global.Configuration.desktop_profile.Settings as DesktopSettings).interactive_effect_speed * (getDeltaTime() * 5.0f));
                        input_list[x].progress += trans_added;
                    }
                }
                catch (Exception exc)
                {
                    Global.logger.LogLine("Interative layer exception, " + exc, Logging_Level.Error);
                }
            }

            layers.Enqueue(interactive_layer);

            if (Global.Configuration.time_based_dimming_enabled)
            {
                if (
                    Utils.Time.IsCurrentTimeBetween(Global.Configuration.time_based_dimming_start_hour, Global.Configuration.time_based_dimming_end_hour)
                    )
                {
                    layers.Clear();

                    EffectLayer time_based_dim_layer = new EffectLayer("Time Based Dim");
                    time_based_dim_layer.Fill(Color.Black);

                    layers.Enqueue(time_based_dim_layer);
                }
            }

            EffectLayer sc_assistant_layer = new EffectLayer("Shortcut Assistant");

            if ((Global.Configuration.desktop_profile.Settings as DesktopSettings).shortcuts_assistant_enabled)
            {
                if (Global.held_modified == Keys.LControlKey || Global.held_modified == Keys.RControlKey)
                {
                    if ((Global.Configuration.desktop_profile.Settings as DesktopSettings).shortcuts_assistant_bim_bg)
                    {
                        sc_assistant_layer.Fill(Color.FromArgb(169, 0, 0, 0));
                    }

                    if (Global.held_modified == Keys.LControlKey)
                    {
                        sc_assistant_layer.Set(Devices.DeviceKeys.LEFT_CONTROL, (Global.Configuration.desktop_profile.Settings as DesktopSettings).ctrl_key_color);
                    }
                    else
                    {
                        sc_assistant_layer.Set(Devices.DeviceKeys.RIGHT_CONTROL, (Global.Configuration.desktop_profile.Settings as DesktopSettings).ctrl_key_color);
                    }
                    sc_assistant_layer.Set((Global.Configuration.desktop_profile.Settings as DesktopSettings).ctrl_key_sequence, (Global.Configuration.desktop_profile.Settings as DesktopSettings).ctrl_key_color);
                }
                else if (Global.held_modified == Keys.LMenu || Global.held_modified == Keys.RMenu)
                {
                    if ((Global.Configuration.desktop_profile.Settings as DesktopSettings).shortcuts_assistant_bim_bg)
                    {
                        sc_assistant_layer.Fill(Color.FromArgb(169, 0, 0, 0));
                    }

                    if (Global.held_modified == Keys.LMenu)
                    {
                        sc_assistant_layer.Set(Devices.DeviceKeys.LEFT_ALT, (Global.Configuration.desktop_profile.Settings as DesktopSettings).alt_key_color);
                    }
                    else
                    {
                        sc_assistant_layer.Set(Devices.DeviceKeys.RIGHT_ALT, (Global.Configuration.desktop_profile.Settings as DesktopSettings).alt_key_color);
                    }
                    sc_assistant_layer.Set((Global.Configuration.desktop_profile.Settings as DesktopSettings).alt_key_sequence, (Global.Configuration.desktop_profile.Settings as DesktopSettings).alt_key_color);
                }
                else if (Global.held_modified == Keys.LWin || Global.held_modified == Keys.RWin)
                {
                    if ((Global.Configuration.desktop_profile.Settings as DesktopSettings).shortcuts_assistant_bim_bg)
                    {
                        sc_assistant_layer.Fill(Color.FromArgb(169, 0, 0, 0));
                    }

                    if (Global.held_modified == Keys.LWin)
                    {
                        sc_assistant_layer.Set(Devices.DeviceKeys.LEFT_WINDOWS, (Global.Configuration.desktop_profile.Settings as DesktopSettings).win_key_color);
                    }
                    else
                    {
                        sc_assistant_layer.Set(Devices.DeviceKeys.RIGHT_WINDOWS, (Global.Configuration.desktop_profile.Settings as DesktopSettings).win_key_color);
                    }
                    sc_assistant_layer.Set((Global.Configuration.desktop_profile.Settings as DesktopSettings).win_key_sequence, (Global.Configuration.desktop_profile.Settings as DesktopSettings).win_key_color);
                }
            }
            layers.Enqueue(sc_assistant_layer);

            frame.AddLayers(layers.ToArray());
        }
Exemple #27
0
        public override void UpdateLights(EffectFrame frame)
        {
            currenttime = Utils.Time.GetMillisecondsSinceEpoch();

            Queue <EffectLayer> layers = new Queue <EffectLayer>();

            //update background
            if ((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).bg_enabled)
            {
                EffectLayer bg_layer = new EffectLayer("Payday 2 - Background");

                Color bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).ambient_color;

                if ((level_phase == LevelPhase.Assault || level_phase == LevelPhase.Winters) && game_state == GameStates.Ingame)
                {
                    if (level_phase == LevelPhase.Assault)
                    {
                        bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).assault_color;
                    }
                    else if (level_phase == LevelPhase.Winters)
                    {
                        bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).winters_color;
                    }

                    double blend_percent = Math.Pow(Math.Sin(((currenttime % 1300L) / 1300.0D) * (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).assault_speed_mult * 2.0D * Math.PI), 2.0D);

                    bg_color = Utils.ColorUtils.BlendColors((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).assault_fade_color, bg_color, blend_percent);

                    if ((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).assault_animation_enabled)
                    {
                        Color effect_contours            = Color.FromArgb(200, Color.Black);
                        float animation_stage_yoffset    = 20.0f;
                        float animation_repeat_keyframes = 250.0f; //Effects.canvas_width * 2.0f;

                        /* Effect visual:
                         *
                         * / /  ----  / /
                         *
                         */

                        EffectColorFunction line1_col_func = new EffectColorFunction(
                            new EffectLine(-1f, Effects.canvas_width + assault_yoffset + animation_stage_yoffset),
                            new ColorSpectrum(effect_contours),
                            2);

                        EffectColorFunction line2_col_func = new EffectColorFunction(
                            new EffectLine(-1f, Effects.canvas_width + assault_yoffset + 9.0f + animation_stage_yoffset),
                            new ColorSpectrum(effect_contours),
                            2);

                        EffectColorFunction line3_col_func = new EffectColorFunction(
                            new EffectLine(new EffectPoint(Effects.canvas_width + assault_yoffset + 17.0f + animation_stage_yoffset, Effects.canvas_height / 2.0f), new EffectPoint(Effects.canvas_width + assault_yoffset + 34.0f + animation_stage_yoffset, Effects.canvas_height / 2.0f), true),
                            new ColorSpectrum(effect_contours),
                            6);

                        EffectColorFunction line4_col_func = new EffectColorFunction(
                            new EffectLine(-1f, Effects.canvas_width + assault_yoffset + 52.0f + animation_stage_yoffset),
                            new ColorSpectrum(effect_contours),
                            2);

                        EffectColorFunction line5_col_func = new EffectColorFunction(
                            new EffectLine(-1f, Effects.canvas_width + assault_yoffset + 61.0f + animation_stage_yoffset),
                            new ColorSpectrum(effect_contours),
                            2);

                        assault_yoffset -= 0.50f;
                        assault_yoffset  = assault_yoffset % animation_repeat_keyframes;

                        bg_layer.AddPostFunction(line1_col_func);
                        bg_layer.AddPostFunction(line2_col_func);
                        //bg_layer.AddPostFunction(line3_col_func);
                        bg_layer.AddPostFunction(line4_col_func);
                        bg_layer.AddPostFunction(line5_col_func);
                    }

                    bg_layer.Fill(bg_color);

                    if ((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).bg_peripheral_use)
                    {
                        bg_layer.Set(Devices.DeviceKeys.Peripheral, bg_color);
                    }
                }
                else if (level_phase == LevelPhase.Stealth && game_state == GameStates.Ingame)
                {
                    if ((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).bg_show_suspicion)
                    {
                        double percentSuspicious = ((double)suspicion_amount / (double)1.0);

                        ColorSpectrum suspicion_spec = new ColorSpectrum((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).low_suspicion_color, (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).high_suspicion_color);
                        suspicion_spec.SetColorAt(0.5f, (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).medium_suspicion_color);

                        Settings.KeySequence suspicionSequence = new Settings.KeySequence(new Settings.FreeFormObject(0, 0, 1.0f / (Effects.editor_to_canvas_width / Effects.canvas_width), 1.0f / (Effects.editor_to_canvas_height / Effects.canvas_height)));

                        bg_layer.PercentEffect(suspicion_spec, suspicionSequence, percentSuspicious, 1.0D, (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).suspicion_effect_type);

                        if ((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).bg_peripheral_use)
                        {
                            bg_layer.Set(Devices.DeviceKeys.Peripheral, suspicion_spec.GetColorAt((float)percentSuspicious));
                        }
                    }
                }
                else if (level_phase == LevelPhase.Point_of_no_return && game_state == GameStates.Ingame)
                {
                    ColorSpectrum no_return_spec = new ColorSpectrum(Color.Red, Color.Yellow);

                    Color no_return_color = no_return_spec.GetColorAt(no_return_flashamount);
                    no_return_flashamount -= 0.05f;

                    if (no_return_flashamount < 0.0f)
                    {
                        no_return_flashamount = 0.0f;
                    }

                    bg_layer.Fill(no_return_color);

                    if ((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).bg_peripheral_use)
                    {
                        bg_layer.Set(Devices.DeviceKeys.Peripheral, no_return_color);
                    }
                }
                else
                {
                    bg_layer.Fill(bg_color);

                    if ((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).bg_peripheral_use)
                    {
                        bg_layer.Set(Devices.DeviceKeys.Peripheral, bg_color);
                    }
                }

                layers.Enqueue(bg_layer);
            }

            if (game_state == GameStates.Ingame)
            {
                if (
                    player_state == PlayerState.Mask_Off ||
                    player_state == PlayerState.Standard ||
                    player_state == PlayerState.Jerry1 ||
                    player_state == PlayerState.Jerry2 ||
                    player_state == PlayerState.Tased ||
                    player_state == PlayerState.Bipod ||
                    player_state == PlayerState.Carry
                    )
                {
                    //Update Health
                    EffectLayer hpbar_layer = new EffectLayer("Payday 2 - HP Bar");
                    if ((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).health_enabled)
                    {
                        hpbar_layer.PercentEffect((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).healthy_color,
                                                  (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).hurt_color,
                                                  (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).health_sequence,
                                                  (double)health,
                                                  (double)health_max,
                                                  (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).health_effect_type);
                    }

                    layers.Enqueue(hpbar_layer);

                    //Update Health
                    EffectLayer ammobar_layer = new EffectLayer("Payday 2 - Ammo Bar");
                    if ((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).ammo_enabled)
                    {
                        hpbar_layer.PercentEffect((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).ammo_color,
                                                  (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).noammo_color,
                                                  (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).ammo_sequence,
                                                  (double)clip,
                                                  (double)clip_max,
                                                  (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).ammo_effect_type);
                    }

                    layers.Enqueue(ammobar_layer);
                }
                else if (player_state == PlayerState.Incapacitated || player_state == PlayerState.Bleed_out || player_state == PlayerState.Fatal)
                {
                    int incapAlpha = (int)(down_time > 10 ? 0 : 255 * (1.0D - (double)down_time / 10.0D));

                    if (incapAlpha > 255)
                    {
                        incapAlpha = 255;
                    }
                    else if (incapAlpha < 0)
                    {
                        incapAlpha = 0;
                    }

                    Color       incapColor  = Color.FromArgb(incapAlpha, (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).downed_color);
                    EffectLayer incap_layer = new EffectLayer("Payday 2 - Incapacitated", incapColor);
                    incap_layer.Set(Devices.DeviceKeys.Peripheral, incapColor);

                    layers.Enqueue(incap_layer);
                }
                else if (player_state == PlayerState.Arrested)
                {
                    Color       arrstedColor   = (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).arrested_color;
                    EffectLayer arrested_layer = new EffectLayer("Payday 2 - Arrested", arrstedColor);
                    arrested_layer.Set(Devices.DeviceKeys.Peripheral, arrstedColor);

                    layers.Enqueue(arrested_layer);
                }

                if (isSwanSong && (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).swansong_enabled)
                {
                    EffectLayer swansong_layer = new EffectLayer("Payday 2 - Swansong");

                    double blend_percent = Math.Pow(Math.Cos((currenttime % 1300L) / 1300.0D * (Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).swansong_speed_mult * 2.0D * Math.PI), 2.0D);

                    Color swansongColor = Utils.ColorUtils.MultiplyColorByScalar((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).swansong_color, blend_percent);

                    swansong_layer.Fill(swansongColor);

                    if ((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).bg_peripheral_use)
                    {
                        swansong_layer.Set(Devices.DeviceKeys.Peripheral, swansongColor);
                    }

                    layers.Enqueue(swansong_layer);
                }

                //Update Flashed
                if (flashbang_amount > 0)
                {
                    EffectLayer flashed_layer = new EffectLayer("Payday 2 - Flashed");

                    Color flash_color = Utils.ColorUtils.MultiplyColorByScalar(Color.White, flashbang_amount);

                    flashed_layer.Fill(flash_color);

                    layers.Enqueue(flashed_layer);
                }
            }

            //ColorZones
            EffectLayer cz_layer = new EffectLayer("Payday 2 - Color Zones");

            cz_layer.DrawColorZones((Global.Configuration.ApplicationProfiles[profilename].Settings as PD2Settings).lighting_areas.ToArray());
            layers.Enqueue(cz_layer);

            //Scripts
            Global.Configuration.ApplicationProfiles[profilename].UpdateEffectScripts(layers, _game_state);

            frame.AddLayers(layers.ToArray());

            lasttime = currenttime;
        }
        public override void UpdateLights(EffectFrame frame)
        {
            Queue <EffectLayer> layers = new Queue <EffectLayer>();

            if (File.Exists(dataPath))
            {
                if (configContent != null)
                {
                    var signRes = _configRegex.Match(configContent);
                    var parts   = signRes.Value.Split('\n').Skip(1).Select(v => v.Replace("\r", "")).ToList();
                    if (parts.Count != 0)
                    {
                        parts.RemoveAt(parts.Count - 1);

                        // Update sign
                        var sign = parts.FirstOrDefault(p => p.Contains("ActiveSign="));
                        if (sign != null)
                        {
                            var signString = sign.Split('=')[1];
                            switch (signString)
                            {
                            case "ST_Aard":
                                (_game_state as GameState_Witcher3).Player.ActiveSign = WitcherSign.Aard;
                                break;

                            case "ST_Yrden":
                                (_game_state as GameState_Witcher3).Player.ActiveSign = WitcherSign.Yrden;
                                break;

                            case "ST_Igni":
                                (_game_state as GameState_Witcher3).Player.ActiveSign = WitcherSign.Igni;
                                break;

                            case "ST_Quen":
                                (_game_state as GameState_Witcher3).Player.ActiveSign = WitcherSign.Quen;
                                break;

                            case "ST_Axii":
                                (_game_state as GameState_Witcher3).Player.ActiveSign = WitcherSign.Axii;
                                break;
                            }
                        }

                        // Update max health
                        var maxHealth = parts.FirstOrDefault(p => p.Contains("MaxHealth="));
                        if (maxHealth != null)
                        {
                            var maxHealthInt = int.Parse(maxHealth.Split('=')[1].Split('.')[0]);
                            (_game_state as GameState_Witcher3).Player.MaximumHealth = maxHealthInt;
                        }
                        // Update health
                        var health = parts.FirstOrDefault(p => p.Contains("CurrHealth="));
                        if (health != null)
                        {
                            var healthInt = int.Parse(health.Split('=')[1].Split('.')[0]);
                            (_game_state as GameState_Witcher3).Player.CurrentHealth = healthInt;
                        }
                        // Update stamina
                        var stamina = parts.FirstOrDefault(p => p.Contains("Stamina="));
                        if (stamina != null)
                        {
                            var staminaInt = int.Parse(stamina.Split('=')[1].Split('.')[0]);
                            (_game_state as GameState_Witcher3).Player.Stamina = staminaInt;
                        }
                        // Update Toxicity
                        var toxicity = parts.FirstOrDefault(p => p.Contains("Toxicity="));
                        if (toxicity != null)
                        {
                            var toxicityInt = int.Parse(toxicity.Split('=')[1].Split('.')[0]);
                            (_game_state as GameState_Witcher3).Player.Toxicity = toxicityInt;
                        }
                    }
                }
            }
            //Artemis code


            foreach (var layer in this.Application.Profile.Layers.Reverse().ToArray())
            {
                if (layer.Enabled && layer.LogicPass)
                {
                    layers.Enqueue(layer.Render(_game_state));
                }
            }

            //Scripts
            this.Application.UpdateEffectScripts(layers);

            frame.AddLayers(layers.ToArray());
        }
Exemple #29
0
        public override void UpdateLights(EffectFrame frame)
        {
            Queue <EffectLayer> layers = new Queue <EffectLayer>();

            //update background
            if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bg_team_enabled)
            {
                EffectLayer bg_layer = new EffectLayer("CSGO - Background");

                Color bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).ambient_color;

                if (current_team == PlayerTeam.T)
                {
                    bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).t_color;
                }
                else if (current_team == PlayerTeam.CT)
                {
                    bg_color = (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).ct_color;
                }

                if (current_team != PlayerTeam.Undefined)
                {
                    if (dim_bg_at <= general_timer.ElapsedMilliseconds)
                    {
                        isDimming = true;
                        bg_color  = Utils.ColorUtils.MultiplyColorByScalar(bg_color, getDimmingValue());
                    }
                    else
                    {
                        isDimming = false;
                        dim_value = 1.0;
                    }
                }

                bg_layer.Fill(bg_color);

                if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bg_peripheral_use)
                {
                    bg_layer.Set(Devices.DeviceKeys.Peripheral, bg_color);
                }
                layers.Enqueue(bg_layer);
            }

            //Not initialized
            if (current_team != PlayerTeam.Undefined)
            {
                //Update Health
                EffectLayer hpbar_layer = new EffectLayer("CSGO - HP Bar");
                if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).health_enabled)
                {
                    hpbar_layer.PercentEffect((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).healthy_color,
                                              (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).hurt_color,
                                              (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).health_sequence,
                                              (double)health,
                                              (double)health_max,
                                              (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).health_effect_type);
                }

                layers.Enqueue(hpbar_layer);

                //Update Ammo
                EffectLayer ammobar_layer = new EffectLayer("CSGO - Ammo Bar");
                if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).ammo_enabled)
                {
                    ammobar_layer.PercentEffect((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).ammo_color,
                                                (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).noammo_color,
                                                (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).ammo_sequence,
                                                (double)clip,
                                                (double)clip_max,
                                                (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).ammo_effect_type);
                }

                layers.Enqueue(ammobar_layer);


                //Update Bomb
                if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_enabled)
                {
                    EffectLayer bomb_effect_layer = new EffectLayer("CSGO - Bomb Effect");

                    Devices.DeviceKeys[] _bombkeys = (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_sequence.keys.ToArray();

                    if (bombstate == BombState.Planted)
                    {
                        if (!bombtimer.IsRunning)
                        {
                            bombtimer.Restart();
                            bombflashcount = 0;
                            bombflashtime  = 0;
                            bombflashedat  = 0;
                        }

                        double bombflashamount = 1.0;
                        bool   isCritical      = false;


                        if (bombtimer.ElapsedMilliseconds < 38000)
                        {
                            if (bombtimer.ElapsedMilliseconds >= bombflashtime)
                            {
                                bombflash     = true;
                                bombflashedat = bombtimer.ElapsedMilliseconds;
                                bombflashtime = bombtimer.ElapsedMilliseconds + (1000 - (bombflashcount++ *13));
                            }

                            bombflashamount = Math.Pow(Math.Sin((bombtimer.ElapsedMilliseconds - bombflashedat) / 80.0 + 0.25), 2.0);
                        }
                        else if (bombtimer.ElapsedMilliseconds >= 38000)
                        {
                            isCritical      = true;
                            bombflashamount = (double)bombtimer.ElapsedMilliseconds / 40000.0;
                        }
                        else if (bombtimer.ElapsedMilliseconds >= 45000)
                        {
                            bombtimer.Stop();
                            bombstate = BombState.Undefined;
                        }

                        if (!isCritical)
                        {
                            if (bombflashamount <= 0.05 && bombflash)
                            {
                                bombflash = false;
                            }

                            if (!bombflash)
                            {
                                bombflashamount = 0.0;
                            }
                        }

                        if (!(Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_gradual)
                        {
                            bombflashamount = Math.Round(bombflashamount);
                        }

                        foreach (Devices.DeviceKeys key in _bombkeys)
                        {
                            if (isCritical)
                            {
                                Color bombcolor_critical = Utils.ColorUtils.MultiplyColorByScalar((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_primed_color, Math.Min(bombflashamount, 1.0));

                                bomb_effect_layer.Set(key, bombcolor_critical);

                                if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_peripheral_use)
                                {
                                    bomb_effect_layer.Set(Devices.DeviceKeys.Peripheral, bombcolor_critical);
                                }
                            }
                            else
                            {
                                Color bombcolor = Utils.ColorUtils.MultiplyColorByScalar((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_flash_color, Math.Min(bombflashamount, 1.0));

                                bomb_effect_layer.Set(key, bombcolor);
                                if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_peripheral_use)
                                {
                                    bomb_effect_layer.Set(Devices.DeviceKeys.Peripheral, bombcolor);
                                }
                            }
                        }
                    }
                    else if (bombstate == BombState.Defused)
                    {
                        bombtimer.Stop();
                        if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_display_winner_color)
                        {
                            foreach (Devices.DeviceKeys key in _bombkeys)
                            {
                                bomb_effect_layer.Set(key, (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).ct_color);
                            }

                            if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_peripheral_use)
                            {
                                bomb_effect_layer.Set(Devices.DeviceKeys.Peripheral, (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).ct_color);
                            }
                        }
                    }
                    else if (bombstate == BombState.Exploded)
                    {
                        bombtimer.Stop();
                        if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_display_winner_color)
                        {
                            foreach (Devices.DeviceKeys key in _bombkeys)
                            {
                                bomb_effect_layer.Set(key, (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).t_color);
                            }
                            if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).bomb_peripheral_use)
                            {
                                bomb_effect_layer.Set(Devices.DeviceKeys.Peripheral, (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).t_color);
                            }
                        }
                    }
                    else
                    {
                        bombtimer.Stop();
                    }

                    layers.Enqueue(bomb_effect_layer);
                }
            }

            //Kills Indicator
            if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).kills_indicator && isLocal)
            {
                EffectLayer          kills_indicator_layer = new EffectLayer("CSGO - Kills Indicator");
                Devices.DeviceKeys[] _killsKeys            = (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).kills_sequence.keys.ToArray();
                for (int pos = 0; pos < _killsKeys.Length; pos++)
                {
                    if (pos < roundKills.Count)
                    {
                        switch (roundKills[pos])
                        {
                        case (RoundKillType.Regular):
                            kills_indicator_layer.Set(_killsKeys[pos], (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).kills_regular_color);
                            break;

                        case (RoundKillType.Headshot):
                            kills_indicator_layer.Set(_killsKeys[pos], (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).kills_headshot_color);
                            break;
                        }
                    }
                }
                layers.Enqueue(kills_indicator_layer);
            }

            //ColorZones
            EffectLayer cz_layer = new EffectLayer("CSGO - Color Zones");

            cz_layer.DrawColorZones((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).lighting_areas.ToArray());
            layers.Enqueue(cz_layer);

            //Update Burning

            if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).burning_enabled && burnamount > 0)
            {
                EffectLayer burning_layer   = new EffectLayer("CSGO - Burning");
                double      burning_percent = (double)burnamount / 255.0;
                Color       burncolor       = (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).burning_color;

                if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).burning_animation)
                {
                    int  red_adjusted = (int)((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).burning_color.R + (Math.Cos((general_timer.ElapsedMilliseconds + randomizer.Next(75)) / 75.0) * 0.15 * 255));
                    byte red          = 0;

                    if (red_adjusted > 255)
                    {
                        red = 255;
                    }
                    else if (red_adjusted < 0)
                    {
                        red = 0;
                    }
                    else
                    {
                        red = (byte)red_adjusted;
                    }

                    int  green_adjusted = (int)((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).burning_color.G + (Math.Sin((general_timer.ElapsedMilliseconds + randomizer.Next(150)) / 75.0) * 0.15 * 255));
                    byte green          = 0;

                    if (green_adjusted > 255)
                    {
                        green = 255;
                    }
                    else if (green_adjusted < 0)
                    {
                        green = 0;
                    }
                    else
                    {
                        green = (byte)green_adjusted;
                    }

                    int  blue_adjusted = (int)((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).burning_color.B + (Math.Cos((general_timer.ElapsedMilliseconds + randomizer.Next(225)) / 75.0) * 0.15 * 255));
                    byte blue          = 0;

                    if (blue_adjusted > 255)
                    {
                        blue = 255;
                    }
                    else if (blue_adjusted < 0)
                    {
                        blue = 0;
                    }
                    else
                    {
                        blue = (byte)blue_adjusted;
                    }

                    burncolor = Color.FromArgb(burnamount, red, green, blue);
                }

                burning_layer.Fill(burncolor);

                if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).burning_peripheral_use)
                {
                    burning_layer.Set(Devices.DeviceKeys.Peripheral, burncolor);
                }
                layers.Enqueue(burning_layer);
            }

            //Update Flashed
            if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).flashbang_enabled && flashamount > 0)
            {
                EffectLayer flashed_layer = new EffectLayer("CSGO - Flashed");
                double      flash_percent = (double)flashamount / 255.0;

                Color flash_color = Color.FromArgb(flashamount, (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).flash_color);

                flashed_layer.Fill(flash_color);

                if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).flashbang_peripheral_use)
                {
                    flashed_layer.Set(Devices.DeviceKeys.Peripheral, flash_color);
                }
                layers.Enqueue(flashed_layer);
            }

            //Update Typing Keys
            if ((Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).typing_enabled && current_activity == PlayerActivity.TextInput)
            {
                EffectLayer          typing_keys_layer = new EffectLayer("CSGO - Typing Keys");
                Devices.DeviceKeys[] _typingkeys       = (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).typing_sequence.keys.ToArray();
                foreach (Devices.DeviceKeys key in _typingkeys)
                {
                    typing_keys_layer.Set(key, (Global.Configuration.ApplicationProfiles[profilename].Settings as CSGOSettings).typing_color);
                }

                layers.Enqueue(typing_keys_layer);
            }


            if (general_timer.Elapsed.Seconds % this.updateRate == 0 && (general_timer.Elapsed.Seconds != this.lastUpdate))
            {
                this.lastUpdate = general_timer.Elapsed.Seconds;
            }

            //Scripts
            Global.Configuration.ApplicationProfiles[profilename].UpdateEffectScripts(layers, _game_state);

            frame.AddLayers(layers.ToArray());
        }
Exemple #30
0
        internal virtual void UpdateWrapperLights(EffectFrame frame)
        {
            Queue <EffectLayer> layers = new Queue <EffectLayer>();

            EffectLayer colorfill_layer = new EffectLayer("Aurora Wrapper - Color Fill", GetBoostedColor(last_fill_color));

            layers.Enqueue(colorfill_layer);

            EffectLayer bitmap_layer = new EffectLayer("Aurora Wrapper - Bitmap");

            Devices.DeviceKeys[] allkeys = Enum.GetValues(typeof(Devices.DeviceKeys)).Cast <Devices.DeviceKeys>().ToArray();
            foreach (var key in allkeys)
            {
                if (key == Devices.DeviceKeys.LOGO)
                {
                    bitmap_layer.Set(key, GetBoostedColor(logo));
                }
                else if (key == Devices.DeviceKeys.Peripheral)
                {
                    bitmap_layer.Set(key, GetBoostedColor(peripheral));
                }
                else if (key == Devices.DeviceKeys.G1)
                {
                    bitmap_layer.Set(key, GetBoostedColor(g1));
                }
                else if (key == Devices.DeviceKeys.G2)
                {
                    bitmap_layer.Set(key, GetBoostedColor(g2));
                }
                else if (key == Devices.DeviceKeys.G3)
                {
                    bitmap_layer.Set(key, GetBoostedColor(g3));
                }
                else if (key == Devices.DeviceKeys.G4)
                {
                    bitmap_layer.Set(key, GetBoostedColor(g4));
                }
                else if (key == Devices.DeviceKeys.G5)
                {
                    bitmap_layer.Set(key, GetBoostedColor(g5));
                }
                else
                {
                    Devices.Logitech.Logitech_keyboardBitmapKeys logi_key = Devices.Logitech.LogitechDevice.ToLogitechBitmap(key);

                    if (logi_key != Devices.Logitech.Logitech_keyboardBitmapKeys.UNKNOWN && bitmap.Length > 0)
                    {
                        bitmap_layer.Set(key, GetBoostedColor(Utils.ColorUtils.GetColorFromInt(bitmap[(int)logi_key / 4])));
                    }
                }
            }

            layers.Enqueue(bitmap_layer);

            EffectLayer effects_layer = new EffectLayer("Aurora Wrapper - Effects");

            Devices.DeviceKeys[] effect_keys = key_effects.Keys.ToArray();
            long currentTime = Utils.Time.GetMillisecondsSinceEpoch();

            foreach (var key in effect_keys)
            {
                if (key_effects[key].duration != 0 && key_effects[key].timeStarted + key_effects[key].duration <= currentTime)
                {
                    key_effects.Remove(key);
                }
                else
                {
                    if (key_effects[key] is LogiFlashSingleKey)
                    {
                        effects_layer.Set((key_effects[key] as LogiFlashSingleKey).key, GetBoostedColor((key_effects[key] as LogiFlashSingleKey).GetColor(currentTime - (key_effects[key] as LogiFlashSingleKey).timeStarted)));
                    }
                    else if (key_effects[key] is LogiPulseSingleKey)
                    {
                        effects_layer.Set((key_effects[key] as LogiPulseSingleKey).key, GetBoostedColor((key_effects[key] as LogiPulseSingleKey).GetColor(currentTime - (key_effects[key] as LogiPulseSingleKey).timeStarted)));
                    }
                    else
                    {
                        effects_layer.Set((key_effects[key] as KeyEffect).key, GetBoostedColor((key_effects[key] as KeyEffect).GetColor(currentTime - (key_effects[key] as KeyEffect).timeStarted)));
                    }
                }
            }

            layers.Enqueue(effects_layer);

            EffectLayer entire_effect_layer = new EffectLayer("Aurora Wrapper - EntireKB effect");

            if (current_effect != null)
            {
                if (current_effect is LogiFlashLighting)
                {
                    (current_effect as LogiFlashLighting).SetEffect(entire_effect_layer, currentTime - (current_effect as LogiFlashLighting).timeStarted);
                }
                else if (current_effect is LogiPulseLighting)
                {
                    (current_effect as LogiPulseLighting).SetEffect(entire_effect_layer, currentTime - (current_effect as LogiPulseLighting).timeStarted);
                }
                else
                {
                    current_effect.SetEffect(entire_effect_layer, currentTime - current_effect.timeStarted);
                }
            }

            layers.Enqueue(entire_effect_layer);

            frame.AddLayers(layers.ToArray());
        }