Exemplo n.º 1
0
        public async Task RunRandomProbabilityForUser(GameCommandBase command, UserViewModel user, int bet, UserCurrencyViewModel currency)
        {
            GameOutcomeGroup bestGroup = this.Groups.First();

            foreach (GameOutcomeGroup group in this.Groups)
            {
                if (group.IsObtainableByUser(user) && group.GetEvaluatedTestPayout() > bestGroup.GetEvaluatedTestPayout())
                {
                    bestGroup = group;
                }
            }

            GameOutcomeProbability selectedProbability = this.SelectRandomProbability(bestGroup.Probabilities);
            int payout = selectedProbability.EvaluatePayout(bet);

            user.Data.AddCurrencyAmount(currency, payout);

            GameOutcome outcome = this.Outcomes.FirstOrDefault(o => o.Name.Equals(selectedProbability.OutcomeName));

            if (outcome != null)
            {
                await command.RunCommand(outcome.ResultCommand, user, payout);
            }
            else
            {
                await command.RunCommand(this.LoseLeftoverCommand, user, payout);
            }
        }
Exemplo n.º 2
0
        public HeistGameCommand(UserCurrencyViewModel currency)
            : base("Heist", new List <string>() { "heist" }, new RequirementViewModel(role: new RoleRequirementViewModel(MixerRoleEnum.User),
                                                                                      cooldown: new CooldownRequirementViewModel(CooldownTypeEnum.Global, 60), currency: new CurrencyRequirementViewModel(currency, CurrencyRequirementTypeEnum.MinimumOnly, 10)),
                   new List <GameOutcome>(), new List <GameOutcomeGroup>(), null, gameLength: 30, minimumParticipants: 2)
        {
            this.GameStartedCommand    = PreMadeGameCommandHelper.CreateCustomChatCommand("@$username is starting a heist! Type \"!heist <BET>\" in chat to join in!");
            this.GameEndedCommand      = PreMadeGameCommandHelper.CreateCustomChatCommand("The cops have shown up! Everyone from the heist scatters with whatever they were able to get...");
            this.UserJoinedCommand     = PreMadeGameCommandHelper.CreateCustomWhisperChatCommand("You've hopped into the heist van! Let's see if you can pull it off...");
            this.NotEnoughUsersCommand = PreMadeGameCommandHelper.CreateCustomChatCommand("Apparently not enough people wanted to join @$username...");

            this.Outcomes.Add(new GameOutcome("Win", PreMadeGameCommandHelper.CreateCustomWhisperChatCommand("You made out successfully with $gamepayout!")));
            this.Outcomes.Add(new GameOutcome("Super Win", PreMadeGameCommandHelper.CreateCustomWhisperChatCommand("You made out like a SUPER BANDIT with $gamepayout!")));

            GameOutcomeGroup userGroup = new GameOutcomeGroup(MixerRoleEnum.User);

            userGroup.Probabilities.Add(new GameOutcomeProbability(40, 25, "Win"));
            userGroup.Probabilities.Add(new GameOutcomeProbability(10, 75, "Super Win"));
            this.Groups.Add(userGroup);

            GameOutcomeGroup subscriberGroup = new GameOutcomeGroup(MixerRoleEnum.Subscriber);

            subscriberGroup.Probabilities.Add(new GameOutcomeProbability(40, 25, "Win"));
            subscriberGroup.Probabilities.Add(new GameOutcomeProbability(10, 75, "Super Win"));
            this.Groups.Add(subscriberGroup);

            GameOutcomeGroup modGroup = new GameOutcomeGroup(MixerRoleEnum.Mod);

            modGroup.Probabilities.Add(new GameOutcomeProbability(40, 25, "Win"));
            modGroup.Probabilities.Add(new GameOutcomeProbability(10, 75, "Super Win"));
            this.Groups.Add(modGroup);

            this.LoseLeftoverCommand = PreMadeGameCommandHelper.CreateCustomWhisperChatCommand("Tough luck, the cops caught you before you could get anything good!");
        }
Exemplo n.º 3
0
        public SpinWheelGameCommand(UserCurrencyViewModel currency)
            : base("Spin Wheel", new List <string>() { "spin" }, UserRole.User, 15, new UserCurrencyRequirementViewModel(currency, 1, 100),
                   CurrencyRequirementTypeEnum.MinimumAndMaximum, new List <GameOutcome>(), new List <GameOutcomeGroup>(), null)
        {
            this.Outcomes.Add(new GameOutcome("Win", PreMadeGameCommandHelper.CreateCustomChatCommand("@$username won $gamepayout $gamecurrencyname!")));

            GameOutcomeGroup userGroup = new GameOutcomeGroup(UserRole.User);

            userGroup.Probabilities.Add(new GameOutcomeProbability(50, 25, "Win"));
            this.Groups.Add(userGroup);

            GameOutcomeGroup subscriberGroup = new GameOutcomeGroup(UserRole.Subscriber);

            subscriberGroup.Probabilities.Add(new GameOutcomeProbability(50, 25, "Win"));
            this.Groups.Add(subscriberGroup);

            GameOutcomeGroup modGroup = new GameOutcomeGroup(UserRole.Mod);

            modGroup.Probabilities.Add(new GameOutcomeProbability(50, 25, "Win"));
            this.Groups.Add(modGroup);

            this.LoseLeftoverCommand = PreMadeGameCommandHelper.CreateCustomChatCommand("Sorry @$username, you lost the spin!");
        }
Exemplo n.º 4
0
        public SpinWheelGameCommand(UserCurrencyViewModel currency)
            : base("Spin Wheel", new List <string>() { "spin" }, new RequirementViewModel(role: new RoleRequirementViewModel(MixerRoleEnum.User),
                                                                                          cooldown: new CooldownRequirementViewModel(CooldownTypeEnum.Global, 15), currency: new CurrencyRequirementViewModel(currency, 1, 100)),
                   new List <GameOutcome>(), new List <GameOutcomeGroup>(), null)
        {
            this.Outcomes.Add(new GameOutcome("Win", PreMadeGameCommandHelper.CreateCustomChatCommand("@$username won $gamepayout $gamecurrencyname!")));

            GameOutcomeGroup userGroup = new GameOutcomeGroup(MixerRoleEnum.User);

            userGroup.Probabilities.Add(new GameOutcomeProbability(50, 25, "Win"));
            this.Groups.Add(userGroup);

            GameOutcomeGroup subscriberGroup = new GameOutcomeGroup(MixerRoleEnum.Subscriber);

            subscriberGroup.Probabilities.Add(new GameOutcomeProbability(50, 25, "Win"));
            this.Groups.Add(subscriberGroup);

            GameOutcomeGroup modGroup = new GameOutcomeGroup(MixerRoleEnum.Mod);

            modGroup.Probabilities.Add(new GameOutcomeProbability(50, 25, "Win"));
            this.Groups.Add(modGroup);

            this.LoseLeftoverCommand = PreMadeGameCommandHelper.CreateCustomChatCommand("Sorry @$username, you lost the spin!");
        }