Ejemplo n.º 1
0
        public void Apply(ArcadeUser user)
        {
            Var.Add(user, 1, GimiStats.TimesPlayed);

            switch (Flag)
            {
            case GimiResultFlag.Win:
            case GimiResultFlag.Gold:
                Var.Clear(user, GimiStats.CurrentCurseStreak, GimiStats.CurrentLossStreak, GimiStats.CurrentLossAmount);
                Var.Add(user, 1, GimiStats.TimesWon, GimiStats.CurrentWinStreak);
                Var.Add(user, Reward, GimiStats.TotalWon, GimiStats.CurrentWinAmount);
                Var.SetIfGreater(user, GimiStats.LongestWin, GimiStats.CurrentWinStreak);
                Var.SetIfGreater(user, GimiStats.LargestWin, GimiStats.CurrentWinAmount);

                if (Flag == GimiResultFlag.Gold)
                {
                    ItemHelper.GiveItem(user, Items.PocketLawyer);

                    if (RandomProvider.Instance.Next(0, 1001) == 1000)
                    {
                        ItemHelper.GiveItem(user, Items.PaletteGold);
                    }

                    Var.Add(user, 1, GimiStats.TimesGold, GimiStats.CurrentGoldStreak);
                    Var.SetIfGreater(user, GimiStats.LongestGold, GimiStats.CurrentGoldStreak);
                }
                else
                {
                    Var.Clear(user, GimiStats.CurrentGoldStreak);
                    Reward = CurrencyHelper.BoostValue(user, Reward, BoostType.Money);
                }

                user.Give(Reward);
                break;

            case GimiResultFlag.Lose:
            case GimiResultFlag.Curse:
                Var.Clear(user, GimiStats.CurrentGoldStreak, GimiStats.CurrentWinStreak, GimiStats.CurrentWinAmount);
                Var.Add(user, 1, GimiStats.TimesLost, GimiStats.CurrentLossStreak);
                Var.Add(user, Reward, GimiStats.TotalLost, GimiStats.CurrentLossAmount);
                Var.SetIfGreater(user, GimiStats.LongestLoss, GimiStats.CurrentLossStreak);
                Var.SetIfGreater(user, GimiStats.LargestLoss, GimiStats.CurrentLossAmount);

                if (Flag == GimiResultFlag.Curse)
                {
                    Var.Add(user, 1, GimiStats.TimesCursed, GimiStats.CurrentCurseStreak);
                    Var.SetIfGreater(user, GimiStats.LongestCurse, GimiStats.CurrentCurseStreak);
                }
                else
                {
                    Var.Clear(user, GimiStats.CurrentCurseStreak);
                    Reward = CurrencyHelper.BoostValue(user, Reward, BoostType.Money);
                }

                user.Take(Reward);
                break;
            }
        }
Ejemplo n.º 2
0
        public Message ApplyAndDisplay(ArcadeUser user)
        {
            ImmutableColor color = ImmutableColor.GammaGreen;
            string         type  = IsSuccess ? "+" : "-";
            long           value = IsSuccess ? Reward : Wager;

            user.AddToVar(TickStats.TotalBet, Wager);
            user.AddToVar(TickStats.TimesPlayed);

            user.ChipBalance -= Wager;

            switch (Flag)
            {
            case TickResultFlag.Exact:
            case TickResultFlag.Win:
                user.SetVar(TickStats.CurrentLossStreak, 0);

                user.AddToVar(TickStats.TimesWon);
                user.AddToVar(TickStats.TotalWon, Reward);

                if (ExpectedTick == ActualTick)
                {
                    user.AddToVar(TickStats.TimesWonExact);
                }

                user.AddToVar(TickStats.CurrentWinStreak);
                user.AddToVar(TickStats.CurrentWinAmount, Reward);

                Var.SetIfGreater(user, TickStats.LongestWin, TickStats.CurrentWinStreak);
                Var.SetIfGreater(user, TickStats.LargestWin, TickStats.CurrentWinAmount);
                Var.SetIfGreater(user, TickStats.LargestWinSingle, Reward);
                break;

            case TickResultFlag.Lose:
                Var.Clear(user, TickStats.CurrentWinStreak, TickStats.CurrentWinAmount);
                user.AddToVar(TickStats.TimesLost);
                user.AddToVar(TickStats.CurrentLossStreak);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(Flag));
            }

            if (IsSuccess)
            {
                user.ChipBalance += CurrencyHelper.BoostValue(user, Reward, BoostType.Chips);
            }

            string header = $"**{type} 🧩 {value:##,0}**";

            string content = Replies.GetReply(Flag, user, this);
            //GetQuote(ExpectedTick, ActualTick, Multiplier, Reward, IsSuccess);

            var embedder = new Embedder
            {
                Header = header,
                Color  = color
            };

            var builder = new MessageBuilder();

            builder.WithEmbedder(embedder)
            .WithContent(content);

            return(builder.Build());
        }
Ejemplo n.º 3
0
        public Message ApplyAndDisplay(ArcadeUser user)
        {
            var builder  = new MessageBuilder();
            var embedder = new Embedder();

            string         icon  = "💸";
            string         type  = "+";
            string         quote = Replies.GetReply(Flag, user, this);
            long           value = Reward;
            ImmutableColor color = ImmutableColor.GammaGreen;

            Var.Add(user, 1, GimiStats.TimesPlayed);

            switch (Flag)
            {
            case GimiResultFlag.Win:
            case GimiResultFlag.Gold:
                Var.Clear(user, GimiStats.CurrentCurseStreak, GimiStats.CurrentLossStreak, GimiStats.CurrentLossAmount);
                Var.Add(user, 1, GimiStats.TimesWon, GimiStats.CurrentWinStreak);
                Var.Add(user, Reward, GimiStats.TotalWon, GimiStats.CurrentWinAmount);
                Var.SetIfGreater(user, GimiStats.LongestWin, GimiStats.CurrentWinStreak);
                Var.SetIfGreater(user, GimiStats.LargestWin, GimiStats.CurrentWinAmount);

                if (Flag == GimiResultFlag.Gold)
                {
                    icon  = "💎";
                    type  = "+";
                    color = GammaPalette.Glass[Gamma.Max];

                    ItemHelper.GiveItem(user, Items.PocketLawyer);

                    if (RandomProvider.Instance.Next(0, 1001) == 1000)
                    {
                        ItemHelper.GiveItem(user, Items.PaletteGold);
                    }

                    Var.Add(user, 1, GimiStats.TimesGold, GimiStats.CurrentGoldStreak);
                    Var.SetIfGreater(user, GimiStats.LongestGold, GimiStats.CurrentGoldStreak);
                }
                else
                {
                    Var.Clear(user, GimiStats.CurrentGoldStreak);
                    Reward = CurrencyHelper.BoostValue(user, Reward, BoostType.Money);
                }
                long debt = user.Debt;
                user.Give(Reward);

                if (debt > Reward)
                {
                    icon  = "📃";
                    type  = "-";
                    quote = Replies.Recover.Length > 0 ? (string)Randomizer.Choose(Replies.Recover) : Replies.RecoverGeneric;
                }
                else if (debt > 0 && Reward - debt == 0)
                {
                    icon  = "📧";
                    type  = "";
                    quote = Replies.EvenGeneric;
                }

                break;

            case GimiResultFlag.Lose:
            case GimiResultFlag.Curse:
                type  = "-";
                color = ImmutableColor.NeonRed;

                Var.Clear(user, GimiStats.CurrentGoldStreak, GimiStats.CurrentWinStreak, GimiStats.CurrentWinAmount);
                Var.Add(user, 1, GimiStats.TimesLost, GimiStats.CurrentLossStreak);
                Var.Add(user, Reward, GimiStats.TotalLost, GimiStats.CurrentLossAmount);
                Var.SetIfGreater(user, GimiStats.LongestLoss, GimiStats.CurrentLossStreak);
                Var.SetIfGreater(user, GimiStats.LargestLoss, GimiStats.CurrentLossAmount);

                if (Flag == GimiResultFlag.Curse)
                {
                    icon  = "🌕";
                    type  = "-";
                    color = GammaPalette.Alconia[Gamma.Standard];

                    Var.Add(user, 1, GimiStats.TimesCursed, GimiStats.CurrentCurseStreak);
                    Var.SetIfGreater(user, GimiStats.LongestCurse, GimiStats.CurrentCurseStreak);
                }
                else
                {
                    Var.Clear(user, GimiStats.CurrentCurseStreak);
                    Reward = CurrencyHelper.BoostValue(user, Reward, BoostType.Money);
                }

                long balance = user.Balance;
                user.Take(Reward);

                if (balance < Reward)
                {
                    icon  = "📃";
                    type  = "+";
                    value = Reward - balance;
                    quote = Replies.Debt.Length > 0 ? (string)Randomizer.Choose(Replies.Debt) : Replies.DebtGeneric;
                }
                else if (balance > 0 && Reward - balance == 0)
                {
                    icon  = "📧";
                    value = Reward - balance;
                    type  = "";
                    quote = Replies.EvenGeneric;
                }
                break;
            }

            if (!string.IsNullOrWhiteSpace(type))
            {
                type += ' ';
            }

            string header  = $"**{type}{icon} {value:##,0}**";
            string content = $"*\"{quote}\"*";

            embedder.Header  = header;
            embedder.Color   = color;
            builder.Embedder = embedder;
            builder.Content  = content;

            return(builder.Build());
        }