work on fish command

master
Lan 5 years ago
parent b874056bf8
commit 24b3839947
  1. 50
      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
{
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,
Send = ((d * 86400) + (h * 3600) + (m * 60)) + yeedraStamp
};
@ -347,33 +347,26 @@ namespace Kehyeedra3
{
FishSpecies.Doomfish,
FishSpecies.Clownfish,
FishSpecies.GenericFish,
FishSpecies.Ultracrab,
FishSpecies.BlobFish,
FishSpecies.Psychedelica,
FishSpecies.Teracrab,
FishSpecies.Blobfish,
FishSpecies.Psychedelica
};
readonly FishSpecies[] ufish = new FishSpecies[]
{
FishSpecies.Gigacrab,
FishSpecies.MantisShrimp,
FishSpecies.GoblinFish,
FishSpecies.BatFish,
FishSpecies.FrogFish,
FishSpecies.TigerFish,
FishSpecies.Frogfish,
FishSpecies.Stargazer,
FishSpecies.Isopod,
FishSpecies.SheepHead,
FishSpecies.Sheephead,
};
readonly FishSpecies[] cfish = new FishSpecies[]
{
FishSpecies.Cod,
FishSpecies.Salmon,
FishSpecies.Pike,
FishSpecies.Bass,
FishSpecies.Crayfish,
FishSpecies.Betta,
FishSpecies.PufferFish,
FishSpecies.Tuna,
FishSpecies.Pufferfish,
FishSpecies.Carp,
FishSpecies.Megacrab
};
@ -479,6 +472,10 @@ namespace Kehyeedra3
{
ulong time = ulong.Parse(DateTime.Now.ToString("yyyyMMddHHmm"));
ulong lastfish;
ulong totalXp;
ulong xp;
ulong level;
ulong lvlXp;
List<FishingInventorySlot> inv = new List<FishingInventorySlot>();
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
@ -497,12 +494,19 @@ namespace Kehyeedra3
{
inv = user.GetInventory();
}
level = user.Lvl;
lastfish = user.LastFish;
totalXp = user.TXp;
lvlXp = user.Xp;
await Database.SaveChangesAsync();
}
if (lastfish < time)
{
int rarity = SRandom.Next(0, 201);
int rari = (SRandom.Next(0, 201));
ulong rarity = level + (ulong)rari;
FishRarity rarmult;
string rar = "";
FishSpecies fish ;
@ -512,6 +516,7 @@ namespace Kehyeedra3
rarmult = FishRarity.Rare;
int num = SRandom.Next(rfish.Length);
fish = rfish[num];
xp = 3;
}
else
{
@ -521,14 +526,16 @@ namespace Kehyeedra3
rarmult = FishRarity.Uncommon;
int num = SRandom.Next(ufish.Length);
fish = ufish[num];
xp = 2;
}
else
{
if (rarity == 7)
if (rarity == 77)
{
rar = "***Legendary***";
rarmult = FishRarity.Special;
rarmult = FishRarity.Legendary;
fish = FishSpecies.LuckyCatfish;
xp = 7;
}
else
{
@ -536,6 +543,7 @@ namespace Kehyeedra3
rarmult = FishRarity.Common;
int num = SRandom.Next(cfish.Length);
fish = cfish[num];
xp = 1;
}
}
}
@ -556,11 +564,11 @@ namespace Kehyeedra3
size = FishWeight.Small;
}
if (weight >= 150 || rarmult == FishRarity.Special)
if (weight >= 150 || rarmult == FishRarity.Legendary)
{
size = FishWeight.Large;
}
if (rarity > 40)
if (rarity > 20)
{
using (var Database = new ApplicationDbContextFactory().CreateDbContext())
{
@ -585,9 +593,11 @@ namespace Kehyeedra3
}
user.SetInventory(inv);
user.LastFish = time;
user.TXp += xp;
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");
b.Property<string>("Inventory")
.HasColumnType("json");
.HasColumnType("LONGTEXT");
b.Property<ulong>("LastFish")
.HasColumnType("bigint unsigned");

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

Loading…
Cancel
Save