general store update
also some updated fish emoji
This commit is contained in:
@@ -235,18 +235,19 @@ namespace Kehyeedra3.Commands
|
||||
int rari = (SRandom.Next(0, 2001));
|
||||
int weigh = SRandom.Next(10, 1501+prestige*500);
|
||||
int tierRoll = SRandom.Next(0, 81+prestige*40);
|
||||
int dCatchRoll = SRandom.Next(0, 1000+prestige*5);
|
||||
int dCatchRoll = SRandom.Next(0, 1000+prestige*20);
|
||||
int dcatch = 1;
|
||||
ulong rarity;
|
||||
int weight;
|
||||
|
||||
if (dCatchRoll > 1000)
|
||||
{
|
||||
int many = 995;
|
||||
while (many+5 <= dCatchRoll)
|
||||
int many = 1020;
|
||||
dcatch += 1;
|
||||
while (many+20 < dCatchRoll)
|
||||
{
|
||||
dcatch += 1;
|
||||
many += 5;
|
||||
many += 10+(dcatch*5);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,10 +256,15 @@ namespace Kehyeedra3.Commands
|
||||
rarity = level * 10 + (ulong)rari;
|
||||
weight = (int)level * 5 + weigh;
|
||||
}
|
||||
else if (level < 100 && prestige == 1)
|
||||
{
|
||||
rarity = 1000 + (ulong)rari;
|
||||
weight = (int)level * 2 + 500 + weigh;
|
||||
}
|
||||
else
|
||||
{
|
||||
rarity = 1000 + (ulong)rari;
|
||||
weight = 500 + weigh;
|
||||
weight = 700 + weigh;
|
||||
}
|
||||
|
||||
Fish fish;
|
||||
@@ -692,8 +698,20 @@ namespace Kehyeedra3.Commands
|
||||
{
|
||||
fishmote = fishes.FirstOrDefault(x => x.Id == entry.Key).Name;
|
||||
}
|
||||
|
||||
fishtext = $"{fishmote} [ **S**-{entry.Value[0]} **M**-{entry.Value[1]} **L**-{entry.Value[2]} ]\n";
|
||||
fishtext = $"{fishmote} [";
|
||||
if (entry.Value[0] > 0)
|
||||
{
|
||||
fishtext += $" **S**-{entry.Value[0]}";
|
||||
}
|
||||
if (entry.Value[1] > 0)
|
||||
{
|
||||
fishtext += $" **M**-{entry.Value[1]}";
|
||||
}
|
||||
if (entry.Value[2] > 0)
|
||||
{
|
||||
fishtext += $" **L**-{entry.Value[2]}";
|
||||
}
|
||||
fishtext += $" ]\n";
|
||||
|
||||
if (legfish.Any( f => f.Id == entry.Key))
|
||||
{
|
||||
@@ -1035,23 +1053,23 @@ namespace Kehyeedra3.Commands
|
||||
var pers = Database.Users.FirstOrDefault(x => x.Id == person.Id);
|
||||
if (user.Money < amount)
|
||||
{
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention} You don't have that much money??");
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou don't have that much money??");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (user.Id == person.Id)
|
||||
{
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention} You have transferred your money to yourself???");
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou have transferred your money to yourself???");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pers.GrantMoney(Database.Users.FirstOrDefault(x => x.Id == 0), amount) && user.GrantMoney(Database.Users.FirstOrDefault(x => x.Id == 0), -amount))
|
||||
{
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention} **{((long)amount).ToYeedraDisplay()}%** has been transferred from your account.");
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n**{((long)amount).ToYeedraDisplay()}%** has been transferred from your account.");
|
||||
}
|
||||
else
|
||||
{
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention} You can't afford that, go back to the mines.");
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou can't afford that, go back to the mines.");
|
||||
}
|
||||
await Database.SaveChangesAsync();
|
||||
}
|
||||
@@ -1060,7 +1078,7 @@ namespace Kehyeedra3.Commands
|
||||
}
|
||||
else
|
||||
{
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention} That's not how this works??");
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nNothing has been transferred from your account.\nGood job kiddo.");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1173,13 +1191,13 @@ namespace Kehyeedra3.Commands
|
||||
if (user.Prestige > 0)
|
||||
{
|
||||
pres = $" +{user.Prestige}P";
|
||||
cawe = 510;
|
||||
cawe = 500;
|
||||
}
|
||||
else
|
||||
{
|
||||
cawe = user.Lvl * 5d + 10d;
|
||||
}
|
||||
await Context.Channel.SendMessageAsync($"{otherUser.Mention}'s stats\nFishing level: **{user.Lvl}{pres}**+P{user.Prestige}\nMax catch weight: **{(user.Lvl * 5 + 2000d + user.Prestige*500d) / 100}kg**\nMin catch weight: **{cawe / 100}kg**\n" +
|
||||
await Context.Channel.SendMessageAsync($"{otherUser.Mention}'s stats\nFishing level: **{user.Lvl}{pres}**\nMax catch weight: **{(user.Lvl * 5 + 2000d + user.Prestige*500d) / 100}kg**\nMin catch weight: **{cawe / 100}kg**\n" +
|
||||
$"Fishing xp: **{user.TXp}**\nTotal fish: **{scount + mcount + lcount}** *(Large: {lcount} Medium: {mcount} Small: {scount}*)\nBalance: **{muser.Money.ToYeedraDisplay()}%**");
|
||||
}
|
||||
}
|
||||
@@ -1251,13 +1269,13 @@ namespace Kehyeedra3.Commands
|
||||
}
|
||||
}
|
||||
}
|
||||
[Command("xptolevel"),Alias("tolv", "xpto"),Summary("Displays how much xp you need to reach the given level.")]
|
||||
public async Task XpToNextLevl(ulong lvl, string xp = null)
|
||||
[Command("xptolevel"),Alias("tolv", "xpto"),Summary("Displays how much xp you need to reach the given level / amount of xp.")]
|
||||
public async Task XpToNextLevl(ulong lvl, IUser otheruser = null)
|
||||
{
|
||||
ulong lvlXp = 50;
|
||||
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
|
||||
{
|
||||
if (lvl > 1 && lvl <= 200 && xp == null)
|
||||
if (lvl > 1 && lvl <= 200)
|
||||
{
|
||||
for (ulong i = 1; i < lvl; i++)
|
||||
{
|
||||
@@ -1276,38 +1294,14 @@ namespace Kehyeedra3.Commands
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nThat's not really possible?");
|
||||
return;
|
||||
}
|
||||
else if (lvl > 200 && xp == null)
|
||||
else if (lvl > 200)
|
||||
{
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n**Lvl 200** is the maximum lvl");
|
||||
return;
|
||||
}
|
||||
|
||||
var user = Database.Fishing.FirstOrDefault(x => x.Id == Context.User.Id);
|
||||
if (xp != null && xp == "xp")
|
||||
{
|
||||
if (user == null)
|
||||
{
|
||||
{
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\n???");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (user.TXp >= lvl)
|
||||
{
|
||||
await Context.Channel.SendMessageAsync($"XP since you reached **{lvl}xp : {user.TXp - lvl}**" +
|
||||
$"\nCurrent XP : **{user.TXp}**");
|
||||
}
|
||||
else
|
||||
{
|
||||
await Context.Channel.SendMessageAsync($"XP left until **{lvl}xp : {lvl - user.TXp}**" +
|
||||
$"\nCurrent XP : **{user.TXp}**" +
|
||||
$"\nProgress to goal : **~{Math.Round(((user.TXp * 100d) / lvl), 0, MidpointRounding.ToEven)}%**");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (user == null)
|
||||
{
|
||||
{
|
||||
@@ -1330,7 +1324,7 @@ namespace Kehyeedra3.Commands
|
||||
$"\nProgress to goal : **~{Math.Round(((user.TXp * 100d) / lvlXp), 0, MidpointRounding.ToEven)}%**");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,8 +105,7 @@ namespace Kehyeedra3.Commands
|
||||
{
|
||||
coommands.Append(cmd.Name);
|
||||
|
||||
if (cmd != module.Commands.LastOrDefault())
|
||||
coommands.Append(", ");
|
||||
if (cmd != module.Commands.LastOrDefault()) coommands.Append(", ");
|
||||
}
|
||||
}
|
||||
embed.AddField(module.Name, coommands.ToString());
|
||||
|
||||
@@ -6,6 +6,7 @@ using Kehyeedra3.Services.Models;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Enumeration;
|
||||
using System.IO.IsolatedStorage;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -349,68 +350,357 @@ namespace Kehyeedra3.Commands
|
||||
|
||||
}
|
||||
}
|
||||
[RequireRolePrecondition(AccessLevel.BotOwner)]
|
||||
|
||||
[Command("gstore", RunMode = RunMode.Async),Alias("gs")]
|
||||
public async Task GeneralStore(string input = null)
|
||||
{
|
||||
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
|
||||
{
|
||||
Dictionary<Items, int[]> items = new Dictionary<Items, int[]>();
|
||||
Dictionary<FishSpecies, int[]> fishinv = new Dictionary<FishSpecies, int[]>();
|
||||
List<User.Item> itemlist = User.ListItems();
|
||||
List<Fish> fishes = Fishing.GetFishList();
|
||||
|
||||
User.Item item;
|
||||
Fish fish;
|
||||
|
||||
var fuser = Database.Fishing.FirstOrDefault(x => x.Id == Context.User.Id);
|
||||
var user = Database.Users.FirstOrDefault(x => x.Id == Context.User.Id);
|
||||
var inv = fuser.GetInventory();
|
||||
|
||||
if (fuser == null)
|
||||
{
|
||||
fuser = new Fishing
|
||||
{
|
||||
Id = user.Id
|
||||
};
|
||||
|
||||
Database.Fishing.Add(fuser);
|
||||
await Database.SaveChangesAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
fishinv = fuser.GetInventory();
|
||||
}
|
||||
|
||||
if (user.GeneralInventory == null || user.GeneralInventory.Length < 3 )
|
||||
{
|
||||
user.GeneralInventory = "{}";
|
||||
await Database.SaveChangesAsync();
|
||||
}
|
||||
|
||||
string itemtxt = "";
|
||||
|
||||
foreach (User.Item i in itemlist)
|
||||
{
|
||||
itemtxt += $"{(int)i.Id} : {i.Name} for {((long)i.Price).ToYeedraDisplay()}%\n";
|
||||
}
|
||||
|
||||
if (input != null)
|
||||
{
|
||||
input = input.ToLowerInvariant();
|
||||
}
|
||||
|
||||
if (input == null)
|
||||
{
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nHere's a list of available items.");
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nPlease specify 'b / buy' to buy items, or 's / sell' to sell items.");
|
||||
}
|
||||
else if (input == "b" || input == "buy")
|
||||
{
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSpecify the item.");
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSpecify the item.\n{itemtxt}");
|
||||
var inp = await NextMessageAsync();
|
||||
switch (Convert.ToInt32(inp))
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
|
||||
item = itemlist.FirstOrDefault(i => (int)i.Id == int.Parse(inp.Content));
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSpecify the amount.");
|
||||
inp = await NextMessageAsync();
|
||||
|
||||
items = user.GetGenInve();
|
||||
|
||||
int[] amount = { 0 };
|
||||
|
||||
if (!items.TryGetValue(item.Id, out amount))
|
||||
{
|
||||
amount = new int[] { 0 };
|
||||
items.Add(item.Id, amount);
|
||||
}
|
||||
break;
|
||||
|
||||
if (int.Parse(inp.Content) * item.Price <= user.Money)
|
||||
{
|
||||
amount[0] += int.Parse(inp.Content);
|
||||
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nThis will cost you {ulong.Parse(inp.Content) * (ulong)item.Price}.\nType 'ok' to confirm.");
|
||||
inp = await NextMessageAsync();
|
||||
if (inp.Content.ToLowerInvariant() == "ok")
|
||||
{
|
||||
if (!user.GrantMoney(Database.Users.FirstOrDefault(x => x.Id == 0), -(amount[0] * item.Price)))
|
||||
{
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nBank has no money, convince someone to gamble.");
|
||||
return;
|
||||
}
|
||||
user.SetGenInve(items);
|
||||
await Database.SaveChangesAsync();
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nBought {int.Parse(inp.Content)} of {item.Name}.");
|
||||
}
|
||||
else
|
||||
{
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nPlease come back when you feel like spending.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nCome back when you're a little, MMMMMMmmmm, richer.");
|
||||
}
|
||||
}
|
||||
else if (input == "s" || input == "sell")
|
||||
{
|
||||
int value = 0;
|
||||
FishSize size;
|
||||
if (fuser.Inventory.Length < 3)
|
||||
{
|
||||
await Context.Channel.SendMessageAsync($"Your inventory is empty. Try fishing more.");
|
||||
return;
|
||||
}
|
||||
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSpecify the tier.\n");
|
||||
var inp = await NextMessageAsync();
|
||||
int tier = int.Parse(inp.Content);
|
||||
|
||||
List<Fish> legfish = fishes.Where(f => (int)f.Rarity == (int)FishRarity.Legendary).ToList();
|
||||
List<Fish> rarfish = fishes.Where(f => (int)f.Rarity == (int)FishRarity.Rare).ToList();
|
||||
List<Fish> uncfish = fishes.Where(f => (int)f.Rarity == (int)FishRarity.Uncommon).ToList();
|
||||
List<Fish> comfish = fishes.Where(f => (int)f.Rarity == (int)FishRarity.Common).ToList();
|
||||
if (tier > 1 && tier < 5)
|
||||
{
|
||||
switch (tier)
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
|
||||
legfish = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T2Legendary).ToList();
|
||||
rarfish = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T2Rare).ToList();
|
||||
uncfish = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T2Uncommon).ToList();
|
||||
comfish = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T2Common).ToList();
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
|
||||
legfish = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T3Legendary).ToList();
|
||||
rarfish = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T3Rare).ToList();
|
||||
uncfish = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T3Uncommon).ToList();
|
||||
comfish = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T3Common).ToList();
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
{
|
||||
|
||||
legfish = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T4Legendary).ToList();
|
||||
rarfish = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T4Rare).ToList();
|
||||
uncfish = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T4Uncommon).ToList();
|
||||
comfish = fishes.Where(f => (int)f.Rarity == (int)FishRarity.T4Common).ToList();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
else if (input == "s" || input == "sell")
|
||||
else if (tier < 1 || tier > 4)
|
||||
{
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSpecify the item.");
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nTier not available.");
|
||||
return;
|
||||
}
|
||||
|
||||
var inp = await NextMessageAsync();
|
||||
string legendary = "";
|
||||
string rare = "";
|
||||
string uncommon = "";
|
||||
string common = "";
|
||||
string fishtext = "";
|
||||
|
||||
foreach (var entry in fishinv)
|
||||
{
|
||||
fishtext = $"{(int)entry.Key} : {entry.Key} [";
|
||||
if (entry.Value[0] > 0)
|
||||
{
|
||||
fishtext += $" **S**-{entry.Value[0]}";
|
||||
}
|
||||
if (entry.Value[1] > 0)
|
||||
{
|
||||
fishtext += $" **M**-{entry.Value[1]}";
|
||||
}
|
||||
if (entry.Value[2] > 0)
|
||||
{
|
||||
fishtext += $" **L**-{entry.Value[2]}";
|
||||
}
|
||||
fishtext += $" ]\n";
|
||||
|
||||
if (legfish.Any(f => f.Id == entry.Key))
|
||||
{
|
||||
legendary += $"{fishtext}";
|
||||
}
|
||||
if (rarfish.Any(f => f.Id == entry.Key))
|
||||
{
|
||||
rare += $"{fishtext}";
|
||||
}
|
||||
if (uncfish.Any(f => f.Id == entry.Key))
|
||||
{
|
||||
uncommon += $"{fishtext}";
|
||||
}
|
||||
if (comfish.Any(f => f.Id == entry.Key))
|
||||
{
|
||||
common += $"{fishtext}";
|
||||
}
|
||||
}
|
||||
|
||||
string locker = "";
|
||||
if (legendary != "")
|
||||
{
|
||||
locker += $"{legendary}\n";
|
||||
}
|
||||
if (rare != "")
|
||||
{
|
||||
locker += $"{rare}\n";
|
||||
}
|
||||
if (uncommon != "")
|
||||
{
|
||||
locker += $"{uncommon}\n";
|
||||
}
|
||||
locker += $"{common}";
|
||||
if (locker == "")
|
||||
{
|
||||
await Context.Channel.SendMessageAsync($"You don't have anything to sell in this tier.");
|
||||
return;
|
||||
}
|
||||
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSpecify the item.\n\n{locker}");
|
||||
inp = await NextMessageAsync();
|
||||
fish = fishes.FirstOrDefault(i => (int)i.Id == int.Parse(inp.Content));
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSpecify the size. 0 = small, 1 = medium, 2 = large\n");
|
||||
inp = await NextMessageAsync();
|
||||
size = (FishSize)int.Parse(inp.Content);
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nSpecify the amount.\n");
|
||||
inp = await NextMessageAsync();
|
||||
int amount = int.Parse(inp.Content);
|
||||
int amountcheck = fishinv.FirstOrDefault(f => f.Key == fish.Id).Value[(int)size];
|
||||
if (amountcheck < amount)
|
||||
{
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou don't have that many.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
switch (fish.Rarity)
|
||||
{
|
||||
case FishRarity.Legendary:
|
||||
{
|
||||
value = 700;
|
||||
}
|
||||
break;
|
||||
case FishRarity.Rare:
|
||||
{
|
||||
value = 6 * (int)(size+1);
|
||||
}
|
||||
break;
|
||||
case FishRarity.Uncommon:
|
||||
{
|
||||
value = 2 * (int)(size+1);
|
||||
}
|
||||
break;
|
||||
case FishRarity.Common:
|
||||
{
|
||||
value = (int)(size+1);
|
||||
}
|
||||
break;
|
||||
case FishRarity.T2Legendary:
|
||||
{
|
||||
value = 750;
|
||||
}
|
||||
break;
|
||||
case FishRarity.T2Rare:
|
||||
{
|
||||
value = 12 * (int)(size+1);
|
||||
}
|
||||
break;
|
||||
case FishRarity.T2Uncommon:
|
||||
{
|
||||
value = 4 * (int)(size+1);
|
||||
}
|
||||
break;
|
||||
case FishRarity.T2Common:
|
||||
{
|
||||
value = 2 * (int)(size+1);
|
||||
}
|
||||
break;
|
||||
case FishRarity.T3Legendary:
|
||||
{
|
||||
value = 800;
|
||||
}
|
||||
break;
|
||||
case FishRarity.T3Rare:
|
||||
{
|
||||
value = 18 * (int)(size+1);
|
||||
}
|
||||
break;
|
||||
case FishRarity.T3Uncommon:
|
||||
{
|
||||
value = 6 * (int)(size+1);
|
||||
}
|
||||
break;
|
||||
case FishRarity.T3Common:
|
||||
{
|
||||
value = 3 * (int)(size+1);
|
||||
}
|
||||
break;
|
||||
case FishRarity.T4Legendary:
|
||||
{
|
||||
value = 850;
|
||||
}
|
||||
break;
|
||||
case FishRarity.T4Rare:
|
||||
{
|
||||
value = 32 * (int)(size+1);
|
||||
}
|
||||
break;
|
||||
case FishRarity.T4Uncommon:
|
||||
{
|
||||
value = 8 * (int)(size+1);
|
||||
}
|
||||
break;
|
||||
case FishRarity.T4Common:
|
||||
{
|
||||
value = 4 * (int)(size+1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
value *= amount;
|
||||
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou're about to sell **{amount} {fish.Name}** for **{((long)value).ToYeedraDisplay()}**.\nType 'ok' to confirm.");
|
||||
inp = await NextMessageAsync();
|
||||
if (inp.Content.ToLowerInvariant() == "ok")
|
||||
{
|
||||
|
||||
int[] amounts;
|
||||
if (!fishinv.TryGetValue(fish.Id, out amounts))
|
||||
{
|
||||
amounts = new int[] { 0, 0, 0 };
|
||||
fishinv.Add(fish.Id, amounts);
|
||||
}
|
||||
|
||||
int sizeIndex = (int)size;
|
||||
amounts[sizeIndex] -= amount;
|
||||
|
||||
fuser.SetInventory(fishinv);
|
||||
|
||||
if (!user.GrantMoney(Database.Users.FirstOrDefault(x => x.Id == 0), value))
|
||||
{
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nBank has no money, convince someone to gamble.");
|
||||
return;
|
||||
}
|
||||
await Database.SaveChangesAsync();
|
||||
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nThanks, seaman, enjoy your moolah.");
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nI guess I'm starving tonight. :[");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[RequireRolePrecondition(AccessLevel.BotOwner)]
|
||||
[Command("setbf")]
|
||||
public async Task SetBattleFish(byte type, IUser usar = null)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using Discord.Addons.Interactive;
|
||||
using Discord.Commands;
|
||||
using Kehyeedra3.Services.Models;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -197,29 +198,128 @@ namespace Kehyeedra3.Commands
|
||||
[Command("reminders",RunMode = RunMode.Async), Summary("List reminders")]
|
||||
public async Task ListReminders(string manage = null)
|
||||
{
|
||||
ulong d = 0;
|
||||
ulong h = 0;
|
||||
ulong m = 0;
|
||||
string when = "";
|
||||
string remin = "";
|
||||
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
|
||||
{
|
||||
string rlist = "";
|
||||
var user = Context.User;
|
||||
|
||||
foreach (Reminder reminder in Database.Reminders)
|
||||
{
|
||||
ulong yeedraStamp = DateTime.UtcNow.ToYeedraStamp();
|
||||
remin = "";
|
||||
ulong ago = yeedraStamp - reminder.Created;
|
||||
while (ago > 59)
|
||||
{
|
||||
m += 1;
|
||||
ago -= 60;
|
||||
}
|
||||
while (m > 59)
|
||||
{
|
||||
h += 1;
|
||||
m -= 60;
|
||||
}
|
||||
while (h > 23)
|
||||
{
|
||||
d += 1;
|
||||
h -= 24;
|
||||
}
|
||||
|
||||
if (d > 0)
|
||||
{
|
||||
remin += $" {d} day";
|
||||
if (d > 1)
|
||||
{
|
||||
remin += $"s";
|
||||
}
|
||||
}
|
||||
if (h > 0)
|
||||
{
|
||||
remin += $" {h} hour";
|
||||
if (h > 1)
|
||||
{
|
||||
remin += $"s";
|
||||
}
|
||||
}
|
||||
if (m > 0)
|
||||
{
|
||||
remin += $" {m} minute";
|
||||
if (m > 1)
|
||||
{
|
||||
remin += $"s";
|
||||
}
|
||||
}
|
||||
if (d == 0 && h == 0 && m == 0)
|
||||
{
|
||||
when = " less than a minute ago.";
|
||||
}
|
||||
else
|
||||
{
|
||||
when = $"{remin} ago.";
|
||||
}
|
||||
|
||||
m = 0;
|
||||
h = 0;
|
||||
d = 0;
|
||||
|
||||
if (reminder.UserId == Context.User.Id)
|
||||
{
|
||||
rlist += $"ID: {reminder.Id} Made at: **GMT{reminder.Created.FromYeedraStamp()}**\n";
|
||||
rlist += $"Reminder ID: {reminder.Id} From{when} Contents: *{reminder.Message}*\n";
|
||||
}
|
||||
}
|
||||
if (rlist == "")
|
||||
{
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou haven't set any reminders.");
|
||||
return;
|
||||
}
|
||||
if (manage == null)
|
||||
{
|
||||
await Context.Channel.SendMessageAsync(rlist);
|
||||
return;
|
||||
}
|
||||
//else
|
||||
//{
|
||||
// await Context.Channel.SendMessageAsync($"Which reminder would you like to edit?\n\n{rlist}");
|
||||
// var reply = await NextMessageAsync();
|
||||
// long rep = long.Parse(reply.Content);
|
||||
// if (rep ==)
|
||||
//}
|
||||
else
|
||||
{
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nWhich reminder would you like to edit?\n\n{rlist}");
|
||||
var reply = await NextMessageAsync();
|
||||
ulong rep = ulong.Parse(reply.Content);
|
||||
|
||||
var rem = Database.Reminders.FirstOrDefault(r => r.Id == rep && r.UserId == Context.User.Id);
|
||||
|
||||
if (rem == null)
|
||||
{
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nYou have no such reminder.");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nWhat would you like to do? (edit/remove)");
|
||||
|
||||
reply = await NextMessageAsync();
|
||||
|
||||
if (reply.Content == "edit")
|
||||
{
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nInsert new reminder message.");
|
||||
reply = await NextMessageAsync();
|
||||
rem.Message = reply.Content;
|
||||
await Database.SaveChangesAsync();
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nReminder updated.");
|
||||
}
|
||||
else if (reply.Content == "remove")
|
||||
{
|
||||
Database.Reminders.Remove(rem);
|
||||
await Database.SaveChangesAsync();
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nReminder removed.");
|
||||
}
|
||||
else
|
||||
{
|
||||
await Context.Channel.SendMessageAsync($"{Context.User.Mention}\nInvalid action.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,14 +76,14 @@ namespace Kehyeedra3.Services.Models
|
||||
{
|
||||
Id = FishSpecies.Clownfish,
|
||||
Name = "Clownfish",
|
||||
Emote = "<a:clownfishleft:704404973441515661><:clownfishright:704404973076611123>",
|
||||
Emote = "<a:clownfishleft:715846565972934718><a:clownfishright:715846565704761424>",
|
||||
Rarity = FishRarity.Rare
|
||||
},
|
||||
new Fish()
|
||||
{
|
||||
Id = FishSpecies.Teracrab,
|
||||
Name = "Teracrab",
|
||||
Emote = "<a:teracrableft:681872487901954123><a:teracrabright:681872487264681984>",
|
||||
Emote = "<a:teracrableft:710925664089538691><a:teracrabright:710925663439421512>",
|
||||
Rarity = FishRarity.Rare
|
||||
},
|
||||
new Fish()
|
||||
@@ -104,7 +104,7 @@ namespace Kehyeedra3.Services.Models
|
||||
{
|
||||
Id = FishSpecies.Gigacrab,
|
||||
Name = "Gigacrab",
|
||||
Emote = "<:gigacrab:681871426382594208>",
|
||||
Emote = "<:gigacrableft:715626112327221348><:gigacrabright:715626112537067580>",
|
||||
Rarity = FishRarity.Uncommon
|
||||
},
|
||||
new Fish()
|
||||
@@ -132,7 +132,7 @@ namespace Kehyeedra3.Services.Models
|
||||
{
|
||||
Id = FishSpecies.Sheephead,
|
||||
Name = "Sheephead",
|
||||
Emote = "<:sheepheadleft:704406846584127581><:sheepheadright:704406846831722606>",
|
||||
Emote = "<:sheepheadleft:710894977944649728><:sheepheadright:710894979467444284>",
|
||||
Rarity = FishRarity.Uncommon
|
||||
},
|
||||
new Fish()
|
||||
@@ -153,14 +153,14 @@ namespace Kehyeedra3.Services.Models
|
||||
{
|
||||
Id = FishSpecies.Shrimp,
|
||||
Name = "Shrimp",
|
||||
Emote = "<:shromp:695335369004023859>",
|
||||
Emote = "<:shrimpleft:715074288788570112><:shrimpright:715074288863936552>",
|
||||
Rarity = FishRarity.Common
|
||||
},
|
||||
new Fish()
|
||||
{
|
||||
Id = FishSpecies.Crayfish,
|
||||
Name = "Crayfish",
|
||||
Emote = "<:crayfishleft:698157988195598466><:crayfishright:698157988170432602>",
|
||||
Emote = "<:crayfishleft:715638929885495377><:crayfishright:715638929843421284>",
|
||||
Rarity = FishRarity.Common
|
||||
},
|
||||
new Fish()
|
||||
@@ -174,7 +174,7 @@ namespace Kehyeedra3.Services.Models
|
||||
{
|
||||
Id = FishSpecies.Pufferfish,
|
||||
Name = "Pufferfish",
|
||||
Emote = "<:pufferfish:698203043350708225>",
|
||||
Emote = "<:pufferfishleft:715075414179184691><:pufferfishright:715075414116007937>",
|
||||
Rarity = FishRarity.Common
|
||||
},
|
||||
new Fish()
|
||||
@@ -187,8 +187,8 @@ namespace Kehyeedra3.Services.Models
|
||||
new Fish()
|
||||
{
|
||||
Id = FishSpecies.Megacrab,
|
||||
Name = "Megacrab",
|
||||
Emote = "<:megacrab:681871426319286302>",
|
||||
Name = "Hermit Crab",
|
||||
Emote = "<:hermitcrableft:715071501996392519><:hermitcrabright:715071501971488808>",
|
||||
Rarity = FishRarity.Common
|
||||
},
|
||||
|
||||
|
||||
@@ -30,27 +30,43 @@ namespace Kehyeedra3.Services.Models
|
||||
return false;
|
||||
}
|
||||
|
||||
public void SetGenInv(List<Item> newInv)
|
||||
//public void SetGenInv(List<Item> newInv)
|
||||
//{
|
||||
// GeneralInventory = JsonConvert.SerializeObject(newInv);
|
||||
//}
|
||||
//public List<Item> GetGenInv()
|
||||
//{
|
||||
// if (string.IsNullOrEmpty(GeneralInventory))
|
||||
// {
|
||||
// return new List<Item>();
|
||||
// }
|
||||
// return JsonConvert.DeserializeObject<List<Item>>(GeneralInventory);
|
||||
//}
|
||||
|
||||
public Dictionary<Items, int[]> GetGenInve()
|
||||
{
|
||||
GeneralInventory = JsonConvert.SerializeObject(newInv);
|
||||
return JsonConvert.DeserializeObject<Dictionary<Items, int[]>>(GeneralInventory);
|
||||
}
|
||||
public List<Item> GetGenInv()
|
||||
|
||||
public void SetGenInve(Dictionary<Items, int[]> inv)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<List<Item>>(GeneralInventory);
|
||||
Dictionary<int, int[]> temp = new Dictionary<int, int[]>();
|
||||
foreach (var entry in inv)
|
||||
{
|
||||
temp.Add((int)entry.Key, entry.Value);
|
||||
}
|
||||
GeneralInventory = JsonConvert.SerializeObject(temp);
|
||||
}
|
||||
|
||||
public static List<Item> ListItems()
|
||||
{
|
||||
return new List<Item>
|
||||
{
|
||||
new Item()
|
||||
{
|
||||
Id = Items.Item1,
|
||||
Name = "Item1"
|
||||
},
|
||||
new Item()
|
||||
{
|
||||
Id = Items.Item2,
|
||||
Name = "Item1"
|
||||
Id = Items.DirtyBoot,
|
||||
Name = "Lan's Love",
|
||||
Price = 100
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -58,6 +74,7 @@ namespace Kehyeedra3.Services.Models
|
||||
{
|
||||
public Items Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int Price { get; set; }
|
||||
}
|
||||
public class BattleFishObject
|
||||
{
|
||||
@@ -72,8 +89,7 @@ namespace Kehyeedra3.Services.Models
|
||||
}
|
||||
public enum Items
|
||||
{
|
||||
Item1 = 0,
|
||||
Item2 = 1,
|
||||
DirtyBoot = 0,
|
||||
}
|
||||
public class ItemSlot
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user