예제 #1
0
        private String GetRankUpMessage(ChatMessage message, Player player, IApplicationContext context, out Priority priority)
        {
            priority = Priority.Low;

            if (RanksToPoints.TryGetValue(player.Rank, out Int32 pointsToRank))
            {
                Rank nextRank = player.Rank.Next();

                if (player.Points >= pointsToRank)
                {
                    if (nextRank == Rank.None)
                    {
                        if (player.HasUnlockedAllRecipes())
                        {
                            HeistManager.LeaveAllHeists(context, player);
                            // Prestige instead of rank up
                            player.ResetRank();
                            player.Prestige++;
                            context.SaveChanges();
                            var positiveEmotes = EmoteManager.Get(message.Channel, EmoteCategory.Positive);
                            priority = Priority.Medium;
                            return($"{Random.NextElement(positiveEmotes)} You prestiged back to {Rank.Bronze} and have gained a permanent {(Int32)(PrestigeBonus * 100)}% cheese gain boost. {Random.NextElement(positiveEmotes)}");
                        }

                        return($"You need to buy all cheese recipes in order to prestige back to {Rank.Bronze} rank. " +
                               $"You will lose all your cheese and upgrades, but will gain a permanent {(Int32)(PrestigeBonus * 100)}% bonus on your cheese gains.");
                    }

                    player.Points -= pointsToRank;
                    player.Rank    = nextRank;
                    context.SaveChanges();
                    priority = Priority.Medium;

                    return($"You ranked up to {nextRank}. {Random.NextElement(EmoteManager.Get(message.Channel, EmoteCategory.Positive))} (-{pointsToRank} cheese)");
                }

                var pointsNeededToRank = pointsToRank - player.Points;
                if (nextRank == Rank.None)
                {
                    return($"You need {pointsNeededToRank} more cheese in order to prestige back to {Rank.Bronze} rank. " +
                           $"You will lose all your cheese and upgrades, but will gain a permanent {(Int32)(PrestigeBonus * 100)}% bonus on your cheese gains.");
                }

                return($"You need {pointsNeededToRank} more cheese in order to rank up to {nextRank}.");
            }

            return($"Uh oh, you broke something. You have an invalid rank of {player.Rank}.");
        }
예제 #2
0
        private static String GetRankMessage(Player player)
        {
            var nextRank = player.Rank.Next();

            if (RanksToPoints.TryGetValue(player.Rank, out Int32 pointsToRank))
            {
                var nextRankInformation = new StringBuilder("You are currently in ")
                                          .Append(player.Rank)
                                          .Append(" rank. ");

                if (pointsToRank > player.Points)
                {
                    nextRankInformation
                    .Append("You need ")
                    .Append(pointsToRank - player.Points)
                    .Append(" more cheese to rankup to ");
                }
                else
                {
                    nextRankInformation
                    .Append("You have enough cheese (")
                    .Append(pointsToRank)
                    .Append(") to rankup right now to ");
                }

                if (nextRank == Rank.None)
                {
                    nextRankInformation
                    .Append("prestige back to ")
                    .Append(Rank.Bronze)
                    .Append(" rank. You will lose all your cheese and upgrades, but will gain a permanent ")
                    .Append((Int32)(PrestigeBonus * 100))
                    .Append("% bonus on your cheese gains.");
                }
                else
                {
                    nextRankInformation
                    .Append(nextRank)
                    .Append(" rank.");
                }

                return(nextRankInformation.ToString());
            }

            return($"Uh oh, you broke something. You have an invalid rank of {player.Rank}.");
        }