public DuelGameEditorControl(DuelGameCommand command)
        {
            InitializeComponent();

            this.existingCommand = command;
            this.viewModel       = new DuelGameEditorControlViewModel(command);
        }
Ejemplo n.º 2
0
        private static async Task Version31Upgrade(int version, string filePath)
        {
            if (version < 31)
            {
                DesktopChannelSettings settings = await SerializerHelper.DeserializeFromFile <DesktopChannelSettings>(filePath);

                await ChannelSession.Services.Settings.Initialize(settings);

                settings.GiveawayStartedReminderCommand = CustomCommand.BasicChatCommand("Giveaway Started/Reminder", "A giveaway has started for $giveawayitem! Type $giveawaycommand in chat in the next $giveawaytimelimit minute(s) to enter!");

                foreach (GameCommandBase command in settings.GameCommands)
                {
                    if (command is GroupGameCommand)
                    {
                        GroupGameCommand groupCommand = (GroupGameCommand)command;
                        groupCommand.NotEnoughPlayersCommand = CustomCommand.BasicChatCommand("Game Sub-Command", "@$username couldn't get enough users to join in...");
                    }
                    else if (command is DuelGameCommand)
                    {
                        DuelGameCommand duelCommand = (DuelGameCommand)command;
                        duelCommand.NotAcceptedCommand = CustomCommand.BasicChatCommand("Game Sub-Command", "@$targetusername did not respond in time...");
                    }
                }

                await ChannelSession.Services.Settings.Save(settings);
            }
        }
        public override void SaveGameCommand()
        {
            int.TryParse(this.TimeLimitTextBox.Text, out int timeLimit);
            int.TryParse(this.UserPercentageTextBox.Text, out int userChance);
            int.TryParse(this.SubscriberPercentageTextBox.Text, out int subscriberChance);
            int.TryParse(this.ModPercentageTextBox.Text, out int modChance);

            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 DuelGameCommand(this.CommandDetailsControl.GameName, this.CommandDetailsControl.ChatTriggers,
                                                             this.CommandDetailsControl.GetRequirements(), new GameOutcome("Success", 1, successRoleProbabilities, this.successOutcomeCommand),
                                                             new GameOutcome("Failure", 0, failRoleProbabilities, this.failOutcomeCommand), this.startedCommand, timeLimit);

            if (this.existingCommand != null)
            {
                ChannelSession.Settings.GameCommands.Remove(this.existingCommand);
                newCommand.ID = this.existingCommand.ID;
            }
            ChannelSession.Settings.GameCommands.Add(newCommand);
        }
        public DuelGameEditorControlViewModel(DuelGameCommand command)
        {
            this.existingCommand = command;

            this.TimeLimit            = this.existingCommand.TimeLimit;
            this.UserPercentage       = this.existingCommand.SuccessfulOutcome.RoleProbabilities[MixerRoleEnum.User];
            this.SubscriberPercentage = this.existingCommand.SuccessfulOutcome.RoleProbabilities[MixerRoleEnum.Subscriber];
            this.ModPercentage        = this.existingCommand.SuccessfulOutcome.RoleProbabilities[MixerRoleEnum.Mod];

            this.StartedCommand        = this.existingCommand.StartedCommand;
            this.NotAcceptedCommand    = this.existingCommand.NotAcceptedCommand;
            this.SuccessOutcomeCommand = this.existingCommand.SuccessfulOutcome.Command;
            this.FailOutcomeCommand    = this.existingCommand.FailedOutcome.Command;
        }
Ejemplo n.º 5
0
        public override void SaveGameCommand(string name, IEnumerable <string> triggers, RequirementViewModel requirements)
        {
            Dictionary <UserRoleEnum, int> successRoleProbabilities = new Dictionary <UserRoleEnum, int>()
            {
                { UserRoleEnum.User, this.UserPercentage }, { UserRoleEnum.Subscriber, this.SubscriberPercentage }, { UserRoleEnum.Mod, this.ModPercentage }
            };
            Dictionary <UserRoleEnum, int> failRoleProbabilities = new Dictionary <UserRoleEnum, int>()
            {
                { UserRoleEnum.User, 100 - this.UserPercentage }, { UserRoleEnum.Subscriber, 100 - this.SubscriberPercentage }, { UserRoleEnum.Mod, 100 - this.ModPercentage }
            };

            GameCommandBase newCommand = new DuelGameCommand(name, triggers, requirements, new GameOutcome("Success", 1, successRoleProbabilities, this.SuccessOutcomeCommand),
                                                             new GameOutcome("Failure", 0, failRoleProbabilities, this.FailOutcomeCommand), this.StartedCommand, this.TimeLimit, this.NotAcceptedCommand);

            this.SaveGameCommand(newCommand, this.existingCommand);
        }
 public DuelGameEditorControl(DuelGameCommand command)
     : this()
 {
     this.existingCommand = command;
 }