Exemple #1
0
        internal static async Task UserWonPvP(UserAccount avatar, ITextChannel lobbyChannel, int numberOfWinners,
                                              int numberOfLosers)
        {
            _ = GoldenSunCommands.AwardClassSeries("Swordsman Series", avatar, lobbyChannel);
            var csvline =
                $"{DateTime.Now:s},PvP,{numberOfWinners}vs{numberOfLosers},{avatar.Name}{Environment.NewLine}";

            File.AppendAllText(BattleFile, csvline);
            await Task.CompletedTask;
        }
Exemple #2
0
        internal static async Task UserSentCommand(SocketUser user, IMessageChannel channel)
        {
            var userAccount = EntityConverter.ConvertUser(user);

            userAccount.ServerStats.CommandsUsed++;
            UserAccountProvider.StoreUser(userAccount);
            if (userAccount.ServerStats.CommandsUsed >= 50)
            {
                await GoldenSunCommands.AwardClassSeries("Scrapper Series", user, channel);
            }
        }
Exemple #3
0
        internal static async Task UserLookedUpClass(SocketGuildUser user, SocketTextChannel channel)
        {
            var userAccount = EntityConverter.ConvertUser(user);

            userAccount.ServerStats.LookedUpClass++;
            UserAccountProvider.StoreUser(userAccount);

            if (userAccount.ServerStats.LookedUpClass >= 11)
            {
                _ = GoldenSunCommands.AwardClassSeries("Page Series", user, channel);
            }
            await Task.CompletedTask;
        }
Exemple #4
0
        internal static async Task UserWonRps(SocketGuildUser user, SocketTextChannel channel)
        {
            var userAccount = EntityConverter.ConvertUser(user);

            userAccount.ServerStats.RpsWins++;
            userAccount.ServerStats.RpsStreak++;
            UserAccountProvider.StoreUser(userAccount);

            if (userAccount.ServerStats.RpsWins >= 3)
            {
                await GoldenSunCommands.AwardClassSeries("Aqua Seer Series", user, channel);
            }
        }
Exemple #5
0
        private static async Task UnlockBattleClasses(UserAccount userAccount, ITextChannel channel)
        {
            var bs = userAccount.BattleStats;

            if (userAccount.ServerStats.ColossoWins >= 20)
            {
                await GoldenSunCommands.AwardClassSeries("Brute Series", userAccount, channel);
            }

            if (bs.KillsByHand >= 161)
            {
                await GoldenSunCommands.AwardClassSeries("Samurai Series", userAccount, channel);
            }

            if (bs.DamageDealt >= 222222)
            {
                await GoldenSunCommands.AwardClassSeries("Ninja Series", userAccount, channel);
            }

            if (bs.SoloBattles >= 100)
            {
                await GoldenSunCommands.AwardClassSeries("Ranger Series", userAccount, channel);
            }

            if (bs.TotalTeamMates >= 100)
            {
                await GoldenSunCommands.AwardClassSeries("Dragoon Series", userAccount, channel);
            }

            if (bs.HPhealed >= 222222)
            {
                await GoldenSunCommands.AwardClassSeries("White Mage Series", userAccount, channel);
            }

            if (bs.Revives >= 25)
            {
                await GoldenSunCommands.AwardClassSeries("Medium Series", userAccount, channel);
            }
        }
Exemple #6
0
        internal static async Task UserWonDungeon(UserAccount avatar, EnemiesDatabase.Dungeon dungeon,
                                                  ITextChannel channel)
        {
            avatar.ServerStats.DungeonsCompleted++;
            if (avatar.ServerStats.LastDungeon == dungeon.Name)
            {
                avatar.ServerStats.SameDungeonInARow++;
                if (avatar.ServerStats.SameDungeonInARow >= 5)
                {
                    _ = GoldenSunCommands.AwardClassSeries("Hermit Series", avatar, channel);
                }
            }

            avatar.ServerStats.LastDungeon = dungeon.Name;
            UserAccountProvider.StoreUser(avatar);
            if (dungeon.Name == "Mercury Lighthouse")
            {
                _ = GoldenSunCommands.AwardClassSeries("Aqua Pilgrim Series", avatar, channel);
            }

            //Unlock Crusader
            if (avatar.Dungeons.Count >= 6)
            {
                _ = GoldenSunCommands.AwardClassSeries("Crusader Series", avatar, channel);
            }

            if (avatar.ServerStats.DungeonsCompleted >= 12)
            {
                _ = GoldenSunCommands.AwardClassSeries("Air Pilgrim Series", avatar, channel);
            }
            var csvline = $"{DateTime.Now:s},Dungeon,{dungeon.Name},{avatar.Name}{Environment.NewLine}";

            File.AppendAllText(BattleFile, csvline);

            await Task.CompletedTask;
        }
Exemple #7
0
        internal static async void UserSentMessage(SocketGuildUser user, SocketTextChannel channel)
        {
            if (channel == null || BlackListedChannels.Contains(channel.Id) || user == null)
            {
                return;
            }

            if (channel.Id == GuildSettings.GetGuildSettings(channel.Guild).ColossoChannel?.Id)
            {
                return;
            }

            var userAccount = EntityConverter.ConvertUser(user);

            // if the user has a timeout, ignore them
            var sinceLastXp = DateTime.UtcNow - userAccount.LastXp;
            var oldLevel    = userAccount.LevelNumber;

            if (sinceLastXp.TotalMinutes >= 3)
            {
                userAccount.LastXp = DateTime.UtcNow;
                userAccount.AddXp((uint)Global.RandomNumber(30, 50));
            }

            if (DateTime.Now.Date != userAccount.ServerStats.LastDayActive.Date)
            {
                userAccount.ServerStats.UniqueDaysActive++;
                userAccount.ServerStats.LastDayActive = DateTime.Now.Date;
            }

            if (channel.Id == GuildSettings.GetGuildSettings(channel.Guild)?.ColossoChannel?.Id)
            {
                userAccount.ServerStats.MessagesInColossoTalks++;
                if (userAccount.ServerStats.MessagesInColossoTalks >= 50)
                {
                    _ = GoldenSunCommands.AwardClassSeries("Swordsman Series", user, channel);
                }
            }

            var newLevel = userAccount.LevelNumber;

            if (oldLevel != newLevel)
            {
                LevelUp(userAccount, user, channel);
            }

            if (channel.Id != userAccount.ServerStats.MostRecentChannel)
            {
                userAccount.ServerStats.MostRecentChannel = channel.Id;
                userAccount.ServerStats.ChannelSwitches  += 2;
                if (userAccount.ServerStats.ChannelSwitches >= 14)
                {
                    _ = GoldenSunCommands.AwardClassSeries("Air Pilgrim Series", user, channel);
                }
            }
            else
            {
                if (userAccount.ServerStats.ChannelSwitches > 0)
                {
                    userAccount.ServerStats.ChannelSwitches--;
                }
            }
            UserAccountProvider.StoreUser(userAccount);
            await Task.CompletedTask;
        }
Exemple #8
0
 public override async Task ReactAsync(SocketUserMessage msg)
 {
     _ = base.ReactAsync(msg);
     _ = GoldenSunCommands.AwardClassSeries("Curse Mage Series", msg.Author, msg.Channel);
     await Task.CompletedTask;
 }