internal static async void UserAddedReaction(SocketGuildUser user, SocketReaction reaction) { if (blackListedChannels.Contains(reaction.Channel.Id)) { return; } if (!Global.Client.Guilds.Any(g => g.Emotes.Any(e => e.Name == reaction.Emote.Name))) { return; } var userAccount = UserAccounts.GetAccount(user); if (reaction.MessageId == userAccount.ServerStats.MostRecentChannel) { userAccount.ServerStats.ReactionsAdded++; } else { userAccount.ServerStats.ReactionsAdded += 5; userAccount.ServerStats.MostRecentChannel = reaction.MessageId; } if (userAccount.ServerStats.ReactionsAdded >= 50) { try { await GoldenSun.AwardClassSeries("Aqua Pilgrim Series", user, (SocketTextChannel)Global.Client.GetChannel(546760009741107216)); } catch { } } UserAccounts.SaveAccounts(); }
internal static async void UserWonColosso(SocketGuildUser user, IMessageChannel channel) { var userAccount = UserAccounts.GetAccount(user); uint oldLevel = userAccount.LevelNumber; userAccount.AddXp((uint)(new Random()).Next(40, 70)); uint newLevel = userAccount.LevelNumber; userAccount.ServerStats.ColossoWins++; userAccount.ServerStats.ColossoStreak++; if (userAccount.ServerStats.ColossoStreak > userAccount.ServerStats.ColossoHighestStreak) { userAccount.ServerStats.ColossoHighestStreak = userAccount.ServerStats.ColossoStreak; } UserAccounts.SaveAccounts(); if (oldLevel != newLevel) { Leveling.LevelUp(userAccount, user, channel); } if (userAccount.ServerStats.ColossoWins >= 15) { await GoldenSun.AwardClassSeries("Brute Series", user, channel); } await Task.CompletedTask; }
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) { _ = GoldenSun.AwardClassSeries("Hermit Series", avatar, channel); } } avatar.ServerStats.LastDungeon = dungeon.Name; if (dungeon.Name == "Mercury Lighthouse") { _ = GoldenSun.AwardClassSeries("Aqua Pilgrim Series", avatar, channel); } //Unlock Crusader if (avatar.Dungeons.Count >= 6) { _ = GoldenSun.AwardClassSeries("Crusader Series", avatar, channel); } if (avatar.ServerStats.DungeonsCompleted >= 12) { _ = GoldenSun.AwardClassSeries("Air Pilgrim Series", avatar, channel); } string csvline = $"{DateTime.Now.TimeOfDay},Dungeon,{dungeon.Name},{avatar.Name}{Environment.NewLine}"; File.AppendAllText(BattleFile, csvline); await Task.CompletedTask; }
public void ApplyLoadout(UserAccount account) { var inv = account.Inv; GoldenSun.SetClass(account, ClassSeries); Gear.ForEach(i => inv.Equip(i, AdeptClassSeriesManager.GetClassSeries(account).Archtype)); DjinnCommands.TakeDjinn(account, Djinn.ToArray()); }
internal static async Task UserWonPvP(UserAccount avatar, ITextChannel lobbyChannel, int numberOfWinners, int numberOfLosers) { _ = GoldenSun.AwardClassSeries("Swordsman Series", avatar, lobbyChannel); string csvline = $"{DateTime.Now.TimeOfDay},PvP,{numberOfWinners}vs{numberOfLosers},{avatar.Name}{Environment.NewLine}"; File.AppendAllText(BattleFile, csvline); await Task.CompletedTask; }
internal static async Task UserHasCursed(SocketGuildUser user, SocketTextChannel channel) { var userAccount = UserAccounts.GetAccount(user); if (userAccount.ServerStats.HasQuotedMatthew && userAccount.ServerStats.HasWrittenCurse) { await GoldenSun.AwardClassSeries("Curse Mage Series", user, channel); } }
internal static async Task UserSentCommand(SocketUser user, IMessageChannel channel) { var userAccount = UserAccounts.GetAccount(user); userAccount.ServerStats.CommandsUsed++; if (userAccount.ServerStats.CommandsUsed >= 100) { await GoldenSun.AwardClassSeries("Scrapper Series", user, channel); } }
internal static async Task UserLookedUpClass(SocketGuildUser user, SocketTextChannel channel) { var userAccount = UserAccounts.GetAccount(user); userAccount.ServerStats.LookedUpClass++; UserAccounts.SaveAccounts(); if (userAccount.ServerStats.LookedUpClass >= 21) { await GoldenSun.AwardClassSeries("Page Series", user, channel); } }
internal static async Task UserLookedUpPsynergy(SocketGuildUser user, SocketTextChannel channel) { var userAccount = UserAccounts.GetAccount(user); userAccount.ServerStats.LookedUpInformation++; UserAccounts.SaveAccounts(); if (userAccount.ServerStats.LookedUpInformation >= 21) { await GoldenSun.AwardClassSeries("Apprentice Series", user, channel); } }
internal static async Task UserWonRPS(SocketGuildUser user, SocketTextChannel channel) { var userAccount = UserAccounts.GetAccount(user); userAccount.ServerStats.RpsWins++; userAccount.ServerStats.RpsStreak++; UserAccounts.SaveAccounts(); if (userAccount.ServerStats.RpsWins == 3) { await GoldenSun.AwardClassSeries("Aqua Seer Series", user, channel); } }
private static async Task UnlockBattleClasses(UserAccount userAccount, ITextChannel channel) { var bs = userAccount.BattleStats; if (userAccount.ServerStats.ColossoWins >= 20) { await GoldenSun.AwardClassSeries("Brute Series", userAccount, channel); } if (bs.KillsByHand >= 210) { await GoldenSun.AwardClassSeries("Samurai Series", userAccount, channel); } if (bs.DamageDealt >= 666666) { await GoldenSun.AwardClassSeries("Ninja Series", userAccount, channel); } if (bs.SoloBattles >= 100) { await GoldenSun.AwardClassSeries("Ranger Series", userAccount, channel); } if (bs.TotalTeamMates >= 100) { await GoldenSun.AwardClassSeries("Dragoon Series", userAccount, channel); } if (bs.HPhealed >= 333333) { await GoldenSun.AwardClassSeries("White Mage Series", userAccount, channel); } if (bs.Revives >= 25) { await GoldenSun.AwardClassSeries("Medium Series", userAccount, channel); } }
public async Task AddItem([Remainder] string item) { var account = UserAccounts.GetAccount(Context.User); var inv = account.Inv; var shop = ItemDatabase.GetShop(); if (!shop.HasItem(item)) { var embed = new EmbedBuilder(); embed.WithDescription(":x: Sorry, but we're out of stock for that. Come back later, okay?"); embed.WithThumbnailUrl(ItemDatabase.shopkeeper); embed.WithColor(Colors.Get("Error")); await Context.Channel.SendMessageAsync("", false, embed.Build()); return; } if (inv.Buy(item)) { _ = ShowInventory(); if (ItemDatabase.GetItem(item).IsArtifact) { account.ServerStats.SpentMoneyOnArtifacts += ItemDatabase.GetItem(item).Price; if (account.ServerStats.SpentMoneyOnArtifacts >= 18000) { await GoldenSun.AwardClassSeries("Crusader Series", (SocketGuildUser)Context.User, (SocketTextChannel)Context.Channel); } } } else { var embed = new EmbedBuilder(); embed.WithDescription(":x: Balance not enough or Inventory at full capacity."); embed.WithColor(Colors.Get("Error")); await Context.Channel.SendMessageAsync("", false, embed.Build()); } }
public override async Task ReactAsync(SocketUserMessage msg) { _ = base.ReactAsync(msg); _ = GoldenSun.AwardClassSeries("Curse Mage Series", msg.Author, msg.Channel); await Task.CompletedTask; }
internal static async void UserSentMessage(SocketGuildUser user, SocketTextChannel channel) { if (blackListedChannels.Contains(channel.Id)) { return; } var userAccount = UserAccounts.GetAccount(user); // if the user has a timeout, ignore them var sinceLastXP = DateTime.UtcNow - userAccount.LastXP; uint oldLevel = userAccount.LevelNumber; if (sinceLastXP.Minutes >= 2) { userAccount.LastXP = DateTime.UtcNow; userAccount.XP += (uint)(new Random()).Next(30, 60); } if ((DateTime.Now.Date != userAccount.ServerStats.LastDayActive.Date)) { userAccount.ServerStats.UniqueDaysActive++; userAccount.ServerStats.LastDayActive = DateTime.Now.Date; if ((DateTime.Now - user.JoinedAt).Value.TotalDays > 30) { await GoldenSun.AwardClassSeries("Hermit Series", user, channel); } } if (channel.Id != userAccount.ServerStats.MostRecentChannel) { userAccount.ServerStats.MostRecentChannel = channel.Id; userAccount.ServerStats.ChannelSwitches += 2; if (userAccount.ServerStats.ChannelSwitches >= 14) { await GoldenSun.AwardClassSeries("Air Pilgrim Series", user, channel); } } else { if (userAccount.ServerStats.ChannelSwitches > 0) { userAccount.ServerStats.ChannelSwitches--; } } if (channel.Id == 546760009741107216) { userAccount.ServerStats.MessagesInColossoTalks++; if (userAccount.ServerStats.MessagesInColossoTalks >= 50) { await GoldenSun.AwardClassSeries("Swordsman Series", user, channel); } } UserAccounts.SaveAccounts(); uint newLevel = userAccount.LevelNumber; if (oldLevel != newLevel) { LevelUp(userAccount, user, channel); } await Task.CompletedTask; }
internal static async Task UserWonBattle(UserAccount userAccount, int winsInARow, int LureCaps, BattleStats battleStats, BattleDifficulty diff, ITextChannel battleChannel, IEnumerable <ColossoFighter> winners, bool wasMimic) { uint oldLevel = userAccount.LevelNumber; var baseXP = 20 + 5 * LureCaps + winsInARow / 4; var xpawarded = (uint)new Random().Next(baseXP, baseXP * 2) * Math.Max(3, (uint)Math.Pow(((int)diff + 1), 2)); userAccount.XP += xpawarded; userAccount.Inv.AddBalance(xpawarded / 2); uint newLevel = userAccount.LevelNumber; userAccount.ServerStats.ColossoWins++; userAccount.ServerStats.ColossoStreak++; userAccount.ServerStats.ColossoHighestStreak = Math.Max(userAccount.ServerStats.ColossoHighestStreak, userAccount.ServerStats.ColossoStreak); switch (battleStats.TotalTeamMates) { case 0: userAccount.ServerStats.ColossoHighestRoundEndlessSolo = Math.Max(userAccount.ServerStats.ColossoHighestRoundEndlessSolo, winsInARow); break; case 1: if (winsInARow > userAccount.ServerStats.ColossoHighestRoundEndlessDuo) { userAccount.ServerStats.ColossoHighestRoundEndlessDuo = winsInARow; userAccount.ServerStats.ColossoHighestRoundEndlessDuoNames = string.Join(", ", winners.Select(p => p.name)); } break; case 2: if (winsInARow > userAccount.ServerStats.ColossoHighestRoundEndlessTrio) { userAccount.ServerStats.ColossoHighestRoundEndlessTrio = winsInARow; userAccount.ServerStats.ColossoHighestRoundEndlessTrioNames = string.Join(", ", winners.Select(p => p.name)); } break; case 3: if (winsInARow > userAccount.ServerStats.ColossoHighestRoundEndlessQuad) { userAccount.ServerStats.ColossoHighestRoundEndlessQuad = winsInARow; userAccount.ServerStats.ColossoHighestRoundEndlessQuadNames = string.Join(", ", winners.Select(p => p.name)); } break; } userAccount.BattleStats += battleStats; var bs = userAccount.BattleStats; if (wasMimic || Global.Random.Next(0, 100) <= 7 + battleStats.TotalTeamMates * 2 + 4 * LureCaps + winsInARow / 10) { ChestQuality awardedChest = GetRandomChest(diff); userAccount.Inv.AwardChest(awardedChest); var embed = new EmbedBuilder(); embed.WithColor(Colors.Get("Iodem")); embed.WithDescription($"{((SocketTextChannel)battleChannel).Users.Where(u => u.Id == userAccount.ID).FirstOrDefault().Mention} found a {Inventory.ChestIcons[awardedChest]} {awardedChest} Chest!"); await battleChannel.SendMessageAsync("", false, embed.Build()); } if (userAccount.ServerStats.ColossoWins >= 15) { await GoldenSun.AwardClassSeries("Brute Series", userAccount, (SocketTextChannel)battleChannel); } if (bs.KillsByHand >= 161) { await GoldenSun.AwardClassSeries("Samurai Series", userAccount, (SocketTextChannel)battleChannel); } if (bs.DamageDealt >= 666666) { await GoldenSun.AwardClassSeries("Ninja Series", userAccount, (SocketTextChannel)battleChannel); } if (bs.SoloBattles >= 50) { await GoldenSun.AwardClassSeries("Ranger Series", userAccount, (SocketTextChannel)battleChannel); } if (bs.TotalTeamMates >= 100) { await GoldenSun.AwardClassSeries("Dragoon Series", userAccount, (SocketTextChannel)battleChannel); } if (bs.HPhealed >= 333333) { await GoldenSun.AwardClassSeries("White Mage Series", userAccount, (SocketTextChannel)battleChannel); } if (bs.Revives >= 50) { await GoldenSun.AwardClassSeries("Medium Series", userAccount, (SocketTextChannel)battleChannel); } UserAccounts.SaveAccounts(); if (oldLevel != newLevel) { var user = (SocketGuildUser)await battleChannel.GetUserAsync(userAccount.ID); // Where(s => s. == userAccount.ID).First(); Leveling.LevelUp(userAccount, user, (SocketTextChannel)battleChannel); } await Task.CompletedTask; }
internal static async void UserSentMessage(SocketGuildUser user, SocketTextChannel channel) { if (blackListedChannels.Contains(channel.Id) || channel == null || 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; uint oldLevel = userAccount.LevelNumber; if (sinceLastXP.TotalMinutes >= 3) { userAccount.LastXP = DateTime.UtcNow; userAccount.AddXp((uint)(new Random()).Next(30, 50)); } if (DateTime.Now.Date != userAccount.ServerStats.LastDayActive.Date) { userAccount.ServerStats.UniqueDaysActive++; userAccount.ServerStats.LastDayActive = DateTime.Now.Date; //if ((DateTime.Now - user.JoinedAt).Value.TotalDays > 30) //{ // await GoldenSun.AwardClassSeries("Hermit Series", user, channel); //} } if (channel.Id == GuildSettings.GetGuildSettings(channel.Guild)?.ColossoChannel?.Id) { userAccount.ServerStats.MessagesInColossoTalks++; if (userAccount.ServerStats.MessagesInColossoTalks >= 50) { _ = GoldenSun.AwardClassSeries("Swordsman Series", user, channel); } } uint 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; UserAccountProvider.StoreUser(userAccount); if (userAccount.ServerStats.ChannelSwitches >= 14) { _ = GoldenSun.AwardClassSeries("Air Pilgrim Series", user, channel); } } else { if (userAccount.ServerStats.ChannelSwitches > 0) { userAccount.ServerStats.ChannelSwitches--; } UserAccountProvider.StoreUser(userAccount); } await Task.CompletedTask; }