예제 #1
0
        public void LoadAchievements()
        {
            AchievementDataContainer AchievementAchievements = new AchievementDataContainer(x =>
            {
                x.Name         = "achievements";
                x.Achievements = new List <IAchievement>()
                {
                    new AchievementAchievement()
                    {
                        Name             = "Underachiever",
                        Icon             = "🖍",
                        CheckAchievement = async(p) =>
                        {
                            await Task.Yield();
                            return(p.count >= 3);
                        },
                        Points = 5,
                    },
                    new AchievementAchievement()
                    {
                        Name             = "Achiever",
                        Icon             = "✏️",
                        CheckAchievement = async(p) =>
                        {
                            await Task.Yield();
                            return(p.count >= 5);
                        },
                        Points = 10,
                    },
                    new AchievementAchievement()
                    {
                        Name             = "Overachiever",
                        Icon             = "🖋️",
                        CheckAchievement = async(p) =>
                        {
                            return(p.count >= 12);
                        },
                        Points = 15,
                    },
                    new AchievementAchievement()
                    {
                        Name             = "Completionist",
                        Icon             = "🖊️",
                        CheckAchievement = async(p) =>
                        {
                            return(p.count >= 25);
                        },
                        Points = 30,
                    }
                };
            });

            AchievementDataContainer LotteryAchievements = new AchievementDataContainer(x =>
            {
                x.Name         = "lottery";
                x.Achievements = new List <IAchievement>()
                {
                    // Win a lottery > 100k
                    new ManualAchievement()
                    {
                        Name   = "Celebrator",
                        Icon   = "🍺",
                        Points = 5,
                    },
                    // Win a lottery > 10m
                    new ManualAchievement()
                    {
                        Name   = "Absolute Madman",
                        Icon   = "🍸",
                        Points = 10,
                    },
                    // Win a lottery > 250m
                    new ManualAchievement()
                    {
                        Name   = "Pop da champagne",
                        Icon   = "🍾",
                        Points = 15
                    }
                };
            });

            AchievementDataContainer InfoAchievement = new AchievementDataContainer(x =>
            {
                x.Name         = "info";
                x.Achievements = new List <IAchievement>()
                {
                    new CommandAchievement()
                    {
                        Name = "Informed",
                        Icon = "📚",

                        CheckCommand = async(p) =>
                        {
                            await Task.Yield();
                            return(p.command.Name.ToLower() == "info");
                        },
                        Points = 5
                    }
                };
            });
            AchievementDataContainer LonelyAchievement = new AchievementDataContainer(x =>
            {
                x.Name         = "fa";
                x.Achievements = new List <IAchievement>()
                {
                    new CommandAchievement()
                    {
                        Name = "Lonely",
                        Icon = "😭",

                        CheckCommand = async(p) =>
                        {
                            await Task.Yield();
                            return(p.command.Name.ToLower() == "marry" && p.message.MentionedUserIds.FirstOrDefault() == p.message.Author.Id);
                        },
                        Points = 5,
                    }
                };
            });
            AchievementDataContainer ChefAchievement = new AchievementDataContainer(x =>
            {
                x.Name         = "creator";
                x.Achievements = new List <IAchievement>()
                {
                    new CommandAchievement()
                    {
                        Name         = "Chef",
                        Icon         = "📝",
                        CheckCommand = async(p) =>
                        {
                            await Task.Yield();
                            return(p.command.Name.ToLower() == "createpasta");
                        },
                        Points = 5,
                    }
                };
            });
            AchievementDataContainer NoPermissionAchievement = new AchievementDataContainer(x =>
            {
                x.Name         = "noperms";
                x.Achievements = new List <IAchievement>()
                {
                    new CommandAchievement()
                    {
                        Name         = "NO! Don't touch that!",
                        Icon         = "😱",
                        CheckCommand = async(p) =>
                        {
                            return(await MikiApp.Instance.GetService <EventSystem>().GetCommandHandler <SimpleCommandHandler>().GetUserAccessibility(p.message, p.discordChannel as IDiscordGuildChannel) < p.command.Accessibility);
                        },
                        Points = 5
                    }
                };
            });

            AchievementDataContainer LevelAchievement = new AchievementDataContainer(x =>
            {
                x.Name         = "levelachievements";
                x.Achievements = new List <IAchievement>()
                {
                    new LevelAchievement()
                    {
                        Name       = "Novice",
                        Icon       = "🎟",
                        CheckLevel = async(p) => p.level >= 3,
                        Points     = 5,
                    },
                    new LevelAchievement()
                    {
                        Name       = "Intermediate",
                        Icon       = "🎫",
                        CheckLevel = async(p) => p.level >= 5,
                        Points     = 10,
                    },
                    new LevelAchievement()
                    {
                        Name       = "Experienced",
                        Icon       = "🏵",
                        CheckLevel = async(p) => p.level >= 10,
                        Points     = 15,
                    },
                    new LevelAchievement()
                    {
                        Name       = "Expert",
                        Icon       = "🎗",
                        CheckLevel = async(p) => p.level >= 20,
                        Points     = 20,
                    },
                    new LevelAchievement()
                    {
                        Name       = "Sage",
                        Icon       = "🎖",
                        CheckLevel = async(p) => p.level >= 30,
                        Points     = 25,
                    },
                    new LevelAchievement()
                    {
                        Name       = "Master",
                        Icon       = "🏅",
                        CheckLevel = async(p) => p.level >= 50,
                        Points     = 30,
                    },
                    new LevelAchievement()
                    {
                        Name       = "Legend",
                        Icon       = "💮",
                        CheckLevel = async(p) => p.level >= 100,
                        Points     = 35,
                    },
                    new LevelAchievement()
                    {
                        Name       = "Epic",
                        Icon       = "🌸",
                        CheckLevel = async(p) => p.level >= 150,
                        Points     = 40,
                    }
                };
            });

            AchievementDataContainer FrogAchievement = new AchievementDataContainer(x =>
            {
                x.Name         = "frog";
                x.Achievements = new List <IAchievement>()
                {
                    new CommandAchievement()
                    {
                        Name         = "Oh shit! Waddup",
                        Icon         = "🐸",
                        CheckCommand = async(p) =>
                        {
                            return(p.command.Name == "pasta" && p.message.Content.Contains("dat boi"));
                        },
                        Points = 5
                    }
                };
            });
            AchievementDataContainer LennyAchievement = new AchievementDataContainer(x =>
            {
                x.Name         = "lenny";
                x.Achievements = new List <IAchievement>()
                {
                    new CommandAchievement()
                    {
                        Name         = "Lenny",
                        Icon         = "😏",
                        CheckCommand = async(p) =>
                        {
                            return(p.command.Name == "pasta" && p.message.Content.Contains("( ͡° ͜ʖ ͡°)"));
                        },
                        Points = 5
                    }
                };
            });
            AchievementDataContainer PoiAchievement = new AchievementDataContainer(x =>
            {
                x.Name         = "poi";
                x.Achievements = new List <IAchievement>
                {
                    new CommandAchievement()
                    {
                        Name         = "Shipgirl",
                        Icon         = "⛵",
                        CheckCommand = async(p) =>
                        {
                            return(p.command.Name == "pasta" && p.message.Content.Split(' ').Contains("poi"));
                        },
                        Points = 5,
                    }
                };
            });

            AchievementDataContainer LuckyAchievement = new AchievementDataContainer(x =>
            {
                x.Name         = "goodluck";
                x.Achievements = new List <IAchievement>()
                {
                    new CommandAchievement()
                    {
                        Name         = "Lucky",
                        Icon         = "🍀",
                        CheckCommand = async(p) =>
                        {
                            return(MikiRandom.Next(0, 10000000) == 5033943);
                        },
                        Points = 25
                    }
                };
            });

            AchievementDataContainer MekosAchievement = new AchievementDataContainer(x =>
            {
                x.Name         = "meko";
                x.Achievements = new List <IAchievement>()
                {
                    new TransactionAchievement()
                    {
                        Name             = "Loaded",
                        Icon             = "💵",
                        CheckTransaction = async(p) =>
                        {
                            return(p.receiver.Currency > 10000);
                        },
                        Points = 5
                    },
                    new TransactionAchievement()
                    {
                        Name             = "Rich",
                        Icon             = "💸",
                        CheckTransaction = async(p) =>
                        {
                            return(p.receiver.Currency > 50000);
                        },
                        Points = 10
                    },
                    new TransactionAchievement()
                    {
                        Name             = "Minted",
                        Icon             = "💲",
                        CheckTransaction = async(p) =>
                        {
                            return(p.receiver.Currency > 125000);
                        },
                        Points = 15
                    },
                    new TransactionAchievement()
                    {
                        Name             = "Millionaire",
                        Icon             = "🤑",
                        CheckTransaction = async(p) =>
                        {
                            return(p.receiver.Currency > 1000000);
                        },
                        Points = 20
                    },
                    new TransactionAchievement()
                    {
                        Name             = "Billionaire",
                        Icon             = "🏦",
                        CheckTransaction = async(p) =>
                        {
                            return(p.receiver.Currency > 1000000000);
                        },
                        Points = 25
                    }
                };
            });

            AchievementDataContainer DiscordBotsOrgAchievement = new AchievementDataContainer(x =>
            {
                x.Name         = "voter";
                x.Achievements = new List <IAchievement>()
                {
                    // first vote
                    new ManualAchievement()
                    {
                        Name   = "Helper",
                        Icon   = "✉",
                        Points = 5,
                    },
                    // 10 votes
                    new ManualAchievement()
                    {
                        Name   = "Voter",
                        Icon   = "🗳",
                        Points = 10,
                    },
                    // 50 votes
                    new ManualAchievement()
                    {
                        Name   = "Elector",
                        Icon   = "🗃",
                        Points = 15,
                    }
                };
            });

            AchievementDataContainer SlotsAchievement = new AchievementDataContainer(x =>
            {
                x.Name         = "slots";
                x.Achievements = new List <IAchievement>
                {
                    new ManualAchievement()
                    {
                        Name   = "Jackpot",
                        Icon   = "🎰",
                        Points = 15
                    }
                };
            });

            #region Achievement Achievements

            AchievementManager.Instance.OnAchievementUnlocked += async(pa) =>
            {
                await AchievementAchievements.CheckAsync(pa);
            };

            #endregion Achievement Achievements

            #region Command Achievements

            AchievementManager.Instance.OnCommandUsed += InfoAchievement.CheckAsync;
            AchievementManager.Instance.OnCommandUsed += LonelyAchievement.CheckAsync;
            AchievementManager.Instance.OnCommandUsed += ChefAchievement.CheckAsync;
            AchievementManager.Instance.OnCommandUsed += NoPermissionAchievement.CheckAsync;

            #endregion Command Achievements

            #region Level Achievements

            AchievementManager.Instance.OnLevelGained += LevelAchievement.CheckAsync;

            #endregion Level Achievements

            AchievementManager.Instance.OnCommandUsed += LennyAchievement.CheckAsync;
            AchievementManager.Instance.OnCommandUsed += PoiAchievement.CheckAsync;
            AchievementManager.Instance.OnCommandUsed += LuckyAchievement.CheckAsync;
            AchievementManager.Instance.OnCommandUsed += FrogAchievement.CheckAsync;

            #region Misc Achievements

            new AchievementDataContainer(x =>
            {
                x.Name         = "badluck";
                x.Achievements = new List <IAchievement>()
                {
                    new ManualAchievement()
                    {
                        Name   = "Unlucky",
                        Icon   = "🎲",
                        Points = 5
                    }
                };
            });

            #endregion Misc Achievements

            #region User Update Achievements (don't disable these)

            new AchievementDataContainer(x =>
            {
                x.Name         = "contributor";
                x.Achievements = new List <IAchievement>()
                {
                    new UserUpdateAchievement()
                    {
                        Name = "Contributor",
                        Icon = "⭐",

                        CheckUserUpdate = async(p) =>
                        {
                            return(false);
                        }
                    }
                };
            });
            new AchievementDataContainer(x =>
            {
                x.Name         = "developer";
                x.Achievements = new List <IAchievement>()
                {
                    new UserUpdateAchievement()
                    {
                        Name            = "Developer",
                        Icon            = "🌟",
                        CheckUserUpdate = async(p) =>
                        {
                            return(false);
                        }
                    }
                };
            });
            new AchievementDataContainer(x =>
            {
                x.Name         = "glitch";
                x.Achievements = new List <IAchievement>()
                {
                    new UserUpdateAchievement()
                    {
                        Name            = "Glitch",
                        Icon            = "👾",
                        CheckUserUpdate = async(p) =>
                        {
                            return(false);
                        }
                    }
                };
            });
            new AchievementDataContainer(x =>
            {
                x.Name         = "donator";
                x.Achievements = new List <IAchievement>()
                {
                    new ManualAchievement()
                    {
                        Name   = "Donator",
                        Icon   = "💖",
                        Points = 0,
                    },
                    new ManualAchievement()
                    {
                        Name   = "Supporter",
                        Icon   = "💘",
                        Points = 0,
                    },
                    new ManualAchievement()
                    {
                        Name   = "Sponsor",
                        Icon   = "💟",
                        Points = 0,
                    },
                };
            });

            #endregion User Update Achievements (don't disable these)

            #region Transaction Achievements

            AchievementManager.Instance.OnTransaction += MekosAchievement.CheckAsync;

            #endregion Transaction Achievements
        }
예제 #2
0
        public void LoadAchievements()
        {
            AchievementDataContainer AchievementAchievements = new AchievementDataContainer(x =>
            {
                x.Name         = "achievements";
                x.Achievements = new List <BaseAchievement>()
                {
                    new AchievementAchievement()
                    {
                        Name             = "Underachiever",
                        Icon             = "✏️",
                        CheckAchievement = async(p) =>
                        {
                            return(p.count > 3);
                        },
                    },
                    new AchievementAchievement()
                    {
                        Name             = "Achiever",
                        Icon             = "🖊️",
                        CheckAchievement = async(p) =>
                        {
                            return(p.count > 5);
                        },
                    },
                    new AchievementAchievement()
                    {
                        Name             = "Overachiever",
                        Icon             = "🖋️",
                        CheckAchievement = async(p) =>
                        {
                            return(p.count > 12);
                        },
                    }
                };
            });

            AchievementDataContainer InfoAchievement = new AchievementDataContainer(x =>
            {
                x.Name         = "info";
                x.Achievements = new List <BaseAchievement>()
                {
                    new CommandAchievement()
                    {
                        Name = "Informed",
                        Icon = "📚",

                        CheckCommand = async(p) =>
                        {
                            return(p.command.Name.ToLower() == "info");
                        }
                    }
                };
            });
            AchievementDataContainer LonelyAchievement = new AchievementDataContainer(x =>
            {
                x.Name         = "fa";
                x.Achievements = new List <BaseAchievement>()
                {
                    new CommandAchievement()
                    {
                        Name = "Lonely",
                        Icon = "😭",

                        CheckCommand = async(p) =>
                        {
                            return(p.command.Name.ToLower() == "marry" && p.message.MentionedUserIds.First() == p.message.Author.Id);
                        }
                    },
                    new CommandAchievement()
                    {
                        Name = "Lonely",
                        Icon = "😭",

                        CheckCommand = async(p) =>
                        {
                            return(p.command.Name.ToLower() == "marry" && p.message.MentionedUserIds.First() == p.message.Author.Id);
                        }
                    }
                };
            });
            AchievementDataContainer ChefAchievement = new AchievementDataContainer(x =>
            {
                x.Name         = "creator";
                x.Achievements = new List <BaseAchievement>()
                {
                    new CommandAchievement()
                    {
                        Name         = "Chef",
                        Icon         = "📝",
                        CheckCommand = async(p) =>
                        {
                            if (p.command.Name.ToLower() == "createpasta")
                            {
                                return(true);
                            }
                            return(false);
                        }
                    }
                };
            });
            AchievementDataContainer NoPermissionAchievement = new AchievementDataContainer(x =>
            {
                x.Name         = "noperms";
                x.Achievements = new List <BaseAchievement>()
                {
                    new CommandAchievement()
                    {
                        Name         = "NO! Don't touch that!",
                        Icon         = "😱",
                        CheckCommand = async(p) =>
                        {
                            return(Bot.instance.Events.CommandHandler.GetUserAccessibility(p.message) < p.command.Accessibility);
                        },
                    }
                };
            });

            AchievementDataContainer LevelAchievement = new AchievementDataContainer(x =>
            {
                x.Name         = "levelachievements";
                x.Achievements = new List <BaseAchievement>()
                {
                    new LevelAchievement()
                    {
                        Name       = "Novice",
                        Icon       = "🎟",
                        CheckLevel = async(p) => p.level >= 3
                    },
                    new LevelAchievement()
                    {
                        Name       = "Intermediate",
                        Icon       = "🎫",
                        CheckLevel = async(p) => p.level >= 5
                    },
                    new LevelAchievement()
                    {
                        Name       = "Experienced",
                        Icon       = "🏵",
                        CheckLevel = async(p) => p.level >= 10
                    },
                    new LevelAchievement()
                    {
                        Name       = "Expert",
                        Icon       = "🎗",
                        CheckLevel = async(p) => p.level >= 20
                    },
                    new LevelAchievement()
                    {
                        Name       = "Sage",
                        Icon       = "🎖",
                        CheckLevel = async(p) => p.level >= 30
                    },
                    new LevelAchievement()
                    {
                        Name       = "Master",
                        Icon       = "🏅",
                        CheckLevel = async(p) => p.level >= 50
                    },
                    new LevelAchievement()
                    {
                        Name       = "Legend",
                        Icon       = "💮",
                        CheckLevel = async(p) => p.level >= 100
                    },
                    new LevelAchievement()
                    {
                        Name       = "Epic",
                        Icon       = "🌸",
                        CheckLevel = async(p) => p.level >= 150,
                    }
                };
            });

            AchievementDataContainer FrogAchievement = new AchievementDataContainer(x =>
            {
                x.Name         = "frog";
                x.Achievements = new List <BaseAchievement>()
                {
                    new MessageAchievement()
                    {
                        Name         = "Oh shit! Waddup",
                        Icon         = "🐸",
                        CheckMessage = async(p) => p.message.Content.Contains("dat boi")
                    },
                    new MessageAchievement()
                    {
                        Name         = "It's wednesday my dudes!",
                        Icon         = "🇼",
                        CheckMessage = async(p) => (p.message.Content.Contains("it") && p.message.Content.Contains("wednesday") && p.message.Content.Contains("dude") && DateTime.Now.DayOfWeek == DayOfWeek.Wednesday)
                    }
                };
            });
            AchievementDataContainer LennyAchievement = new AchievementDataContainer(x =>
            {
                x.Name         = "lenny";
                x.Achievements = new List <BaseAchievement>()
                {
                    new MessageAchievement()
                    {
                        Name         = "Lenny",
                        Icon         = "😏",
                        CheckMessage = async(p) =>
                        {
                            return(p.message.Content.Contains("( ͡° ͜ʖ ͡°)"));
                        }
                    }
                };
            });
            AchievementDataContainer PoiAchievement = new AchievementDataContainer(x =>
            {
                x.Name         = "poi";
                x.Achievements = new List <BaseAchievement>
                {
                    new MessageAchievement()
                    {
                        Name         = "Shipgirl",
                        Icon         = "⛵",
                        CheckMessage = async(p) =>
                        {
                            return(p.message.Content.Split(' ').Contains("poi"));
                        },
                    }
                };
            });
            AchievementDataContainer LuckyAchievement = new AchievementDataContainer(x =>
            {
                x.Name         = "goodluck";
                x.Achievements = new List <BaseAchievement>()
                {
                    new MessageAchievement()
                    {
                        Name         = "Lucky",
                        Icon         = "🍀",
                        CheckMessage = async(p) =>
                        {
                            return(MikiRandom.Next(0, 10000000) == 5033943);
                        },
                    }
                };
            });

            AchievementDataContainer MekosAchievement = new AchievementDataContainer(x =>
            {
                x.Name         = "meko";
                x.Achievements = new List <BaseAchievement>()
                {
                    new TransactionAchievement()
                    {
                        Name             = "Loaded",
                        Icon             = "💵",
                        CheckTransaction = async(p) =>
                        {
                            return(p.receiver.Currency > 10000);
                        }
                    },
                    new TransactionAchievement()
                    {
                        Name             = "Rich",
                        Icon             = "💸",
                        CheckTransaction = async(p) =>
                        {
                            return(p.receiver.Currency > 50000);
                        }
                    },
                    new TransactionAchievement()
                    {
                        Name             = "Minted",
                        Icon             = "💲",
                        CheckTransaction = async(p) =>
                        {
                            return(p.receiver.Currency > 125000);
                        }
                    },
                    new TransactionAchievement()
                    {
                        Name             = "Millionaire",
                        Icon             = "🤑",
                        CheckTransaction = async(p) =>
                        {
                            return(p.receiver.Currency > 1000000);
                        }
                    }
                };
            });

            #region Achievement Achievements

            AchievementManager.Instance.OnAchievementUnlocked += async(pa) =>
            {
                if (await IsEnabled(pa.discordChannel.Id))
                {
                    await AchievementAchievements.CheckAsync(pa);
                }
            };

            #endregion Achievement Achievements

            #region Command Achievements

            AchievementManager.Instance.OnCommandUsed += InfoAchievement.CheckAsync;
            AchievementManager.Instance.OnCommandUsed += LonelyAchievement.CheckAsync;
            AchievementManager.Instance.OnCommandUsed += ChefAchievement.CheckAsync;
            AchievementManager.Instance.OnCommandUsed += NoPermissionAchievement.CheckAsync;
            #endregion Command Achievements

            #region Level Achievements
            AchievementManager.Instance.OnLevelGained += LevelAchievement.CheckAsync;

            #endregion Level Achievements

            #region Misc Achievements

            new AchievementDataContainer(x =>
            {
                x.Name         = "badluck";
                x.Achievements = new List <BaseAchievement>()
                {
                    new BaseAchievement()
                    {
                        Name = "Unlucky",
                        Icon = "🎲"
                    }
                };
            });

            #endregion Misc Achievements

            #region User Update Achievements (don't disable these)

            new AchievementDataContainer(x =>
            {
                x.Name         = "contributor";
                x.Achievements = new List <BaseAchievement>()
                {
                    new UserUpdateAchievement()
                    {
                        Name = "Contributor",
                        Icon = "⭐",

                        CheckUserUpdate = async(p) =>
                        {
                            if (p.userNew.Guild.Id == 160067691783127041)
                            {
                                IDiscordRole role = p.userNew.Guild.Roles.Find(r => { return(r.Name == "Contributors"); });

                                if (p.userNew.RoleIds.Contains(role.Id))
                                {
                                    return(true);
                                }
                            }
                            return(false);
                        }
                    }
                };
            });
            new AchievementDataContainer(x =>
            {
                x.Name         = "developer";
                x.Achievements = new List <BaseAchievement>()
                {
                    new UserUpdateAchievement()
                    {
                        Name            = "Developer",
                        Icon            = "🌟",
                        CheckUserUpdate = async(p) =>
                        {
                            if (p.userNew.Guild.Id == 160067691783127041)
                            {
                                IDiscordRole role = p.userNew.Guild.Roles.Find(r => { return(r.Name == "Developer"); });

                                if (p.userNew.RoleIds.Contains(role.Id))
                                {
                                    return(true);
                                }
                            }
                            return(false);
                        }
                    }
                };
            });
            new AchievementDataContainer(x =>
            {
                x.Name         = "glitch";
                x.Achievements = new List <BaseAchievement>()
                {
                    new UserUpdateAchievement()
                    {
                        Name            = "Glitch",
                        Icon            = "👾",
                        CheckUserUpdate = async(p) =>
                        {
                            if (p.userNew.Guild.Id == 160067691783127041)
                            {
                                IDiscordRole role = p.userNew.Guild.Roles.Find(r => { return(r.Name == "Succesfully broke Miki"); });

                                if (p.userNew.RoleIds.Contains(role.Id))
                                {
                                    return(true);
                                }
                            }
                            return(false);
                        }
                    }
                };
            });
            new AchievementDataContainer(x =>
            {
                x.Name         = "donator";
                x.Achievements = new List <BaseAchievement>()
                {
                    new UserUpdateAchievement()
                    {
                        Name            = "Donator",
                        Icon            = "💖",
                        CheckUserUpdate = async(p) =>
                        {
                            if (p.discordUser.Guild.Id == 160067691783127041)
                            {
                                IDiscordRole role = p.userNew.Guild.Roles.Find(r => { return(r.Name == "Donators"); });

                                if (p.userNew.RoleIds.Contains(role.Id))
                                {
                                    return(true);
                                }
                            }
                            return(false);
                        }
                    }
                };
            });

            #endregion User Update Achievements (don't disable these)

            #region Transaction Achievements

            AchievementManager.Instance.OnTransaction += MekosAchievement.CheckAsync;

            #endregion Transaction Achievements
        }