Example #1
0
        public override void SaveGameCommand(string name, IEnumerable <string> triggers, RequirementViewModel requirements)
        {
            this.UserPayout       = this.UserPayout / 100.0;
            this.SubscriberPayout = this.SubscriberPayout / 100.0;
            this.ModPayout        = this.ModPayout / 100.0;

            Dictionary <MixerRoleEnum, double> successRolePayouts = new Dictionary <MixerRoleEnum, double>()
            {
                { MixerRoleEnum.User, this.UserPayout }, { MixerRoleEnum.Subscriber, this.SubscriberPayout }, { MixerRoleEnum.Mod, this.ModPayout }
            };
            Dictionary <MixerRoleEnum, int> successRoleProbabilities = new Dictionary <MixerRoleEnum, int>()
            {
                { MixerRoleEnum.User, this.UserProbability }, { MixerRoleEnum.Subscriber, this.SubscriberProbability }, { MixerRoleEnum.Mod, this.ModProbability }
            };
            Dictionary <MixerRoleEnum, int> failRoleProbabilities = new Dictionary <MixerRoleEnum, int>()
            {
                { MixerRoleEnum.User, 100 - this.UserProbability }, { MixerRoleEnum.Subscriber, 100 - this.SubscriberProbability }, { MixerRoleEnum.Mod, 100 - this.ModProbability }
            };

            GameCommandBase newCommand = new HeistGameCommand(name, triggers, requirements, this.MinimumParticipants, this.TimeLimit, this.StartedCommand, this.UserJoinCommand,
                                                              new GameOutcome("Success", successRolePayouts, successRoleProbabilities, this.UserSuccessCommand), new GameOutcome("Failure", 0, failRoleProbabilities, this.UserFailCommand),
                                                              this.AllSucceedCommand, this.TopThirdsSucceedCommand, this.MiddleThirdsSucceedCommand, this.LowThirdsSucceedCommand, this.NoneSucceedCommand, this.NotEnoughPlayersCommand);

            if (this.existingCommand != null)
            {
                ChannelSession.Settings.GameCommands.Remove(this.existingCommand);
                newCommand.ID = this.existingCommand.ID;
            }
            ChannelSession.Settings.GameCommands.Add(newCommand);
        }
Example #2
0
        public HeistGameEditorControlViewModel(HeistGameCommand command)
        {
            this.existingCommand = command;

            this.MinimumParticipants   = this.existingCommand.MinimumParticipants;
            this.TimeLimit             = this.existingCommand.TimeLimit;
            this.UserPayout            = (this.existingCommand.UserSuccessOutcome.RolePayouts[MixerRoleEnum.User] * 100);
            this.SubscriberPayout      = (this.existingCommand.UserSuccessOutcome.RolePayouts[MixerRoleEnum.Subscriber] * 100);
            this.ModPayout             = (this.existingCommand.UserSuccessOutcome.RolePayouts[MixerRoleEnum.Mod] * 100);
            this.UserProbability       = this.existingCommand.UserSuccessOutcome.RoleProbabilities[MixerRoleEnum.User];
            this.SubscriberProbability = this.existingCommand.UserSuccessOutcome.RoleProbabilities[MixerRoleEnum.Subscriber];
            this.ModProbability        = this.existingCommand.UserSuccessOutcome.RoleProbabilities[MixerRoleEnum.Mod];

            this.StartedCommand = this.existingCommand.StartedCommand;

            this.UserJoinCommand         = this.existingCommand.UserJoinCommand;
            this.NotEnoughPlayersCommand = this.existingCommand.NotEnoughPlayersCommand;

            this.UserSuccessCommand = this.existingCommand.UserSuccessOutcome.Command;
            this.UserFailCommand    = this.existingCommand.UserFailOutcome.Command;

            this.AllSucceedCommand          = this.existingCommand.AllSucceedCommand;
            this.TopThirdsSucceedCommand    = this.existingCommand.TopThirdsSucceedCommand;
            this.MiddleThirdsSucceedCommand = this.existingCommand.MiddleThirdsSucceedCommand;
            this.LowThirdsSucceedCommand    = this.existingCommand.LowThirdsSucceedCommand;
            this.NoneSucceedCommand         = this.existingCommand.NoneSucceedCommand;
        }
        public HeistGameEditorControl(HeistGameCommand command)
        {
            InitializeComponent();

            this.existingCommand = command;
            this.viewModel       = new HeistGameEditorControlViewModel(command);
        }
Example #4
0
        public override void SaveGameCommand()
        {
            int.TryParse(this.MinimumParticipantsTextBox.Text, out int minimumParticipants);
            int.TryParse(this.TimeLimitTextBox.Text, out int timeLimit);

            double.TryParse(this.UserPayoutTextBox.Text, out double userPayout);
            double.TryParse(this.SubscriberPayoutTextBox.Text, out double subscriberPayout);
            double.TryParse(this.ModPayoutTextBox.Text, out double modPayout);

            int.TryParse(this.UserPercentageTextBox.Text, out int userChance);
            int.TryParse(this.SubscriberPercentageTextBox.Text, out int subscriberChance);
            int.TryParse(this.ModPercentageTextBox.Text, out int modChance);

            userPayout       = userPayout / 100.0;
            subscriberPayout = subscriberPayout / 100.0;
            modPayout        = modPayout / 100.0;

            Dictionary <MixerRoleEnum, double> successRolePayouts = new Dictionary <MixerRoleEnum, double>()
            {
                { MixerRoleEnum.User, userPayout }, { MixerRoleEnum.Subscriber, subscriberPayout }, { MixerRoleEnum.Mod, modPayout }
            };
            Dictionary <MixerRoleEnum, int> successRoleProbabilities = new Dictionary <MixerRoleEnum, int>()
            {
                { MixerRoleEnum.User, userChance }, { MixerRoleEnum.Subscriber, subscriberChance }, { MixerRoleEnum.Mod, modChance }
            };
            Dictionary <MixerRoleEnum, int> failRoleProbabilities = new Dictionary <MixerRoleEnum, int>()
            {
                { MixerRoleEnum.User, 100 - userChance }, { MixerRoleEnum.Subscriber, 100 - subscriberChance }, { MixerRoleEnum.Mod, 100 - modChance }
            };

            GameCommandBase newCommand = new HeistGameCommand(this.CommandDetailsControl.GameName, this.CommandDetailsControl.ChatTriggers,
                                                              this.CommandDetailsControl.GetRequirements(), minimumParticipants, timeLimit, this.startedCommand, this.userJoinCommand,
                                                              new GameOutcome("Success", successRolePayouts, successRoleProbabilities, this.userSuccessCommand), new GameOutcome("Failure", 0, failRoleProbabilities, this.userFailCommand),
                                                              this.allSucceedCommand, this.topThirdsSucceedCommand, this.middleThirdsSucceedCommand, this.lowThirdsSucceedCommand, this.noneSucceedCommand);

            if (this.existingCommand != null)
            {
                ChannelSession.Settings.GameCommands.Remove(this.existingCommand);
                newCommand.ID = this.existingCommand.ID;
            }
            ChannelSession.Settings.GameCommands.Add(newCommand);
        }
        private async void AddPreMadeGameButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.PreMadeGamesComboBox.SelectedIndex >= 0)
            {
                await this.Window.RunAsyncOperation(async() =>
                {
                    string gameName = (string)this.PreMadeGamesComboBox.SelectedItem;
                    if (ChannelSession.Settings.GameCommands.Any(c => c.Name.Equals(gameName)))
                    {
                        await MessageBoxHelper.ShowMessageDialog("This game already exist in your game list");
                        return;
                    }

                    UserCurrencyViewModel currency = ChannelSession.Settings.Currencies.Values.First();
                    GameCommandBase game           = null;
                    switch (gameName)
                    {
                    case "Spin Wheel": game = new SpinWheelGameCommand(currency); break;

                    case "Heist": game = new HeistGameCommand(currency); break;

                    case "Russian Roulette": game = new RussianRouletteGameCommand(currency); break;

                    case "Charity": game = new CharityGameCommand(currency); break;

                    case "Give": game = new GiveGameCommand(currency); break;
                    }

                    ChannelSession.Settings.GameCommands.Add(game);
                    await ChannelSession.SaveSettings();

                    this.PreMadeGamesComboBox.SelectedIndex = -1;

                    this.RefreshList();
                });
            }
        }
Example #6
0
 public HeistGameEditorControl(HeistGameCommand command)
     : this()
 {
     this.existingCommand = command;
 }