work on fish command

master
Lan 5 years ago
parent b874056bf8
commit 24b3839947
  1. 48
      Kehyeedra3/Commands.cs
  2. 95
      Kehyeedra3/Migrations/20200223155743_morefishstuff.Designer.cs
  3. 31
      Kehyeedra3/Migrations/20200223155743_morefishstuff.cs
  4. 2
      Kehyeedra3/Migrations/ApplicationDbContextModelSnapshot.cs
  5. 41
      Kehyeedra3/Services/Models/Fishing.cs

@ -250,7 +250,7 @@ namespace Kehyeedra3
var reminder = new Reminder var reminder = new Reminder
{ {
UserId = Context.User.Id, UserId = Context.User.Id,
Message = ($"At **UTC {time}** you wanted me to remind you: **'{r}'**"), Message = ($"At **UTC {time}** you wanted me to remind you:\n**'{r}'**"),
Created = yeedraStamp, Created = yeedraStamp,
Send = ((d * 86400) + (h * 3600) + (m * 60)) + yeedraStamp Send = ((d * 86400) + (h * 3600) + (m * 60)) + yeedraStamp
}; };
@ -347,33 +347,26 @@ namespace Kehyeedra3
{ {
FishSpecies.Doomfish, FishSpecies.Doomfish,
FishSpecies.Clownfish, FishSpecies.Clownfish,
FishSpecies.GenericFish, FishSpecies.Teracrab,
FishSpecies.Ultracrab, FishSpecies.Blobfish,
FishSpecies.BlobFish, FishSpecies.Psychedelica
FishSpecies.Psychedelica,
}; };
readonly FishSpecies[] ufish = new FishSpecies[] readonly FishSpecies[] ufish = new FishSpecies[]
{ {
FishSpecies.Gigacrab, FishSpecies.Gigacrab,
FishSpecies.MantisShrimp, FishSpecies.Frogfish,
FishSpecies.GoblinFish,
FishSpecies.BatFish,
FishSpecies.FrogFish,
FishSpecies.TigerFish,
FishSpecies.Stargazer, FishSpecies.Stargazer,
FishSpecies.Isopod, FishSpecies.Isopod,
FishSpecies.SheepHead, FishSpecies.Sheephead,
}; };
readonly FishSpecies[] cfish = new FishSpecies[] readonly FishSpecies[] cfish = new FishSpecies[]
{ {
FishSpecies.Cod, FishSpecies.Cod,
FishSpecies.Salmon, FishSpecies.Salmon,
FishSpecies.Pike,
FishSpecies.Bass, FishSpecies.Bass,
FishSpecies.Crayfish, FishSpecies.Crayfish,
FishSpecies.Betta, FishSpecies.Betta,
FishSpecies.PufferFish, FishSpecies.Pufferfish,
FishSpecies.Tuna,
FishSpecies.Carp, FishSpecies.Carp,
FishSpecies.Megacrab FishSpecies.Megacrab
}; };
@ -479,6 +472,10 @@ namespace Kehyeedra3
{ {
ulong time = ulong.Parse(DateTime.Now.ToString("yyyyMMddHHmm")); ulong time = ulong.Parse(DateTime.Now.ToString("yyyyMMddHHmm"));
ulong lastfish; ulong lastfish;
ulong totalXp;
ulong xp;
ulong level;
ulong lvlXp;
List<FishingInventorySlot> inv = new List<FishingInventorySlot>(); List<FishingInventorySlot> inv = new List<FishingInventorySlot>();
using (var Database = new ApplicationDbContextFactory().CreateDbContext()) using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{ {
@ -497,12 +494,19 @@ namespace Kehyeedra3
{ {
inv = user.GetInventory(); inv = user.GetInventory();
} }
level = user.Lvl;
lastfish = user.LastFish; lastfish = user.LastFish;
totalXp = user.TXp;
lvlXp = user.Xp;
await Database.SaveChangesAsync(); await Database.SaveChangesAsync();
} }
if (lastfish < time) if (lastfish < time)
{ {
int rarity = SRandom.Next(0, 201); int rari = (SRandom.Next(0, 201));
ulong rarity = level + (ulong)rari;
FishRarity rarmult; FishRarity rarmult;
string rar = ""; string rar = "";
FishSpecies fish ; FishSpecies fish ;
@ -512,6 +516,7 @@ namespace Kehyeedra3
rarmult = FishRarity.Rare; rarmult = FishRarity.Rare;
int num = SRandom.Next(rfish.Length); int num = SRandom.Next(rfish.Length);
fish = rfish[num]; fish = rfish[num];
xp = 3;
} }
else else
{ {
@ -521,14 +526,16 @@ namespace Kehyeedra3
rarmult = FishRarity.Uncommon; rarmult = FishRarity.Uncommon;
int num = SRandom.Next(ufish.Length); int num = SRandom.Next(ufish.Length);
fish = ufish[num]; fish = ufish[num];
xp = 2;
} }
else else
{ {
if (rarity == 7) if (rarity == 77)
{ {
rar = "***Legendary***"; rar = "***Legendary***";
rarmult = FishRarity.Special; rarmult = FishRarity.Legendary;
fish = FishSpecies.LuckyCatfish; fish = FishSpecies.LuckyCatfish;
xp = 7;
} }
else else
{ {
@ -536,6 +543,7 @@ namespace Kehyeedra3
rarmult = FishRarity.Common; rarmult = FishRarity.Common;
int num = SRandom.Next(cfish.Length); int num = SRandom.Next(cfish.Length);
fish = cfish[num]; fish = cfish[num];
xp = 1;
} }
} }
} }
@ -556,11 +564,11 @@ namespace Kehyeedra3
size = FishWeight.Small; size = FishWeight.Small;
} }
if (weight >= 150 || rarmult == FishRarity.Special) if (weight >= 150 || rarmult == FishRarity.Legendary)
{ {
size = FishWeight.Large; size = FishWeight.Large;
} }
if (rarity > 40) if (rarity > 20)
{ {
using (var Database = new ApplicationDbContextFactory().CreateDbContext()) using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{ {
@ -588,6 +596,8 @@ namespace Kehyeedra3
user.LastFish = time; user.LastFish = time;
user.TXp += xp;
await Database.SaveChangesAsync().ConfigureAwait(false); // :] await Database.SaveChangesAsync().ConfigureAwait(false); // :]
} }

@ -0,0 +1,95 @@
// <auto-generated />
using Kehyeedra3;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Kehyeedra3.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20200223155743_morefishstuff")]
partial class morefishstuff
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.1")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
modelBuilder.Entity("Kehyeedra3.Services.Models.Fishing", b =>
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint unsigned");
b.Property<string>("Inventory")
.HasColumnType("LONGTEXT");
b.Property<ulong>("LastFish")
.HasColumnType("bigint unsigned");
b.Property<ulong>("Lvl")
.HasColumnType("bigint unsigned");
b.Property<ulong>("TXp")
.HasColumnType("bigint unsigned");
b.Property<ulong>("Xp")
.HasColumnType("bigint unsigned");
b.HasKey("Id");
b.ToTable("Fishing");
});
modelBuilder.Entity("Kehyeedra3.Services.Models.Reminder", b =>
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint unsigned");
b.Property<ulong>("Created")
.HasColumnType("bigint unsigned");
b.Property<string>("Message")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<ulong>("Send")
.HasColumnType("bigint unsigned");
b.Property<ulong>("UserId")
.HasColumnType("bigint unsigned");
b.HasKey("Id");
b.ToTable("Reminders");
});
modelBuilder.Entity("Kehyeedra3.Services.Models.User", b =>
{
b.Property<ulong>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint unsigned");
b.Property<string>("Avatar")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.Property<ulong>("LastMine")
.HasColumnType("bigint unsigned");
b.Property<long>("Money")
.HasColumnType("bigint");
b.Property<string>("Username")
.HasColumnType("longtext CHARACTER SET utf8mb4");
b.HasKey("Id");
b.ToTable("Users");
});
#pragma warning restore 612, 618
}
}
}

@ -0,0 +1,31 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Kehyeedra3.Migrations
{
public partial class morefishstuff : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Inventory",
table: "Fishing",
type: "LONGTEXT",
nullable: true,
oldClrType: typeof(string),
oldType: "json",
oldNullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Inventory",
table: "Fishing",
type: "json",
nullable: true,
oldClrType: typeof(string),
oldType: "LONGTEXT",
oldNullable: true);
}
}
}

@ -23,7 +23,7 @@ namespace Kehyeedra3.Migrations
.HasColumnType("bigint unsigned"); .HasColumnType("bigint unsigned");
b.Property<string>("Inventory") b.Property<string>("Inventory")
.HasColumnType("json"); .HasColumnType("LONGTEXT");
b.Property<ulong>("LastFish") b.Property<ulong>("LastFish")
.HasColumnType("bigint unsigned"); .HasColumnType("bigint unsigned");

@ -44,31 +44,24 @@ namespace Kehyeedra3.Services.Models
//rare //rare
Doomfish = 2, Doomfish = 2,
Clownfish = 3, Clownfish = 3,
GenericFish = 4, Teracrab = 4,
Ultracrab = 5, Blobfish = 5,
BlobFish = 6, Psychedelica = 6,
Psychedelica = 7,
//uncommon //uncommon
Gigacrab = 8, Gigacrab = 7,
MantisShrimp = 9, Frogfish = 8,
GoblinFish = 10, Stargazer = 9,
BatFish = 11, Isopod = 10,
FrogFish = 12, Sheephead = 11,
TigerFish = 13,
Stargazer = 14,
Isopod = 15,
SheepHead = 16,
//common //common
Cod = 17, Cod = 12,
Salmon = 18, Salmon = 13,
Pike = 19, Pufferfish = 14,
Bass = 20, Bass = 15,
Crayfish = 21, Crayfish = 16,
Betta = 22, Betta = 17,
PufferFish = 23, Carp = 18,
Tuna = 24, Megacrab = 19
Carp = 25,
Megacrab = 26
} }
public enum FishWeight public enum FishWeight
{ {
@ -81,7 +74,7 @@ namespace Kehyeedra3.Services.Models
Common = 1, Common = 1,
Uncommon = 2, Uncommon = 2,
Rare = 3, Rare = 3,
Special = 4 Legendary = 4
} }
public class FishingInventorySlot public class FishingInventorySlot
{ {

Loading…
Cancel
Save