public async Task SellAllSkinsOfRarity(Rarity rarity) { await QuickEmbed($"Selling skins of rarity {CSGOConfigs.LogRarity(rarity)}"); UserData user = GetUserData(Context.Message.Author.Id); int numberSold = 0; int moneymade = 0; for (int i = user.skins.Count - 1; i >= 0; i--) //needs to reverse because list gets edited throughout the looop { SkinInstance s = user.skins[i]; if (s.skinData.rarity == rarity) { numberSold++; moneymade += s.worth; user.skins.RemoveAt(i); } } if (numberSold == 0) { await QuickEmbed($"No {CSGOConfigs.LogRarity(rarity)} skins found in your inventory!"); return; } user.cash += moneymade; ChangeUserData(Context.Message.Author.Id, user); await QuickEmbed($"{Context.Message.Author.Mention} sold {numberSold} {CSGOConfigs.LogRarity(rarity)} skins for **${moneymade}**"); }
public async Task Inspect(int index) { if (index < 0) { await EnterNonNegativeValue(); return; } List <SkinInstance> skins = GetUserData(Context.Message.Author.Id).skins; if (index >= skins.Count) { await QuickEmbed($"Please enter a number between 0 and {skins.Count - 1}"); return; } SkinInstance skin = skins[index]; var e = new EmbedBuilder(); e.WithDescription($"{Context.Message.Author.Mention}'s **{skin.skinData.weapon} {skin.skinData.name}**") .AddField("=======================", $"Value: **${skin.worth}**\n" + $"Float: **{skin.floatValue}**\n" + $"Condition: **{CSGOConfigs.LogCondition(skin.condition)}**\n" + $"Rarity: **{CSGOConfigs.LogRarity(skin.skinData.rarity)}**\n" + $"Stattrak? **{(skin.stattrak? "YES" : "NO")}**\n" + $"ID: **{skin.id}**\n" + $"Description: *{skin.skinData.description}*") .WithColor(CSGOConfigs.GetColor(skin.skinData.rarity)); if (skin.skinData.imageURL != "") { e.WithImageUrl(skin.skinData.imageURL); } await ReplyAsync(embed : e.Build()); }