public async Task ItemInfo([Remainder] string name = "") { if (name == "") { return; } var item = ItemDatabase.GetItem(name); if (item.Name.Contains("NOT IMPLEMENTED")) { var emb = new EmbedBuilder(); emb.WithDescription(":x: I asked our treasurer, the weapon smith, the priest, the librarian and a cool looking kid walking by, and noone has heard of that item!"); emb.WithColor(Colors.Get("Error")); await Context.Channel.SendMessageAsync("", false, emb.Build()); return; } var embed = new EmbedBuilder(); embed.WithAuthor($"{item.Name} {(item.IsArtifact ? " (Artifact)" : "")}"); embed.AddField("Icon", item.IconDisplay, true); embed.AddField("Value", item.Price, true); embed.AddField("Type", item.ItemType, true); embed.AddField("Description", item.Summary()); embed.WithColor((item.Category == ItemCategory.Weapon && item.IsUnleashable) ? Colors.Get(item.Unleash.UnleashAlignment.ToString()) : item.IsArtifact ? Colors.Get("Artifact") : Colors.Get("Exathi")); _ = Context.Channel.SendMessageAsync("", false, embed.Build()); await Task.CompletedTask; }
public async Task YeetItem([Remainder] string item) { var avatar = UserAccounts.GetAccount(Context.User); var factory = new PlayerFighterFactory(); var p = factory.CreatePlayerFighter(Context.User); var inv = avatar.Inv; var embed = new EmbedBuilder(); if (inv.Remove(item)) { var it = ItemDatabase.GetItem(item); var maxdist = p.Stats.Atk * Math.Sqrt(p.Stats.Spd) / Math.Log(Math.Max(it.Price / 2, 2)) / 6; var level = Math.Min(avatar.LevelNumber, 100); var a = 5 + ((double)level) / 2; var b = 55 - ((double)level) / 2; var beta = new Accord.Statistics.Distributions.Univariate.BetaDistribution(a, b); embed.WithDescription($"{Context.User.Username} yeets {it.Icon}{it.Name} {Math.Round(beta.Generate(1).FirstOrDefault() * maxdist, 2)} meters away."); embed.WithColor(it.Color); await Context.Channel.SendMessageAsync("", false, embed.Build()); } else { embed.WithDescription(":x: You can only get rid of unequipped items in your possession."); embed.WithColor(Colors.Get("Error")); await Context.Channel.SendMessageAsync("", false, embed.Build()); } }
public override string Award(UserAccount userAccount) { var item = ItemDatabase.GetItem(Item); if (item != null) { userAccount.Inv.Add(Item); return($"{userAccount.Name} found a found a {item.Icon} {item.Name}!"); } return(null); }
public async Task Equip(ArchType archType, [Remainder] string item) { var account = UserAccounts.GetAccount(Context.User); var inv = account.Inv; var selectedItem = ItemDatabase.GetItem(item); if (selectedItem.ExclusiveTo == null || (selectedItem.ExclusiveTo != null && selectedItem.ExclusiveTo.Contains(account.Element))) { if (inv.Equip(item, archType)) { _ = ShowInventory(); } } await Task.CompletedTask; }
public bool Add(string item) { if (IsFull) { return(false); } var i = ItemDatabase.GetItem(item); if (i.Name.Contains("NOT IMPLEMENTED!")) { return(false); } Inv.Add(i); UpdateStrings(); return(true); }
public async Task SellItem([Remainder] string item) { var inv = UserAccounts.GetAccount(Context.User).Inv; var embed = new EmbedBuilder(); if (inv.Sell(item)) { var it = ItemDatabase.GetItem(item); embed.WithDescription($"Sold {it.Icon}{it.Name} for <:coin:569836987767324672> {it.SellValue}."); embed.WithColor(it.Color); await Context.Channel.SendMessageAsync("", false, embed.Build()); } else { embed.WithDescription(":x: You can only sell unequipped items in your possession."); embed.WithColor(Colors.Get("Error")); await Context.Channel.SendMessageAsync("", false, embed.Build()); } }
public bool Buy(string item) { var i = ItemDatabase.GetItem(item); if (i.Name.Contains("NOT IMPLEMENTED!")) { return(false); } if (IsFull) { return(false); } if (!RemoveBalance(i.Price)) { return(false); } return(Add(i.Name)); }
public async Task Equip(ArchType archType, [Remainder] string item) { var account = UserAccounts.GetAccount(Context.User); var inv = account.Inv; var selectedItem = ItemDatabase.GetItem(item); if (selectedItem.Name.Contains("NOT IMPLEMENTED")) { var emb = new EmbedBuilder(); emb.WithDescription(":x: I asked our treasurer, the weapon smith, the priest, the librarian and a cool looking kid walking by, and no one has heard of that item!"); emb.WithColor(Colors.Get("Error")); await Context.Channel.SendMessageAsync("", false, emb.Build()); return; } if (!inv.HasItem(selectedItem.Name)) { await Context.Channel.SendMessageAsync(embed : new EmbedBuilder() .WithColor(Colors.Get("Error")) .WithDescription($":x: You do not have that item.") .Build()); return; } if (selectedItem.ExclusiveTo == null || (selectedItem.ExclusiveTo != null && selectedItem.ExclusiveTo.Contains(account.Element))) { if (inv.Equip(item, archType)) { _ = ShowInventory(); return; } } await Context.Channel.SendMessageAsync(embed : new EmbedBuilder() .WithColor(Colors.Get("Error")) .WithDescription($":x: {archType}s cannot equip {selectedItem.ItemType}s.") .Build()); }
public bool Unequip(string item) { var it = ItemDatabase.GetItem(item); if (!WarriorGear.Any(i => i.Name.Equals(it.Name, StringComparison.CurrentCultureIgnoreCase)) && !MageGear.Any(i => i.Name.Equals(it.Name, StringComparison.CurrentCultureIgnoreCase))) { return(false); } if (it.IsCursed) { return(false); } WarriorGear.RemoveAll(i => i.Name.Equals(it.Name, StringComparison.CurrentCultureIgnoreCase)); MageGear.RemoveAll(i => i.Name.Equals(it.Name, StringComparison.CurrentCultureIgnoreCase)); UpdateStrings(); return(true); }
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 string Award(UserAccount userAccount) { List <string> awardLog = new List <string>(); if (RequireTag.Count > 0 && !RequireTag.All(t => userAccount.Tags.Contains(t))) { return(""); } if (Obtainable > 0 && userAccount.Tags.Count(r => r.Equals(Tag)) >= Obtainable) { return(""); } var giveTag = true; userAccount.AddXp(xp); userAccount.Inv.AddBalance(coins); if (HasChest) { userAccount.Inv.AwardChest(Chest); awardLog.Add($"{userAccount.Name} found a {Inventory.ChestIcons[Chest]} {Chest} chest!"); } if (Item != "") { var item = ItemDatabase.GetItem(Item); if (userAccount.Inv.Add(Item)) { awardLog.Add($"{userAccount.Name} found a {item.Icon} {item.Name}!"); } else { giveTag = false; } } if (EnemiesDatabase.TryGetDungeon(Dungeon, out var dungeon)) { if (!userAccount.Dungeons.Contains(dungeon.Name)) { userAccount.Dungeons.Add(dungeon.Name); awardLog.Add($"{userAccount.Name} found a {(dungeon.IsOneTimeOnly ? "<:dungeonkey:606237382047694919> Key" : "<:mapclosed:606236181486632985> Map")} to {dungeon.Name}!"); } } if (DjinnAndSummonsDatabase.TryGetDjinn(Djinn, out var djinn)) { if (!userAccount.DjinnPocket.djinn.Any(d => d.Djinnname == djinn.Djinnname)) { if (userAccount.DjinnPocket.AddDjinn(djinn)) { awardLog.Add($"{userAccount.Name} found the {djinn.Element} djinni {djinn.Emote} {djinn.Name}!"); if (userAccount.DjinnPocket.djinn.Count == 1) { awardLog.Add($"You have found your first djinni, the {djinn.Element} djinni {djinn.Emote} {djinn.Name}. " + $"To view what it can do, use the djinninfo command `i!di {djinn.Name}` and to take it with you on your journey, use `i!djinn take {djinn.Name}`. " + $"In battle you can use a djinn to unleash its powers. After that it will go into \"Ready\" mode. From there you can use it to call a summon. After summoning, a djinn will take some turns to recover. " + $"You can also team up with other people to use a higher number of djinn in even more powerful summon sequences! " + $"Make sure to check `i!help DjinnAndSummons` for a full list of the commands related to djinn!"); } } else { giveTag = false; } } else { giveTag = false; } } else if (Enum.TryParse <Element>(Djinn, out var element)) { djinn = DjinnAndSummonsDatabase.GetRandomDjinn(element); djinn.IsShiny = Global.Random.Next(0, 128) == 0; djinn.UpdateMove(); if (userAccount.DjinnPocket.AddDjinn(djinn)) { awardLog.Add($"{userAccount.Name} found the {djinn.Element} djinni {djinn.Emote} {djinn.Name}!"); if (userAccount.DjinnPocket.djinn.Count == 1) { awardLog.Add($"You have found your first djinni, the {djinn.Element} djinni {djinn.Emote} {djinn.Name}. " + $"To view what it can do, use the djinninfo command `i!di {djinn.Name}` and to take it with you on your journey, use `i!djinn take {djinn.Name}` as long as it matches one of your classes elements. " + $"In battle you can use a djinn to unleash its powers. After that it will go into \"Ready\" mode. From there you can use it to call a summon. After summoning, a djinn will take some turns to recover. " + $"You can also team up with other people to use a higher number of djinn in even more powerful summon sequences! " + $"Find more djinn by battling them in various towns and locations, and with some luck they will join you." + $"Make sure to check `i!help DjinnAndSummons` for a full list of the commands related to djinn!"); } } else { giveTag = false; } } if (DjinnAndSummonsDatabase.TryGetSummon(Summon, out var summon)) { if (!userAccount.DjinnPocket.summons.Contains(summon)) { userAccount.DjinnPocket.AddSummon(summon); awardLog.Add($"{userAccount.Name} found the summon tablet for {summon.Emote} {summon.Name}!"); } } if (Message != "") { awardLog.Add(string.Format(Message, userAccount.Name)); } if (giveTag && Tag != "") { userAccount.Tags.Add(Tag); } return(string.Join("\n", awardLog)); }
private async Task OpenChestAsync(SocketCommandContext Context, ChestQuality cq) { var user = EntityConverter.ConvertUser(Context.User); var inv = user.Inv; if (inv.IsFull) { var emb = new EmbedBuilder(); emb.WithDescription(":x: Inventory capacity reached!"); emb.WithColor(Colors.Get("Error")); await Context.Channel.SendMessageAsync("", false, emb.Build()); return; } if (!inv.OpenChest(cq)) { var emb = new EmbedBuilder(); if (cq == ChestQuality.Daily) { emb.WithDescription($":x: No {cq} Chests remaining! Next Daily Chest in: {DateTime.Today.AddDays(1).Subtract(DateTime.Now):hh\\h\\ mm\\m}"); } else { emb.WithDescription($":x: No {cq} Chests remaining!"); } emb.WithColor(Colors.Get("Error")); await Context.Channel.SendMessageAsync("", false, emb.Build()); return; } var itemName = ""; var dailyRewards = new[] { 0, 0, 1, 1, 2 }; if (cq == ChestQuality.Daily) { var value = user.LevelNumber; itemName = ItemDatabase.GetRandomItem((ItemRarity)(dailyRewards[inv.DailiesInARow % dailyRewards.Length] + Math.Min(2, value / 33))); } else { var rarity = ItemDatabase.ChestValues[cq].GenerateReward(); itemName = ItemDatabase.GetRandomItem(rarity); } var item = ItemDatabase.GetItem(itemName); inv.Add(item.Name); UserAccountProvider.StoreUser(user); var embed = new EmbedBuilder(); embed.WithDescription($"Opening {cq} Chest {Inventory.ChestIcons[cq]}..."); embed.WithColor(Colors.Get("Iodem")); var msg = await Context.Channel.SendMessageAsync("", false, embed.Build()); embed = new EmbedBuilder(); embed.WithColor(item.Color); if (cq == ChestQuality.Daily) { embed.WithFooter($"Current Reward: {inv.DailiesInARow % dailyRewards.Length + 1}/{dailyRewards.Length} | Overall Streak: {inv.DailiesInARow + 1}"); } embed.WithDescription($"{Inventory.ChestIcons[cq]} You found a {item.Name} {item.IconDisplay}"); await Task.Delay((int)cq * 700); _ = msg.ModifyAsync(m => m.Embed = embed.Build()); var message = await Context.Channel.AwaitMessage(m => m.Author == Context.User); if (message != null && message.Content.Equals("Sell", StringComparison.OrdinalIgnoreCase)) { _ = SellItem(item.Name); } }
private async Task OpenChestAsync(SocketCommandContext Context, ChestQuality cq, uint bonusCount = 0) { var user = UserAccounts.GetAccount(Context.User); var inv = user.Inv; if (inv.IsFull) { var emb = new EmbedBuilder(); emb.WithDescription(":x: Inventory capacity reached!"); emb.WithColor(Colors.Get("Error")); await Context.Channel.SendMessageAsync("", false, emb.Build()); return; } if (!inv.RemoveBalance(bonusCount)) { var emb = new EmbedBuilder(); emb.WithDescription(":x: Not enough Funds!"); emb.WithColor(Colors.Get("Error")); await Context.Channel.SendMessageAsync("", false, emb.Build()); return; } if (!inv.OpenChest(cq)) { var emb = new EmbedBuilder(); if (cq == ChestQuality.Daily) { emb.WithDescription($":x: No {cq} Chests remaining! Next Daily Chest in: {DateTime.Today.AddDays(1).Subtract(DateTime.Now).ToString(@"hh\h\ mm\m")}"); } else { emb.WithDescription($":x: No {cq} Chests remaining!"); } emb.WithColor(Colors.Get("Error")); await Context.Channel.SendMessageAsync("", false, emb.Build()); return; } double bonus = (bonusCount > 0 ? Math.Log(bonusCount) / Math.Log(5) : 0); var value = user.LevelNumber; if (cq != ChestQuality.Daily) { value = (((uint)cq) + 1) * 11; } var itemName = ItemDatabase.GetRandomItem(value, bonus, (int)cq == 3 || (int)cq == 4 || ((int)cq == 5 && value >= 40) ? ItemDatabase.RandomItemType.Artifact : ItemDatabase.RandomItemType.Any); var item = ItemDatabase.GetItem(itemName); var embed = new EmbedBuilder(); embed.WithDescription($"Opening {cq} Chest {Inventory.ChestIcons[cq]}..."); embed.WithColor(Colors.Get("Iodem")); var msg = await Context.Channel.SendMessageAsync("", false, embed.Build()); embed = new EmbedBuilder(); embed.WithColor(item.Color); embed.WithDescription($"{Inventory.ChestIcons[cq]} You found a {item.Name} {item.IconDisplay}"); await Task.Delay((int)cq * 700); _ = msg.ModifyAsync(m => m.Embed = embed.Build()); inv.Add(item.Name); }
public override string Award(UserAccount userAccount) { List <string> awardLog = new List <string>(); if (RequireTag.Count > 0 && !RequireTag.All(t => userAccount.Tags.Contains(t))) { return(""); } if (Obtainable > 0 && userAccount.Tags.Count(r => r.Equals(Tag)) >= Obtainable) { return(""); } var giveTag = true; userAccount.AddXp(Xp); userAccount.Inv.AddBalance(Coins); if (HasChest) { userAccount.Inv.AwardChest(Chest); awardLog.Add($"{userAccount.Name} found a {Inventory.ChestIcons[Chest]} {Chest} chest!"); } if (Item != "") { var item = ItemDatabase.GetItem(Item); if (userAccount.Inv.Add(Item)) { awardLog.Add($"{userAccount.Name} found a {item.Icon} {item.Name}!"); } else { giveTag = false; } } if (EnemiesDatabase.TryGetDungeon(Dungeon, out var dungeon)) { if (!userAccount.Dungeons.Contains(dungeon.Name)) { userAccount.Dungeons.Add(dungeon.Name); awardLog.Add($"{userAccount.Name} found a {(dungeon.IsOneTimeOnly ? "<:dungeonkey:606237382047694919> Key" : "<:mapclosed:606236181486632985> Map")} to {dungeon.Name}!"); } } if (DjinnAndSummonsDatabase.TryGetDjinn(Djinn, out var djinn)) { if (userAccount.DjinnPocket.AddDjinn(djinn)) { awardLog.Add($"{userAccount.Name} found the {djinn.Element} djinni {djinn.Emote} {djinn.Name}!"); if (userAccount.DjinnPocket.Djinn.Count == 1) { awardLog.Add($"You have found your first djinni, the {djinn.Element} djinni {djinn.Emote} {djinn.Name}. " + $"To view what it can do, use the djinninfo command `i!di {djinn.Name}` and to take it with you on your journey, use `i!djinn take {djinn.Name}`. " + $"In battle you can use a djinn to unleash its powers. After that it will go into \"Ready\" mode. From there you can use it to call a summon. After summoning, a djinn will take some turns to recover. " + $"You can also team up with other people to use a higher number of djinn in even more powerful summon sequences! " + $"Make sure to check `i!help DjinnAndSummons` for a full list of the commands related to djinn!"); } if (djinn.IsEvent && userAccount.DjinnPocket.Djinn.Count(d => d.IsEvent) == 1) { awardLog.Add($"Congratulations, You have found an **Event Djinni**! They are custom made djinni, only available within the event, as a small trinket for your participation. " + $"They behave differently to other djinn, in that they will not count towards your Djinn Pocket limit or any class upgrades, " + $"however they will carry over if you decide to reset your game :)" + $"(Event Djinn will not be allowed in any upcoming tournaments.)"); } if (userAccount.DjinnPocket.Djinn.Count == userAccount.DjinnPocket.PocketSize) { awardLog.Add($"Attention! Your Djinn Pocket has reached its limit. " + $"In order to further obtain djinn, you must either make space by releasing djinn or upgrading it using `i!upgradedjinn`!"); } } else { giveTag = false; } } else if (Enum.TryParse <Element>(Djinn, out var element)) { djinn = DjinnAndSummonsDatabase.GetRandomDjinn(element); bool isShiny = Global.RandomNumber(0, 128 - userAccount.DjinnBadLuck < 0 ? 0 : 128 - userAccount.DjinnBadLuck) <= 0; if (!isShiny && userAccount.DjinnPocket.Djinn.Any(d => d.Djinnname == djinn.Djinnname)) { djinn = DjinnAndSummonsDatabase.GetRandomDjinn(element); } djinn.IsShiny = isShiny && djinn.CanBeShiny; djinn.UpdateMove(); if (userAccount.DjinnPocket.AddDjinn(djinn)) { awardLog.Add($"{userAccount.Name} found the {djinn.Element} djinni {djinn.Emote} {djinn.Name}!"); if (userAccount.DjinnPocket.Djinn.Count == 1) { awardLog.Add($"You have found your first djinni, the {djinn.Element} djinni {djinn.Emote} {djinn.Name}. " + $"To view what it can do, use the djinninfo command `i!di {djinn.Name}` and to take it with you on your journey, use `i!djinn take {djinn.Name}` as long as it matches one of your classes elements. " + $"In battle you can use a djinn to unleash its powers. After that it will go into \"Ready\" mode. From there you can use it to call a summon. After summoning, a djinn will take some turns to recover. " + $"You can also team up with other people to use a higher number of djinn in even more powerful summon sequences! " + $"Find more djinn by battling them in various towns and locations, and with some luck they will join you." + $"Make sure to check `i!help DjinnAndSummons` for a full list of the commands related to djinn!"); } if (userAccount.DjinnPocket.Djinn.Count == userAccount.DjinnPocket.PocketSize) { awardLog.Add($"Attention! Your Djinn Pocket has reached its limit. " + $"In order to further obtain djinn, you must either make space by releasing djinn or upgrading it using `i!upgradedjinn`!"); } if (djinn.IsShiny) { userAccount.DjinnBadLuck = 0; } else if (djinn.CanBeShiny) { userAccount.DjinnBadLuck++; } } else { giveTag = false; } } if (DjinnAndSummonsDatabase.TryGetSummon(Summon, out var summon)) { if (!userAccount.DjinnPocket.Summons.Contains(summon)) { userAccount.DjinnPocket.AddSummon(summon); awardLog.Add($"{userAccount.Name} found the summon tablet for {summon.Emote} {summon.Name}!"); } } if (Message != "") { awardLog.Add(string.Format(Message, userAccount.Name)); } if (giveTag && Tag != "") { userAccount.Tags.Add(Tag); } return(string.Join("\n", awardLog)); }