Beispiel #1
0
        private void TickTwitchListener()
        {
            if (Config.Instance.IsTwitchVoting)
            {
                // Hack to fix Windows' broken-ass progress bar handling
                int value = Math.Max(1, (int)Stopwatch.ElapsedMilliseconds);
                progressBarTwitch.Value = Math.Max(progressBarTwitch.Maximum - value, 0);
                progressBarTwitch.Value = Math.Max(progressBarTwitch.Maximum - value - 1, 0);

                if (!Config.Instance.TwitchAllowVoting && Stopwatch.ElapsedMilliseconds - elapsedCount > 100)
                {
                    long remaining  = Math.Max(0, progressBarTwitch.Maximum - Stopwatch.ElapsedMilliseconds);
                    int  iRemaining = (int)((float)remaining / progressBarTwitch.Maximum * 1000f);

                    ProcessHooker.SendEffectToGame("time", iRemaining.ToString());

                    elapsedCount = (int)Stopwatch.ElapsedMilliseconds;
                }
            }
            else
            {
                // Hack to fix Windows' broken-ass progress bar handling
                int value = Math.Max(1, (int)Stopwatch.ElapsedMilliseconds);
                progressBarTwitch.Value = Math.Min(value, progressBarTwitch.Maximum);
                progressBarTwitch.Value = Math.Min(value - 1, progressBarTwitch.Maximum);
            }
        }
Beispiel #2
0
        private void TickMain()
        {
            if (!Config.Instance.Enabled)
            {
                return;
            }

            int value = Math.Max(1, (int)Stopwatch.ElapsedMilliseconds);

            // Hack to fix Windows' broken-ass progress bar handling
            progressBarMain.Value = Math.Min(value, progressBarMain.Maximum);
            progressBarMain.Value = Math.Min(value - 1, progressBarMain.Maximum);

            if (Stopwatch.ElapsedMilliseconds - elapsedCount > 100)
            {
                long remaining  = Math.Max(0, Config.Instance.MainCooldown - Stopwatch.ElapsedMilliseconds);
                int  iRemaining = (int)((float)remaining / Config.Instance.MainCooldown * 1000f);

                ProcessHooker.SendEffectToGame("time", iRemaining.ToString());

                elapsedCount = (int)Stopwatch.ElapsedMilliseconds;
            }

            if (Stopwatch.ElapsedMilliseconds >= Config.Instance.MainCooldown)
            {
                progressBarMain.Value = 0;
                CallEffect();
                elapsedCount = 0;
                Stopwatch.Restart();
            }
        }
Beispiel #3
0
        private void TickMain()
        {
            if (!Config.Instance().Enabled)
            {
                return;
            }

            int value = Math.Max(1, (int)stopwatch.ElapsedMilliseconds);

            // Hack to fix Windows' broken-ass progress bar handling
            progressBarMain.Value = Math.Min(value, progressBarMain.Maximum);
            progressBarMain.Value = Math.Min(value - 1, progressBarMain.Maximum);

            if (stopwatch.ElapsedMilliseconds - elapsedCount > 100)
            {
                long remaining = Math.Max(0, Config.Instance().MainCooldown - stopwatch.ElapsedMilliseconds);

                ProcessHooker.SendEffectToGame("time", $"{remaining},{Config.Instance().MainCooldown}");

                elapsedCount = (int)stopwatch.ElapsedMilliseconds;
            }

            if (stopwatch.ElapsedMilliseconds >= Config.Instance().MainCooldown)
            {
                progressBarMain.Value = 0;
                CallEffect();
                elapsedCount = 0;
                stopwatch.Restart();
            }
        }
Beispiel #4
0
 private void ButtonGenericTest_Click(object sender, EventArgs e)
 {
     ProcessHooker.SendEffectToGame("effect", "never_wanted", 5000, "Never Wanted", "lordmau5");
     ProcessHooker.SendEffectToGame("effect", "weapon_set_1", 5000, "Weapon Set 1", "senor stendec");
     ProcessHooker.SendEffectToGame("effect", "one_hit_ko", 5000, "One Hit K.O.", "daniel salvation");
     //ProcessHooker.SendEffectToGame("timed_effect", "fail_mission", 60000, "Fail Current Mission", "lordmau5");
 }
Beispiel #5
0
        private void TrySetupAutostart()
        {
            if (ProcessHooker.HasExited()) // Make sure we are hooked
            {
                ProcessHooker.HookProcess();
            }

            if (ProcessHooker.HasExited())
            {
                MessageBox.Show("The game needs to be running!", "Error");

                buttonAutoStart.Enabled = Config.Instance().IsTwitchMode&& twitch?.Client != null && twitch.Client.IsConnected;
                buttonAutoStart.Text    = "Auto-Start";

                if (!Config.Instance().ContinueTimer)
                {
                    SetEnabled(false);

                    elapsedCount = 0;
                    stopwatch.Reset();

                    buttonMainToggle.Enabled   = true;
                    buttonTwitchToggle.Enabled = twitch?.Client != null && twitch.Client.IsConnected;
                }
                return;
            }

            ProcessHooker.AttachExitedMethod((sender, e) => buttonAutoStart.Invoke(new Action(() =>
            {
                buttonAutoStart.Enabled = Config.Instance().IsTwitchMode&& twitch?.Client != null && twitch.Client.IsConnected;
                buttonAutoStart.Text    = "Auto-Start";

                if (!Config.Instance().ContinueTimer)
                {
                    SetEnabled(false);

                    elapsedCount = 0;
                    stopwatch.Reset();

                    buttonMainToggle.Enabled   = true;
                    buttonTwitchToggle.Enabled = twitch?.Client != null && twitch.Client.IsConnected;
                }

                ProcessHooker.CloseProcess();
            })));

            buttonAutoStart.Enabled = false;
            buttonAutoStart.Text    = "Waiting...";

            Config.Instance().Enabled = false;
            autoStartTimer.Start();
            buttonMainToggle.Enabled   = false;
            buttonTwitchToggle.Enabled = twitch?.Client != null && twitch.Client.IsConnected;
        }
Beispiel #6
0
        private void TrySetupAutostart()
        {
            if (ProcessHooker.HasExited()) // Make sure we are hookedtr
            {
                ProcessHooker.HookProcess();
            }

            if (ProcessHooker.HasExited())
            {
                buttonAutoStart.Enabled = true;
                buttonAutoStart.Text    = "Auto-Start";

                if (!Config.Instance.ContinueTimer)
                {
                    SetEnabled(false);

                    elapsedCount = 0;
                    Stopwatch.Reset();

                    buttonMainToggle.Enabled = true;
                }
                return;
            }

            ProcessHooker.AttachExitedMethod((sender, e) => buttonAutoStart.Invoke(new Action(() =>
            {
                buttonAutoStart.Enabled = true;
                buttonAutoStart.Text    = "Auto-Start";

                if (!Config.Instance.ContinueTimer)
                {
                    SetEnabled(false);

                    elapsedCount = 0;
                    Stopwatch.Reset();

                    buttonMainToggle.Enabled = true;
                }

                ProcessHooker.CloseProcess();
            })));

            buttonAutoStart.Enabled = false;
            buttonAutoStart.Text    = "Waiting...";

            Config.Instance.Enabled = false;
            AutoStartTimer.Start();
            buttonMainToggle.Enabled = false;
        }
Beispiel #7
0
        public void SendEffectToGame(string type, string function, int duration = -1, string description = "", int multiplier = 1)
        {
            if (duration == -1)
            {
                duration = Config.GetEffectDuration();
            }

            duration *= multiplier;

            if (string.IsNullOrEmpty(description))
            {
                description = GetDescription();
            }

            ProcessHooker.SendEffectToGame(type, function, duration, description, Voter, Config.Instance().TwitchVotingMode == 2 ? rapidFire : 0);
        }
Beispiel #8
0
        public void SendEffectToGame(string type, string function, int duration = -1, string description = "", int multiplier = 1)
        {
            if (duration == -1)
            {
                duration = Config.GetEffectDuration();
            }

            duration *= multiplier;

            if (string.IsNullOrEmpty(description))
            {
                description = GetDescription();
            }

            ProcessHooker.SendEffectToGame(type, function, duration, description);
        }
Beispiel #9
0
        private void AutoStartTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            if (ProcessHooker.HasExited())
            {
                return;
            }

            if (Config.Instance.Enabled)
            {
                return;
            }

            MemoryHelper.Read((IntPtr)0xA4ED04, out int new_introState);
            MemoryHelper.Read((IntPtr)0xB7CB84, out int playingTime);

            if (introState == 0 && new_introState == 1 && playingTime < 1000 * 60)
            {
                buttonAutoStart.Invoke(new Action(() => SetAutostart()));
            }

            introState = new_introState;
        }
        public void SendEffectToGame(string type, string function, int duration = -1, string description = "")
        {
            if (Duration > 0)
            {
                duration = Duration;
            }
            else
            {
                if (duration == -1)
                {
                    duration = Config.GetEffectDuration();
                }
                duration = (int)Math.Round(duration * Multiplier);
            }

            if (string.IsNullOrEmpty(description))
            {
                description = GetDescription();
            }

            ProcessHooker.SendEffectToGame(type, function, duration, description, Voter, Shared.TwitchVotingMode == 2 ? rapidFire : 0);
        }
        public void SendEffectToGame(string type, string function, int duration = -1, string description = "")
        {
            if (Duration > 0)
            {
                duration = Duration;
            }
            else
            {
                if (duration == -1)
                {
                    duration = Config.GetEffectDuration();
                }
                duration = (int)Math.Round(duration * Multiplier);
            }

            if (string.IsNullOrEmpty(description))
            {
                description = GetDescription();
            }

            int rapidFire = 0;

            if (Shared.IsTwitchMode)
            {
                if (Shared.TwitchVotingMode == 2)
                {
                    rapidFire = this.rapidFire;
                }

                if (Config.Instance().Experimental_TwitchAnarchyMode)
                {
                    rapidFire = 1;
                }
            }

            ProcessHooker.SendEffectToGame(type, function, duration, description, Voter, rapidFire);
        }
Beispiel #12
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     SaveConfig();
     ProcessHooker.CloseProcess();
 }
Beispiel #13
0
        private void TickTwitchHost()
        {
            if (!Config.Instance.Enabled)
            {
                return;
            }

            if (Config.Instance.IsTwitchVoting)
            {
                if (progressBarTwitch.Maximum != Config.Instance.TwitchVotingTime)
                {
                    progressBarTwitch.Maximum = Config.Instance.TwitchVotingTime;
                }

                // Hack to fix Windows' broken-ass progress bar handling
                int value = Math.Max(1, (int)Stopwatch.ElapsedMilliseconds);
                progressBarTwitch.Value = Math.Max(progressBarTwitch.Maximum - value, 0);
                progressBarTwitch.Value = Math.Max(progressBarTwitch.Maximum - value - 1, 0);

                if (Stopwatch.ElapsedMilliseconds - elapsedCount > 100)
                {
                    long remaining  = Math.Max(0, Config.Instance.TwitchVotingTime - Stopwatch.ElapsedMilliseconds);
                    int  iRemaining = (int)((float)remaining / Config.Instance.TwitchVotingTime * 1000f);

                    ProcessHooker.SendEffectToGame("time", iRemaining.ToString());

                    elapsedCount = (int)Stopwatch.ElapsedMilliseconds;
                }

                if (Stopwatch.ElapsedMilliseconds >= Config.Instance.TwitchVotingTime)
                {
                    ProcessHooker.SendEffectToGame("time", "0");
                    elapsedCount = 0;

                    progressBarTwitch.Value   = 0;
                    progressBarTwitch.Maximum = Config.Instance.TwitchVotingCooldown;

                    Stopwatch.Restart();
                    Config.Instance.IsTwitchVoting = false;

                    labelTwitchCurrentMode.Text = "Current Mode: Cooldown";

                    VotingCooldownComboBoxItem item = (VotingCooldownComboBoxItem)comboBoxVotingCooldown.SelectedItem;

                    AbstractEffect effect = Twitch.GetRandomVotedEffect(out string username);

                    Twitch.SetVoting(false, item.VotingCooldown, item.Text, effect, username);
                    if (!Config.Instance.TwitchDontActivateEffects)
                    {
                        CallEffect(effect);
                    }
                }
            }
            else
            {
                if (progressBarTwitch.Maximum != Config.Instance.TwitchVotingCooldown)
                {
                    progressBarTwitch.Maximum = Config.Instance.TwitchVotingCooldown;
                }

                // Hack to fix Windows' broken-ass progress bar handling
                int value = Math.Max(1, (int)Stopwatch.ElapsedMilliseconds);
                progressBarTwitch.Value = Math.Min(value, progressBarTwitch.Maximum);
                progressBarTwitch.Value = Math.Min(value, progressBarTwitch.Maximum);

                if (!Config.Instance.TwitchAllowVoting && Stopwatch.ElapsedMilliseconds - elapsedCount > 100)
                {
                    long remaining  = Math.Max(0, Config.Instance.TwitchVotingTime - Stopwatch.ElapsedMilliseconds);
                    int  iRemaining = (int)((float)remaining / Config.Instance.TwitchVotingTime * 1000f);

                    ProcessHooker.SendEffectToGame("time", iRemaining.ToString());

                    elapsedCount = (int)Stopwatch.ElapsedMilliseconds;
                }

                if (Stopwatch.ElapsedMilliseconds >= Config.Instance.TwitchVotingCooldown)
                {
                    if (Config.Instance.TwitchAllowVoting)
                    {
                        progressBarTwitch.Value = progressBarTwitch.Maximum = Config.Instance.TwitchVotingTime;

                        Config.Instance.IsTwitchVoting = true;

                        labelTwitchCurrentMode.Text = "Current Mode: Voting";

                        VotingTimeComboBoxItem item = (VotingTimeComboBoxItem)comboBoxVotingTime.SelectedItem;

                        Twitch.SetVoting(true, item.VotingTime, item.Text);
                    }
                    else
                    {
                        ProcessHooker.SendEffectToGame("time", "0");
                        elapsedCount = 0;

                        progressBarTwitch.Value   = 0;
                        progressBarTwitch.Maximum = Config.Instance.TwitchVotingCooldown;

                        labelTwitchCurrentMode.Text = "Current Mode: Cooldown";

                        VotingCooldownComboBoxItem item = (VotingCooldownComboBoxItem)comboBoxVotingCooldown.SelectedItem;

                        AbstractEffect effect = Twitch.GetRandomVotedEffect(out string username);

                        Twitch.SetVoting(false, item.VotingCooldown, item.Text, effect, username);
                        if (!Config.Instance.TwitchDontActivateEffects)
                        {
                            CallEffect(effect);
                        }
                    }
                    Stopwatch.Restart();
                }
            }
        }
Beispiel #14
0
 private void ButtonGenericTest_Click(object sender, EventArgs e)
 {
     //ProcessHooker.SendEffectToGame("timed_effect", "inverted_controls", 30000, "Inverted Controls");
     ProcessHooker.SendEffectToGame("timed_effect", "first_person_driver", 60000, "First Person Driver");
 }
Beispiel #15
0
        private void TickTwitch()
        {
            if (!Config.Instance().Enabled)
            {
                return;
            }

            if (Config.Instance().TwitchVotingMode == 1)
            {
                if (progressBarTwitch.Maximum != Config.Instance().TwitchVotingTime)
                {
                    progressBarTwitch.Maximum = Config.Instance().TwitchVotingTime;
                }

                // Hack to fix Windows' broken-ass progress bar handling
                int value = Math.Max(1, (int)stopwatch.ElapsedMilliseconds);
                progressBarTwitch.Value = Math.Max(progressBarTwitch.Maximum - value, 0);
                progressBarTwitch.Value = Math.Max(progressBarTwitch.Maximum - value - 1, 0);

                if (stopwatch.ElapsedMilliseconds - elapsedCount > 100)
                {
                    long remaining = Math.Max(0, Config.Instance().TwitchVotingTime - stopwatch.ElapsedMilliseconds);

                    ProcessHooker.SendEffectToGame("time", $"{remaining},{Config.Instance().TwitchVotingTime}");

                    twitch?.SendEffectVotingToGame();

                    elapsedCount = (int)stopwatch.ElapsedMilliseconds;
                }

                if (stopwatch.ElapsedMilliseconds >= Config.Instance().TwitchVotingTime)
                {
                    ProcessHooker.SendEffectToGame("time", "0");
                    elapsedCount = 0;

                    progressBarTwitch.Value   = 0;
                    progressBarTwitch.Maximum = Config.Instance().TwitchVotingCooldown;

                    stopwatch.Restart();
                    Config.Instance().TwitchVotingMode = 0;

                    labelTwitchCurrentMode.Text = "Current Mode: Cooldown";

                    if (twitch != null)
                    {
                        TwitchConnection.VotingElement element = twitch.GetRandomVotedEffect(out string username);

                        twitch.SetVoting(0, timesUntilRapidFire, element, username);
                        CallEffect(element.Effect);
                    }
                }
            }
            else if (Config.Instance().TwitchVotingMode == 2)
            {
                if (progressBarTwitch.Maximum != 1000 * 10)
                {
                    progressBarTwitch.Maximum = 1000 * 10;
                }

                // Hack to fix Windows' broken-ass progress bar handling
                int value = Math.Max(1, (int)stopwatch.ElapsedMilliseconds);
                progressBarTwitch.Value = Math.Max(progressBarTwitch.Maximum - value, 0);
                progressBarTwitch.Value = Math.Max(progressBarTwitch.Maximum - value - 1, 0);

                if (stopwatch.ElapsedMilliseconds - elapsedCount > 100)
                {
                    long remaining = Math.Max(0, (1000 * 10) - stopwatch.ElapsedMilliseconds);

                    ProcessHooker.SendEffectToGame("time", $"{remaining},10000");

                    elapsedCount = (int)stopwatch.ElapsedMilliseconds;
                }

                if (stopwatch.ElapsedMilliseconds >= 1000 * 10) // Set 10 seconds
                {
                    ProcessHooker.SendEffectToGame("time", "0");
                    elapsedCount = 0;

                    progressBarTwitch.Value   = 0;
                    progressBarTwitch.Maximum = Config.Instance().TwitchVotingCooldown;

                    stopwatch.Restart();
                    Config.Instance().TwitchVotingMode = 0;

                    labelTwitchCurrentMode.Text = "Current Mode: Cooldown";

                    twitch?.SetVoting(0, timesUntilRapidFire);
                }
            }
            else if (Config.Instance().TwitchVotingMode == 0)
            {
                if (progressBarTwitch.Maximum != Config.Instance().TwitchVotingCooldown)
                {
                    progressBarTwitch.Maximum = Config.Instance().TwitchVotingCooldown;
                }

                // Hack to fix Windows' broken-ass progress bar handling
                int value = Math.Max(1, (int)stopwatch.ElapsedMilliseconds);
                progressBarTwitch.Value = Math.Min(value + 1, progressBarTwitch.Maximum);
                progressBarTwitch.Value = Math.Min(value, progressBarTwitch.Maximum);

                if (stopwatch.ElapsedMilliseconds - elapsedCount > 100)
                {
                    long remaining = Math.Max(0, Config.Instance().TwitchVotingCooldown - stopwatch.ElapsedMilliseconds);

                    ProcessHooker.SendEffectToGame("time", $"{remaining},{Config.Instance().TwitchVotingCooldown}");

                    elapsedCount = (int)stopwatch.ElapsedMilliseconds;
                }

                if (stopwatch.ElapsedMilliseconds >= Config.Instance().TwitchVotingCooldown)
                {
                    elapsedCount = 0;

                    if (--timesUntilRapidFire == 0)
                    {
                        progressBarTwitch.Value = progressBarTwitch.Maximum = 1000 * 10;

                        timesUntilRapidFire = new Random().Next(10, 15);

                        Config.Instance().TwitchVotingMode = 2;
                        labelTwitchCurrentMode.Text = "Current Mode: Rapid-Fire";

                        twitch?.SetVoting(2, timesUntilRapidFire);
                    }
                    else
                    {
                        progressBarTwitch.Value = progressBarTwitch.Maximum = Config.Instance().TwitchVotingTime;

                        Config.Instance().TwitchVotingMode = 1;
                        labelTwitchCurrentMode.Text = "Current Mode: Voting";

                        twitch?.SetVoting(1, timesUntilRapidFire);
                    }
                    stopwatch.Restart();
                }
            }
        }
Beispiel #16
0
 private void ButtonGenericTest_Click(object sender, EventArgs e)
 {
     ProcessHooker.SendEffectToGame("effect", "set_vehicle_on_fire", 60000, "Set Vehicle On Fire");
     ProcessHooker.SendEffectToGame("timed_effect", "one_hit_ko", 60000, "One Hit K.O.", "25characterusernamehanice");
     //ProcessHooker.SendEffectToGame("timed_effect", "fail_mission", 60000, "Fail Current Mission", "lordmau5");
 }