@ -8,8 +8,10 @@ using System;
using System.Collections.Generic ;
using System.Collections.Generic ;
using System.Linq ;
using System.Linq ;
using System.Text ;
using System.Text ;
using ImageMagick ;
using System.Threading.Channels ;
using System.Threading.Channels ;
using System.Threading.Tasks ;
using System.Threading.Tasks ;
using Kehyeedra3.Preconditions ;
namespace Kehyeedra3.Commands
namespace Kehyeedra3.Commands
{
{
@ -21,7 +23,6 @@ namespace Kehyeedra3.Commands
"**Platinum**," ,
"**Platinum**," ,
"**Plastids**," ,
"**Plastids**," ,
"a ticking **Time Bomb**," ,
"a ticking **Time Bomb**," ,
"**Neural Sensors**," ,
"an **Amethyst**," ,
"an **Amethyst**," ,
"**Germanium**," ,
"**Germanium**," ,
"a **Hotdog**," ,
"a **Hotdog**," ,
@ -192,19 +193,24 @@ namespace Kehyeedra3.Commands
public async Task FishCommand ( )
public async Task FishCommand ( )
{
{
ulong time = ulong . Parse ( DateTime . Now . ToString ( "yyyyMMddHHmm" ) ) ;
ulong time = ulong . Parse ( DateTime . Now . ToString ( "yyyyMMddHHmm" ) ) ;
ulong lastfish ;
ulong totalXp ;
ulong totalXp ;
ulong xp ;
ulong xp ;
ulong level ;
ulong level ;
ulong lvlXp ;
ulong lvlXp ;
int prestige ;
int prestige ;
int rod ;
int rod ;
int BigBait = 0 ;
int RareBait = 0 ;
int SpecialBait = 0 ;
int Lettuce = 0 ;
Dictionary < FishSpecies , int [ ] > inv = new Dictionary < FishSpecies , int [ ] > ( ) ;
Dictionary < FishSpecies , int [ ] > inv = new Dictionary < FishSpecies , int [ ] > ( ) ;
Dictionary < Items , int [ ] > items = new Dictionary < Items , int [ ] > ( ) ;
List < Fish > fishes = Fishing . GetFishList ( ) ;
List < Fish > fishes = Fishing . GetFishList ( ) ;
using ( var Database = new ApplicationDbContextFactory ( ) . CreateDbContext ( ) )
using ( var Database = new ApplicationDbContextFactory ( ) . CreateDbContext ( ) )
{
{
var user = Database . Fishing . FirstOrDefault ( x = > x . Id = = Context . User . Id ) ;
var user = Database . Fishing . FirstOrDefault ( x = > x . Id = = Context . User . Id ) ;
var guser = Database . Users . FirstOrDefault ( x = > x . Id = = Context . User . Id ) ;
if ( user = = null )
if ( user = = null )
{
{
{
{
@ -219,8 +225,58 @@ namespace Kehyeedra3.Commands
{
{
inv = user . GetInventory ( ) ;
inv = user . GetInventory ( ) ;
}
}
if ( user . LastFish > = time )
{
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\narrrrr-right, ye scurby bastard, I know yer eager t' scour the seven seas but ye needs t' wait till the next minute t' pillage the booty'o'the depths, savvy?" ) ;
return ;
}
items = guser . GetGenInve ( ) ; / /
int [ ] subtract = { 0 } ;
subtract [ 0 ] = - 1 ;
if ( items . TryGetValue ( Items . SpecialBait , out int [ ] SpecB ) )
{
SpecialBait = SpecB [ 0 ] ;
BigBait = SpecB [ 0 ] ;
RareBait = SpecB [ 0 ] ;
if ( SpecialBait > 0 )
{
SpecB [ 0 ] - = 1 ;
}
else
{
if ( items . TryGetValue ( Items . BigBait , out int [ ] BigB ) )
{
BigBait = BigB [ 0 ] ;
if ( BigBait > 0 )
{
BigB [ 0 ] - = 1 ;
}
}
if ( items . TryGetValue ( Items . RareBait , out int [ ] RareB ) )
{
RareBait = RareB [ 0 ] ;
if ( RareBait > 0 )
{
RareB [ 0 ] - = 1 ;
}
}
}
}
if ( items . TryGetValue ( Items . Lettuce , out int [ ] Lettu ) )
{
Lettuce = Lettu [ 0 ] ;
if ( Lettuce > 0 )
{
Lettu [ 0 ] - = 1 ;
}
}
guser . SetGenInve ( items ) ;
level = user . Lvl ;
level = user . Lvl ;
lastfish = user . LastFish ;
totalXp = user . TXp ;
totalXp = user . TXp ;
lvlXp = user . Xp ;
lvlXp = user . Xp ;
rod = user . RodUsed ;
rod = user . RodUsed ;
@ -229,23 +285,24 @@ namespace Kehyeedra3.Commands
await Database . SaveChangesAsync ( ) ;
await Database . SaveChangesAsync ( ) ;
}
}
int rari = SRandom . Next ( 0 , 2 0 0 1 ) ;
if ( lastfish < time )
{
int rari = ( SRandom . Next ( 0 , 2 0 0 1 ) ) ;
int weigh = SRandom . Next ( 1 0 , 1 5 0 1 + prestige * 5 0 0 ) ;
int weigh = SRandom . Next ( 1 0 , 1 5 0 1 + prestige * 5 0 0 ) ;
int tierRoll = SRandom . Next ( 0 , 8 1 + prestige * 4 0 ) ;
int tierRoll = SRandom . Next ( 0 , 2 0 * rod + 1 0 * prestige + 1 ) ;
int dCatchRoll = SRandom . Next ( 0 , 1 0 0 0 + prestige * 2 0 ) ;
int dCatchRoll = SRandom . Next ( 0 , 1 0 0 0 + prestige * 2 0 ) ;
int dcatch = 1 ;
int dcatch = 1 ;
ulong rarity ;
int rarity ;
int weight ;
int weight ;
bool bBig = false ;
bool bRar = false ;
bool bSpe = false ;
bool bLet = false ;
if ( dCatchRoll > 1 0 0 0 )
if ( dCatchRoll > 1 0 0 0 )
{
{
int many = 1 0 2 0 ;
int many = 1 0 2 0 ;
dcatch + = 1 ;
dcatch + = 1 ;
while ( many + 2 0 < dCatchRoll )
while ( many < dCatchRoll )
{
{
dcatch + = 1 ;
dcatch + = 1 ;
many + = 1 0 + ( dcatch * 5 ) ;
many + = 1 0 + ( dcatch * 5 ) ;
@ -254,25 +311,55 @@ namespace Kehyeedra3.Commands
if ( level < 1 0 0 & & prestige = = 0 )
if ( level < 1 0 0 & & prestige = = 0 )
{
{
rarity = level * 1 0 + ( ulong ) rari ;
rarity = ( int ) level * 1 0 + rari ;
weight = ( int ) level * 5 + weigh ;
weight = ( int ) level * 5 + weigh ;
}
}
else if ( level < 1 0 0 & & prestige = = 1 )
else if ( level < 1 0 0 & & prestige = = 1 )
{
{
rarity = 1 0 0 0 + ( ulong ) rari ;
rarity = 1 0 0 0 + rari ;
weight = ( int ) level * 2 + 5 0 0 + weigh ;
weight = ( int ) level * 3 + 5 0 0 + weigh ;
}
else if ( level > = 1 0 0 & & prestige > 1 )
{
rarity = 1 0 0 0 + rari ;
weight = 8 0 0 + weigh ;
}
}
else
else
{
{
rarity = 1 0 0 0 + ( ulong ) rari ;
rarity = 1 0 0 0 + rari ;
weight = 7 0 0 + weigh ;
weight = 5 0 0 + weigh ;
}
if ( BigBait > 0 )
{
weight + = 1 0 0 0 ;
bBig = true ;
}
if ( RareBait > 0 )
{
rarity + = 5 0 0 ;
bRar = true ;
}
if ( SpecialBait > 0 )
{
bSpe = true ;
}
if ( Lettuce > 0 )
{
bLet = true ;
}
}
Fish fish ;
Fish fish ;
if ( rarity = = 7 7 7 | | ( rarity > 2 0 6 0 & & rarity < = 2 0 7 0 ) | | rarity = = 2 7 7 7 )
if ( rarity = = 7 7 7 | | ( rarity > 2 0 6 0 & & rarity < = 2 0 7 0 ) | | rarity = = 2 7 7 7 | | rarity > 2 5 0 0 & & rarity < 2 5 1 0 & & bRar | | rarity > 2 5 1 0 & & rarity < 2 5 2 0 & & bSpe )
{
{
if ( rod > = 3 & & tierRoll > 6 0 )
int wRoll = SRandom . Next ( 0 , 1 0 1 ) ;
if ( wRoll = = 7 7 & & bSpe )
{
List < Fish > possibleFishes = fishes . Where ( f = > ( int ) f . Rarity = = ( int ) FishRarity . Unreasonable ) . ToList ( ) ;
fish = possibleFishes [ SRandom . Next ( possibleFishes . Count ) ] ;
xp = 7 7 7 7 ;
}
else if ( rod > = 3 & & tierRoll > 6 0 )
{
{
List < Fish > possibleFishes = fishes . Where ( f = > ( int ) f . Rarity = = ( int ) FishRarity . T4Legendary ) . ToList ( ) ;
List < Fish > possibleFishes = fishes . Where ( f = > ( int ) f . Rarity = = ( int ) FishRarity . T4Legendary ) . ToList ( ) ;
fish = possibleFishes [ SRandom . Next ( possibleFishes . Count ) ] ;
fish = possibleFishes [ SRandom . Next ( possibleFishes . Count ) ] ;
@ -298,12 +385,16 @@ namespace Kehyeedra3.Commands
}
}
if ( rarity = = 7 7 7 | | rarity = = 2 7 7 7 )
if ( rarity = = 7 7 7 | | rarity = = 2 7 7 7 )
{
{
xp = 7 7 + ( 7 7 * Convert . ToUInt64 ( rod / 2 ) ) ;
xp = 7 7 + Convert . ToUInt64 ( 7 7 * rod / 2 ) ;
}
}
}
}
else if ( rarity > 1 7 0 0 )
else if ( rarity > 1 7 0 0 )
{
{
rarity = Convert . ToUInt64 ( SRandom . Next ( 1 7 0 0 , 2 8 0 1 ) ) ;
rarity = SRandom . Next ( 1 7 0 0 , 2 8 0 1 ) ;
if ( bRar | | bSpe )
{
rarity + = 2 0 0 ;
}
if ( rod > = 3 & & tierRoll > 6 0 )
if ( rod > = 3 & & tierRoll > 6 0 )
{
{
List < Fish > possibleFishes = fishes . Where ( f = > ( int ) f . Rarity = = ( int ) FishRarity . T4Uncommon ) . ToList ( ) ;
List < Fish > possibleFishes = fishes . Where ( f = > ( int ) f . Rarity = = ( int ) FishRarity . T4Uncommon ) . ToList ( ) ;
@ -387,19 +478,24 @@ namespace Kehyeedra3.Commands
FishSize size ;
FishSize size ;
if ( fish . Rarity = = FishRarity . Legendary | | fish . Rarity = = FishRarity . T2Legendary | | fish . Rarity = = FishRarity . T3Legendary | | fish . Rarity = = FishRarity . T4Legendary )
if ( weight > = ( 1 0 0 0 - Convert . ToInt32 ( level * 2 ) ) ) //second weight roll
{
weight = 1 0 0 0 ;
}
if ( weight > = ( 1 0 0 0 - Convert . ToInt32 ( level * 2 ) ) )
{
{
weight = SRandom . Next ( 1 0 0 , 2 0 0 1 ) + Convert . ToInt32 ( level * 5 + ( Convert . ToUInt64 ( prestige * 5 0 0 ) ) ) ;
weight = SRandom . Next ( 1 0 0 , 2 0 0 1 ) + Convert . ToInt32 ( level * 5 + ( Convert . ToUInt64 ( prestige * 5 0 0 ) ) ) ;
}
}
if ( fish . Rarity = = FishRarity . Legendary | | fish . Rarity = = FishRarity . T2Legendary | | fish . Rarity = = FishRarity . T3Legendary | | fish . Rarity = = FishRarity . T4Legendary )
if ( fish . Rarity = = FishRarity . Legendary | | fish . Rarity = = FishRarity . T2Legendary | | fish . Rarity = = FishRarity . T3Legendary | | fish . Rarity = = FishRarity . T4Legendary )
{
{
weight = SRandom . Next ( 2 0 0 0 + Convert . ToInt32 ( level * 2 0 ) , 4 0 0 0 1 + prestige * 1 0 0 0 0 ) ;
weight = SRandom . Next ( 2 0 0 0 + Convert . ToInt32 ( level * 2 0 ) , 4 0 0 0 1 + prestige * 1 0 0 0 0 ) ;
}
}
if ( fish . Rarity = = FishRarity . Unreasonable )
{
weight = SRandom . Next ( 4 0 0 0 , 6 0 0 0 ) ;
}
if ( bBig )
{
weight + = 1 0 0 0 ;
}
if ( weight > = 1 0 0 0 )
if ( weight > = 1 0 0 0 )
{
{
@ -429,6 +525,11 @@ namespace Kehyeedra3.Commands
size = FishSize . Small ;
size = FishSize . Small ;
}
}
if ( bLet )
{
xp = Convert . ToUInt64 ( Math . Round ( xp * 1.1 , 0 , MidpointRounding . ToEven ) ) * ( ulong ) dcatch ;
}
string lvlUp = "" ;
string lvlUp = "" ;
using ( var Database = new ApplicationDbContextFactory ( ) . CreateDbContext ( ) )
using ( var Database = new ApplicationDbContextFactory ( ) . CreateDbContext ( ) )
@ -515,26 +616,42 @@ namespace Kehyeedra3.Commands
lvlUp = $"You need **{toNextLvl}**xp more to reach Level **{level + 1}**" ;
lvlUp = $"You need **{toNextLvl}**xp more to reach Level **{level + 1}**" ;
}
}
await Database . SaveChangesAsync ( ) . ConfigureAwait ( false ) ; // :]
await Database . SaveChangesAsync ( ) . ConfigureAwait ( false ) ;
}
}
if ( dcatch = = 1 )
string baited = "" ;
string baiRa = "" ;
string baiBi = "" ;
string baiLe = "" ;
if ( bRar | | bBig )
{
baited + = "\nYou used bait. " ;
if ( bRar )
{
{
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\n {fish.Emote} You have caught a {weight / 100d}kg **{fish.Name}**, rarity: {fish.Rarity}\nYou gain **{xp}**xp.\n{lvlUp}" ) ;
baiRa = "(+)" ;
}
}
else
if ( bBig )
{
{
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\n {fish.Emote} You have caught **{dcatch}** {weight / 100d}kg **{fish.Name}**, rarity: {fish.Rarity}\nYou gain **{xp}**xp.\n{lvlUp}" ) ;
baiBi = "(+)" ;
}
}
}
if ( bLet )
{
baited + = "\nYou ate lettuce. " ;
baiLe = "(+10%)" ;
}
if ( dcatch = = 1 )
{
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}{baited}\n{fish.Emote} You have caught a {weight / 100d}kg{baiBi} **{fish.Name}**, rarity: {fish.Rarity}{baiRa}\nYou gain **{xp}**xp{baiLe}.\n{lvlUp}" ) ;
}
}
else
else
{
{
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nYour line snaps. Your disappointment is immeasurable, and your day is ruined." ) ;
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}{baited}\n{fish.Emote} You have caught **{dcatch}** {weight / 100d}kg{baiBi} **{fish.Name}**, rarity: {fish.Rarity}{baiRa}\nYou gain **{xp}**xp{baiLe}.\n{lvlUp} " ) ;
}
}
}
}
else
else
{
{
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\narrrrr-right, ye scurby bastard, I know yer eager t' scour the seven seas but ye needs t' wait till the next minute t' pillage the booty'o'the depths, savvy? " ) ;
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nYour line snaps. Your disappointment is immeasurable, and your day is ruined. " ) ;
}
}
}
}
@ -549,12 +666,38 @@ namespace Kehyeedra3.Commands
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nYou don't own any fishing rods. Try **fishing**." ) ;
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nYou don't own any fishing rods. Try **fishing**." ) ;
return ;
return ;
}
}
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nYou have unlocked fishing rods up to **T{user.RodOwned+1}**\nYou have currently equipped a **T{user.RodUsed+1}** rod" ) ;
string rodtype ;
if ( user . RodUsed = = 0 )
{
rodtype = "Basic" ;
}
else if ( user . RodUsed = = 1 )
{
rodtype = "Reinforced" ;
}
else if ( user . RodUsed = = 2 )
{
rodtype = "Spectral" ;
}
else if ( user . RodUsed = = 3 )
{
rodtype = "Cosmic" ;
}
else
{
rodtype = "Currently unobtainable" ;
}
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nYou have unlocked fishing rods up to **Tier {user.RodOwned+1}**\nYou have currently equipped a **{rodtype} Fishing Rod** (T{user.RodUsed+1})." ) ;
}
}
}
}
[Command("setrod"),Summary("Set your fishing rod to the desired tier (for example: 'setrod 1' to set to default rod.)")]
[Command("setrod"),Summary("Set your fishing rod to the desired tier (for example: 'setrod 1' to set to default rod.)")]
public async Task SetRod ( byte tier )
public async Task SetRod ( byte tier )
{
{
if ( tier < 1 )
{
tier = 1 ;
}
using ( var Database = new ApplicationDbContextFactory ( ) . CreateDbContext ( ) )
using ( var Database = new ApplicationDbContextFactory ( ) . CreateDbContext ( ) )
{
{
var user = Database . Fishing . FirstOrDefault ( x = > x . Id = = Context . User . Id ) ;
var user = Database . Fishing . FirstOrDefault ( x = > x . Id = = Context . User . Id ) ;
@ -563,7 +706,7 @@ namespace Kehyeedra3.Commands
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nYou don't own any fishing rods. Try **fishing**." ) ;
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nYou don't own any fishing rods. Try **fishing**." ) ;
return ;
return ;
}
}
if ( tier - 1 < = user . RodOwned )
if ( ( tier - 1 ) < = user . RodOwned )
{
{
user . RodUsed = Convert . ToByte ( tier - 1 ) ;
user . RodUsed = Convert . ToByte ( tier - 1 ) ;
string rodtype = "" ;
string rodtype = "" ;
@ -587,16 +730,131 @@ namespace Kehyeedra3.Commands
{
{
rodtype = "Currently unobtainable" ;
rodtype = "Currently unobtainable" ;
}
}
await Context . Channel . SendMessageAsync ( $"You are now using a **{rodtype} (T{tier})** rod " ) ;
await Context . Channel . SendMessageAsync ( $"You are now using a **{rodtype} Fishing Rod** (T{tier}). " ) ;
}
}
else
else
{
{
await Context . Channel . SendMessageAsync ( $"You don't have that rod. You own rods up to **T{user.RodOwned+1}**" ) ;
await Context . Channel . SendMessageAsync ( $"You don't have that rod. You own rods up to **Tier {user.RodOwned+1}**. " ) ;
}
}
await Database . SaveChangesAsync ( ) . ConfigureAwait ( false ) ;
await Database . SaveChangesAsync ( ) . ConfigureAwait ( false ) ;
}
}
}
}
[Command("craft", RunMode = RunMode.Async), Alias("c"), Summary("Specify 'r' to refine ingredients.")]
public async Task Crafting ( string option = null )
{
using ( var Database = new ApplicationDbContextFactory ( ) . CreateDbContext ( ) )
{
var fuser = Database . Fishing . FirstOrDefault ( i = > i . Id = = Context . User . Id ) ;
var user = Database . Users . FirstOrDefault ( i = > i . Id = = Context . User . Id ) ;
if ( fuser = = null | | fuser . Lvl < 3 0 )
{
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nYou can't craft anything yet.\nCome back when you reach **Lvl 30**." ) ;
return ;
}
var finv = fuser . GetInventory ( ) ;
var items = user . GetGenInve ( ) ;
if ( ! items . TryGetValue ( Items . UpgradeT2 , out int [ ] T2Up ) )
{
T2Up = new int [ ] { 0 } ;
items . Add ( Items . UpgradeT2 , T2Up ) ;
}
if ( ! items . TryGetValue ( Items . RodFrame , out int [ ] Rod ) )
{
Rod = new int [ ] { 0 } ;
items . Add ( Items . RodFrame , Rod ) ;
}
if ( option ! = null & & option . ToLowerInvariant ( ) . Contains ( "r" ) ) //finish this area up retard
{
var fish = finv . FirstOrDefault ( f = > f . Key = = FishSpecies . LuckyCatfish ) . Value [ ( int ) FishSize . Large ] ;
if ( fish < 1 | | user . Money < 1 0 0 0 )
{
string missing = "" ;
if ( fish < 1 )
{
missing + = "a **Lucky Catfish**" ;
}
if ( fish < 1 & & user . Money < 1 0 0 0 )
{
missing + = " & " ;
}
else
{
missing + = " " ;
}
if ( user . Money < 1 0 0 0 )
{
missing + = $"**{(1000 - user.Money).ToYeedraDisplay()}%**" ;
}
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nYou are missing {missing}." ) ;
return ;
}
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nProcess 1 **Lucky Catfish** for **0.1000%**? \n(Owned: {fish})\n" ) ;
var inp = await NextMessageAsync ( ) ;
if ( inp . Content . ToLowerInvariant ( ) . Contains ( "yes" ) )
{
if ( finv . TryGetValue ( FishSpecies . LuckyCatfish , out int [ ] Fesh ) )
{
Fesh [ 2 ] - = 1 ;
T2Up [ 0 ] + = 1 ;
}
user . GrantMoney ( Database . Users . FirstOrDefault ( x = > x . Id = = 0 ) , - 1 0 0 0 ) ;
user . SetGenInve ( items ) ;
fuser . SetInventory ( finv ) ;
await Database . SaveChangesAsync ( ) ;
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nYou have obtained **Lucky Paste**" ) ;
}
}
else
{
if ( fuser . RodOwned > 0 )
{
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nYou already have everything currently craftable." ) ;
return ;
}
if ( T2Up [ 0 ] ! = 0 & & Rod [ 0 ] ! = 0 )
{
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nDo you want to craft the **Reinforced Fishing Rod**?\nThis will use 1 **Lucky Paste** and 1 **Incomplete Rod**." ) ;
var inp = await NextMessageAsync ( ) ;
if ( inp . Content ! = null & & inp . Content . ToLowerInvariant ( ) . Contains ( "yes" ) )
{
T2Up [ 0 ] - = 1 ;
Rod [ 0 ] - = 1 ;
fuser . RodOwned + = 1 ;
user . SetGenInve ( items ) ;
await Database . SaveChangesAsync ( ) ;
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nYou have successfully crafted a **Reinforced Fishing Rod**, **;setrod 2** to use it." ) ;
}
else
{
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nok retard." ) ;
}
}
else
{
string msg = "You are missing parts.\n" ;
if ( T2Up [ 0 ] < 1 )
{
msg + = "**Lucky Paste**\n" ;
}
if ( Rod [ 0 ] < 1 )
{
msg + = "**Incomplete Rod**" ;
}
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\n{msg}" ) ;
}
}
}
}
[Command("fishinventory"), Alias("finv", "fishinv"), Summary("Shows the fish you have currently. Variables: fish tier")]
[Command("fishinventory"), Alias("finv", "fishinv"), Summary("Shows the fish you have currently. Variables: fish tier")]
public async Task FishInventory ( int? tier = null , IGuildUser user = null )
public async Task FishInventory ( int? tier = null , IGuildUser user = null )
{
{
@ -639,6 +897,7 @@ namespace Kehyeedra3.Commands
List < Fish > fishes = Fishing . GetFishList ( ) ;
List < Fish > fishes = Fishing . GetFishList ( ) ;
List < Fish > unrfish = fishes . Where ( f = > ( int ) f . Rarity = = ( int ) FishRarity . Unreasonable ) . ToList ( ) ;
List < Fish > legfish = fishes . Where ( f = > ( int ) f . Rarity = = ( int ) FishRarity . Legendary ) . ToList ( ) ;
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 > 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 > uncfish = fishes . Where ( f = > ( int ) f . Rarity = = ( int ) FishRarity . Uncommon ) . ToList ( ) ;
@ -680,6 +939,7 @@ namespace Kehyeedra3.Commands
return ;
return ;
}
}
string unreasonable = "" ;
string legendary = "" ;
string legendary = "" ;
string rare = "" ;
string rare = "" ;
string uncommon = "" ;
string uncommon = "" ;
@ -714,7 +974,11 @@ namespace Kehyeedra3.Commands
}
}
fishtext + = $" ]\n" ;
fishtext + = $" ]\n" ;
if ( legfish . Any ( f = > f . Id = = entry . Key ) )
if ( unrfish . Any ( f = > f . Id = = entry . Key ) )
{
unreasonable + = $"{fishtext}" ;
}
if ( legfish . Any ( f = > f . Id = = entry . Key ) )
{
{
legendary + = $"{fishtext}" ;
legendary + = $"{fishtext}" ;
}
}
@ -732,6 +996,10 @@ namespace Kehyeedra3.Commands
}
}
}
}
string locker = $"" ;
string locker = $"" ;
if ( unreasonable ! = "" )
{
locker + = $"{unreasonable}\n" ;
}
if ( legendary ! = "" )
if ( legendary ! = "" )
{
{
locker + = $"{legendary}\n" ;
locker + = $"{legendary}\n" ;
@ -777,13 +1045,17 @@ namespace Kehyeedra3.Commands
user = Database . Users . FirstOrDefault ( x = > x . Id = = Context . User . Id ) ;
user = Database . Users . FirstOrDefault ( x = > x . Id = = Context . User . Id ) ;
inv = user . GetGenInve ( ) ;
inv = user . GetGenInve ( ) ;
foreach ( var entry in inv )
foreach ( var entry in inv )
{
if ( entry . Value [ 0 ] > 0 )
{
{
item = items . FirstOrDefault ( x = > x . Id = = entry . Key ) ;
item = items . FirstOrDefault ( x = > x . Id = = entry . Key ) ;
message + = $"**{item.Name}**: **{entry.Value[0]}**\n" ;
message + = $"**{item.Name}**: **{entry.Value[0]}**\n" ;
}
}
}
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\n{message}" ) ;
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\n{message}" ) ;
}
}
}
}
[RequireRolePrecondition(AccessLevel.ServerAdmin)]
[Command("tradebuy", RunMode = RunMode.Async), Summary("Unfinished command")]
[Command("tradebuy", RunMode = RunMode.Async), Summary("Unfinished command")]
public async Task TradingBuy ( int amount , string itemtype , int price , [ Remainder ] string item )
public async Task TradingBuy ( int amount , string itemtype , int price , [ Remainder ] string item )
{
{
@ -826,7 +1098,7 @@ namespace Kehyeedra3.Commands
if ( Database . StoreFronts . Any ( x = > x . StoreItemType = = StoreItemType . Fish ) )
if ( Database . StoreFronts . Any ( x = > x . StoreItemType = = StoreItemType . Fish ) )
{
{
var stores = Database . StoreFronts . Where ( x = > x . StoreItemType = = StoreItemType . Fish ) . ToList ( ) ;
var stores = Database . StoreFronts . AsQueryable ( ) . Where ( x = > x . StoreItemType = = StoreItemType . Fish ) . ToList ( ) ;
stores . Shuffle ( ) ;
stores . Shuffle ( ) ;
@ -864,6 +1136,7 @@ namespace Kehyeedra3.Commands
}
}
}
}
}
}
[RequireRolePrecondition(AccessLevel.ServerAdmin)]
[Command("tradesell"), Summary("Unfinished command")]
[Command("tradesell"), Summary("Unfinished command")]
public async Task TradingSell ( int amount , string itemtype , int price , [ Remainder ] string item )
public async Task TradingSell ( int amount , string itemtype , int price , [ Remainder ] string item )
{
{
@ -910,6 +1183,7 @@ namespace Kehyeedra3.Commands
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nInvalid trade type. Come back when the error command is fixed lmaoy" ) . ConfigureAwait ( false ) ;
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nInvalid trade type. Come back when the error command is fixed lmaoy" ) . ConfigureAwait ( false ) ;
}
}
}
}
[RequireRolePrecondition(AccessLevel.ServerAdmin)]
[Command("tradeoffers"), Summary("Unfinished command")]
[Command("tradeoffers"), Summary("Unfinished command")]
public async Task ShowOffers ( bool localOffers = true )
public async Task ShowOffers ( bool localOffers = true )
{
{
@ -918,7 +1192,7 @@ namespace Kehyeedra3.Commands
StringBuilder message = new StringBuilder ( ) ;
StringBuilder message = new StringBuilder ( ) ;
if ( localOffers )
if ( localOffers )
{
{
var stores = database . StoreFronts . Where ( x = > x . UserId = = Context . User . Id ) ;
var stores = database . StoreFronts . AsQueryable ( ) . Where ( x = > x . UserId = = Context . User . Id ) ;
foreach ( var store in stores )
foreach ( var store in stores )
{
{
@ -1016,7 +1290,7 @@ namespace Kehyeedra3.Commands
User skuld ;
User skuld ;
using ( var Database = new ApplicationDbContextFactory ( ) . CreateDbContext ( ) )
using ( var Database = new ApplicationDbContextFactory ( ) . CreateDbContext ( ) )
{
{
users = Database . Users . OrderByDescending ( user = > user . Money ) . ToList ( ) ;
users = Database . Users . AsQueryable ( ) . OrderByDescending ( user = > user . Money ) . ToList ( ) ;
bank = Database . Users . FirstOrDefault ( x = > x . Id = = 0 ) ;
bank = Database . Users . FirstOrDefault ( x = > x . Id = = 0 ) ;
skuld = Database . Users . FirstOrDefault ( x = > x . Id = = 1 ) ;
skuld = Database . Users . FirstOrDefault ( x = > x . Id = = 1 ) ;
}
}
@ -1039,7 +1313,7 @@ namespace Kehyeedra3.Commands
List < Fishing > users ;
List < Fishing > users ;
using ( var Database = new ApplicationDbContextFactory ( ) . CreateDbContext ( ) )
using ( var Database = new ApplicationDbContextFactory ( ) . CreateDbContext ( ) )
{
{
users = Database . Fishing . OrderByDescending ( user = > user . TXp ) . ToList ( ) ;
users = Database . Fishing . AsQueryable ( ) . OrderByDescending ( user = > user . TXp ) . ToList ( ) ;
string leaderboardMessage = "**Top Ten Smelliest Fishermen**:" ;
string leaderboardMessage = "**Top Ten Smelliest Fishermen**:" ;
int placing = 0 ;
int placing = 0 ;
for ( int i = 0 ; i < 1 0 ; i + + )
for ( int i = 0 ; i < 1 0 ; i + + )
@ -1151,7 +1425,7 @@ namespace Kehyeedra3.Commands
}
}
else
else
{
{
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nYou were added to database." ) ;
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nYou were added to the database." ) ;
}
}
return ;
return ;
}
}
@ -1191,10 +1465,15 @@ namespace Kehyeedra3.Commands
var muser = database . Users . FirstOrDefault ( x = > x . Id = = Context . User . Id ) ;
var muser = database . Users . FirstOrDefault ( x = > x . Id = = Context . User . Id ) ;
string pres = "" ;
string pres = "" ;
double cawe = 0 ;
double cawe = 0 ;
if ( user . Prestige > 0 )
if ( user . Prestige = = 1 )
{
{
pres = $" +{user.Prestige}P" ;
pres = $" +{user.Prestige}P" ;
cawe = 5 0 0 ;
cawe = 5 0 0 + user . Lvl * 3d ;
}
else if ( user . Prestige > 1 )
{
pres = $" +{user.Prestige}P" ;
cawe = 8 0 0 ;
}
}
else
else
{
{