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); } }
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(); } }
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"); }
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(); } }
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); }
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); }
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); }
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(); } } }
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"); }
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(); } } }
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"); }