@ -158,33 +158,29 @@ namespace Kehyeedra3.Commands
}
}
if ( end = = 0 )
if ( end < = 0 )
{
await Context . Channel . SendMessageAsync ( $"{marks}\n{Context.User.Mention} You have found {ore} {discard}." ) ;
return ;
}
else
else if ( end < 3 )
{
if ( end < 3 )
{
await Context . Channel . SendMessageAsync ( $"{marks}\n{Context.User.Mention} You found {end / 10000d}% while mining" ) ;
}
await Context . Channel . SendMessageAsync ( $"{marks}\n{Context.User.Mention} You found {end / 10000d}% while mining" ) ;
}
if ( end ! = 0 )
using ( var Database = new ApplicationDbContextFactory ( ) . CreateDbContext ( ) )
{
using ( var Database = new ApplicationDbContextFactory ( ) . CreateDbContext ( ) )
{
var user = Database . Users . FirstOrDefault ( x = > x . Id = = Context . User . Id ) ;
if ( ! user . GrantMoney ( Database . Users . FirstOrDefault ( x = > x . Id = = 0 ) , end ) )
{
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nBank has no money, convince someone to gamble." ) ;
return ;
}
var user = Database . Users . FirstOrDefault ( x = > x . Id = = Context . User . Id ) ;
await Database . SaveChangesAsync ( ) ;
if ( ! user . GrantMoney ( Database . Users . FirstOrDefault ( x = > x . Id = = 0 ) , end ) )
{
await Context . Channel . SendMessageAsync ( $"{Context.User.Mention}\nBank has no money, convince someone to gamble." ) ;
return ;
}
await Database . SaveChangesAsync ( ) ;
}
}
else
{
@ -238,10 +234,22 @@ namespace Kehyeedra3.Commands
{
int rari = ( SRandom . Next ( 0 , 2 0 0 1 ) ) ;
int weigh = SRandom . Next ( 1 0 , 1 5 0 1 + prestige * 5 0 0 ) ;
int tierRoll = SRandom . Next ( 0 , 1 0 1 + prestige * 1 0 0 ) ;
int tierRoll = SRandom . Next ( 0 , 8 1 + prestige * 4 0 ) ;
int dCatchRoll = SRandom . Next ( 0 , 1 0 0 0 + prestige * 5 ) ;
int dcatch = 1 ;
ulong rarity ;
int weight ;
if ( dCatchRoll > 1 0 0 0 )
{
int many = 9 9 5 ;
while ( many + 5 < = dCatchRoll )
{
dcatch + = 1 ;
many + = 5 ;
}
}
if ( level < 1 0 0 & & prestige = = 0 )
{
rarity = level * 1 0 + ( ulong ) rari ;
@ -381,13 +389,13 @@ namespace Kehyeedra3.Commands
{
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 )
{
weight = SRandom . Next ( 2 0 0 0 + Convert . ToInt32 ( level * 2 0 ) , 4 0 0 0 1 + prestige * 1 0 0 0 0 ) ;
}
if ( weight > = 1 0 0 0 )
{
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 ) ;
}
if ( weight > = 1 5 0 0 )
{
@ -399,7 +407,7 @@ namespace Kehyeedra3.Commands
}
double w = Convert . ToDouble ( weight ) ;
xp = Convert . ToUInt64 ( Math . Round ( ( xp * w / 1 0 0 0 ) , 0 , MidpointRounding . ToEven ) ) ;
xp = Convert . ToUInt64 ( Math . Round ( xp * w / 1 0 0 0 , 0 , MidpointRounding . ToEven ) ) * ( ulong ) dcatch ;
if ( fish . Rarity = = FishRarity . Legendary | | fish . Rarity = = FishRarity . T2Legendary | | fish . Rarity = = FishRarity . T3Legendary | | fish . Rarity = = FishRarity . T4Legendary )
{
@ -440,7 +448,7 @@ namespace Kehyeedra3.Commands
}
int sizeIndex = ( int ) size ;
amounts [ sizeIndex ] + + ;
amounts [ sizeIndex ] + = dcatch ;
user . SetInventory ( inv ) ;
@ -502,8 +510,15 @@ namespace Kehyeedra3.Commands
await Database . SaveChangesAsync ( ) . ConfigureAwait ( false ) ; // :]
}
if ( dcatch = = 1 )
{
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}" ) ;
}
else
{
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}" ) ;
}
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}" ) ;
}
else
{
@ -608,101 +623,58 @@ namespace Kehyeedra3.Commands
Dictionary < FishSpecies , int > med = new Dictionary < FishSpecies , int > ( ) ;
Dictionary < FishSpecies , int > large = new Dictionary < FishSpecies , int > ( ) ;
List < Fish > fishes = Fishing . GetFishList ( ) ;
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 ( ) ;
string legendary = "" ;
string rare = "" ;
string uncommon = "" ;
string common = "" ;
int lc = 0 ;
string fishnam = "" ;
string fishmote = "" ;
string fishtext = "" ;
foreach ( var entry in inv )
{
if ( entry . Value . Count ( ) > 0 )
lc + = 1 ;
fishmote = fishes . FirstOrDefault ( x = > x . Id = = entry . Key ) . Emote ;
if ( entry . Key = = FishSpecies . LuckyCatfish )
{
if ( entry . Value [ 0 ] > 0 )
{
small . Add ( entry . Key , entry . Value [ 0 ] ) ;
}
fishnam = "Lucky Catfish" ;
}
if ( entry . Value . Count ( ) > 1 )
else
{
if ( entry . Value [ 1 ] > 0 )
{
med . Add ( entry . Key , entry . Value [ 1 ] ) ;
}
fishnam = $"{entry.Key}" ;
}
if ( entry . Value . Count ( ) > 2 )
{
if ( entry . Value [ 2 ] > 0 )
{
large . Add ( entry . Key , entry . Value [ 2 ] ) ;
}
}
}
if ( user . Id ! = Context . User . Id )
{
await Context . Channel . SendMessageAsync ( $"arr matey this be {user.Mention}'s locker" ) ;
}
fishtext = $"**{fishmote} [S{entry.Value[0]} M{entry.Value[1]} L{entry.Value[2]}]**\n" ;
if ( small . Any ( ) )
{
EmbedBuilder embed = new EmbedBuilder
if ( legfish . Any ( f = > f . Id = = entry . Key ) )
{
Title = "small mateys"
} ;
foreach ( var entry in small )
legendary + = $"{fishtext}" ;
}
if ( rarfish . Any ( f = > f . Id = = entry . Key ) )
{
if ( entry . Key = = FishSpecies . LuckyCatfish )
{
embed . AddField ( "Lucky Catfish" , $"{entry.Value} feeshie{(entry.Value > 1 ? " s " : " ")}" , true ) ;
}
else
{
embed . AddField ( entry . Key . ToString ( ) , $"{entry.Value} feeshie{(entry.Value > 1 ? " s " : " ")}" , true ) ;
}
rare + = $"{fishtext}" ;
}
await Context . Channel . SendMessageAsync ( $"" , embed : embed . Build ( ) ) ;
}
if ( med . Any ( ) )
{
EmbedBuilder embed = new EmbedBuilder
if ( uncfish . Any ( f = > f . Id = = entry . Key ) )
{
Title = "medium mateys"
} ;
foreach ( var entry in med )
uncommon + = $"{fishtext}" ;
}
if ( comfish . Any ( f = > f . Id = = entry . Key ) )
{
if ( entry . Key = = FishSpecies . LuckyCatfish )
{
embed . AddField ( "Lucky Catfish" , $"{entry.Value} feeshie{(entry.Value > 1 ? " s " : " ")}" , true ) ;
}
else
{
embed . AddField ( entry . Key . ToString ( ) , $"{entry.Value} feeshie{(entry.Value > 1 ? " s " : " ")}" , true ) ;
}
common + = $"{fishtext}" ;
}
await Context . Channel . SendMessageAsync ( $"" , embed : embed . Build ( ) ) ;
}
if ( large . Any ( ) )
if ( user . Id ! = Context . User . Id )
{
EmbedBuilder embed = new EmbedBuilder
{
Title = "large mateys"
} ;
foreach ( var entry in large )
{
if ( entry . Key = = FishSpecies . LuckyCatfish )
{
embed . AddField ( "Lucky Catfish" , $"{entry.Value} feeshie{(entry.Value > 1 ? " s " : " ")}" , true ) ;
}
else
{
embed . AddField ( entry . Key . ToString ( ) , $"{entry.Value} feeshie{(entry.Value > 1 ? " s " : " ")}" , true ) ;
}
}
await Context . Channel . SendMessageAsync ( $"" , embed : embed . Build ( ) ) ;
await Context . Channel . SendMessageAsync ( $"arr matey this be {user.Mention}'s locker\n{legendary}\n{rare}\n{uncommon}\n{common}" ) ;
}
else
{
await Context . Channel . SendMessageAsync ( $"arr matey this be {Context.User.Mention}'s locker\n{legendary}\n{rare}\n{uncommon}\n{common}" ) ;
}
}
else