2016-08-16 12:57:47 +00:00
using Discord.Commands ;
using Discord ;
2017-10-13 04:14:54 +00:00
using NadekoBot.Core.Services ;
2016-08-16 12:57:47 +00:00
using System.Threading.Tasks ;
using System ;
2017-07-17 19:42:36 +00:00
using NadekoBot.Common ;
using NadekoBot.Common.Attributes ;
2016-08-16 12:57:47 +00:00
using NadekoBot.Extensions ;
2017-07-17 19:42:36 +00:00
using NadekoBot.Modules.Games.Common ;
using NadekoBot.Modules.Games.Services ;
2016-08-16 12:57:47 +00:00
namespace NadekoBot.Modules.Games
{
2017-09-10 01:52:34 +00:00
/ * more games
2017-07-25 16:31:30 +00:00
- Blackjack
- Shiritori
- Simple RPG adventure
* /
2017-07-15 16:34:34 +00:00
public partial class Games : NadekoTopLevelModule < GamesService >
2016-08-16 12:57:47 +00:00
{
2017-05-27 08:19:27 +00:00
private readonly IImagesService _images ;
2016-12-29 06:50:05 +00:00
2017-07-15 16:34:34 +00:00
public Games ( IImagesService images )
2017-02-20 22:46:34 +00:00
{
2017-05-27 08:19:27 +00:00
_images = images ;
}
2017-02-20 22:46:34 +00:00
2016-10-05 03:09:44 +00:00
[NadekoCommand, Usage, Description, Aliases]
2016-12-16 19:45:46 +00:00
public async Task Choose ( [ Remainder ] string list = null )
2016-08-16 12:57:47 +00:00
{
if ( string . IsNullOrWhiteSpace ( list ) )
return ;
var listArr = list . Split ( ';' ) ;
2017-02-25 15:35:09 +00:00
if ( listArr . Length < 2 )
2016-08-16 12:57:47 +00:00
return ;
2016-09-10 19:40:25 +00:00
var rng = new NadekoRandom ( ) ;
2016-12-16 19:45:46 +00:00
await Context . Channel . SendConfirmAsync ( "🤔" , listArr [ rng . Next ( 0 , listArr . Length ) ] ) . ConfigureAwait ( false ) ;
2016-08-16 12:57:47 +00:00
}
2016-10-05 03:09:44 +00:00
[NadekoCommand, Usage, Description, Aliases]
2017-09-17 05:28:48 +00:00
public async Task EightBall ( [ Remainder ] string question = null )
2016-08-16 12:57:47 +00:00
{
if ( string . IsNullOrWhiteSpace ( question ) )
return ;
2016-12-11 00:42:58 +00:00
2016-12-16 19:45:46 +00:00
await Context . Channel . EmbedAsync ( new EmbedBuilder ( ) . WithColor ( NadekoBot . OkColor )
2017-10-15 07:39:46 +00:00
. AddField ( efb = > efb . WithName ( "test❓ " + GetText ( "question" ) ) . WithValue ( question ) . WithIsInline ( false ) )
2017-07-15 16:34:34 +00:00
. AddField ( efb = > efb . WithName ( "🎱 " + GetText ( "8ball" ) ) . WithValue ( _service . EightBallResponses [ new NadekoRandom ( ) . Next ( 0 , _service . EightBallResponses . Length ) ] ) . WithIsInline ( false ) ) ) ;
2016-08-16 12:57:47 +00:00
}
2016-10-05 03:09:44 +00:00
[NadekoCommand, Usage, Description, Aliases]
2016-12-16 19:45:46 +00:00
public async Task Rps ( string input )
2016-08-16 12:57:47 +00:00
{
2017-02-25 15:35:09 +00:00
Func < int , string > getRpsPick = ( p ) = >
2016-08-16 12:57:47 +00:00
{
2017-02-19 14:18:40 +00:00
switch ( p )
{
case 0 :
return "🚀" ;
case 1 :
return "📎" ;
default :
return "✂️" ;
}
2016-08-16 12:57:47 +00:00
} ;
int pick ;
switch ( input )
{
case "r" :
case "rock" :
case "rocket" :
pick = 0 ;
break ;
case "p" :
case "paper" :
case "paperclip" :
pick = 1 ;
break ;
case "scissors" :
case "s" :
pick = 2 ;
break ;
default :
return ;
}
2016-09-10 19:40:25 +00:00
var nadekoPick = new NadekoRandom ( ) . Next ( 0 , 3 ) ;
2017-02-19 14:18:40 +00:00
string msg ;
2016-08-16 12:57:47 +00:00
if ( pick = = nadekoPick )
2017-02-25 15:35:09 +00:00
msg = GetText ( "rps_draw" , getRpsPick ( pick ) ) ;
2016-08-16 12:57:47 +00:00
else if ( ( pick = = 0 & & nadekoPick = = 1 ) | |
( pick = = 1 & & nadekoPick = = 2 ) | |
( pick = = 2 & & nadekoPick = = 0 ) )
2017-05-27 08:19:27 +00:00
msg = GetText ( "rps_win" , Context . Client . CurrentUser . Mention ,
2017-02-25 15:35:09 +00:00
getRpsPick ( nadekoPick ) , getRpsPick ( pick ) ) ;
2016-08-16 12:57:47 +00:00
else
2017-02-25 15:35:09 +00:00
msg = GetText ( "rps_win" , Context . User . Mention , getRpsPick ( pick ) ,
getRpsPick ( nadekoPick ) ) ;
2016-08-16 12:57:47 +00:00
2016-12-16 19:45:46 +00:00
await Context . Channel . SendConfirmAsync ( msg ) . ConfigureAwait ( false ) ;
2016-08-16 12:57:47 +00:00
}
2017-02-20 22:46:34 +00:00
2017-02-22 17:16:05 +00:00
[NadekoCommand, Usage, Description, Aliases]
[RequireContext(ContextType.Guild)]
public async Task RateGirl ( IGuildUser usr )
{
2017-07-15 16:34:34 +00:00
var gr = _service . GirlRatings . GetOrAdd ( usr . Id , GetGirl ) ;
2017-02-22 17:16:05 +00:00
var img = await gr . Url ;
await Context . Channel . EmbedAsync ( new EmbedBuilder ( ) . WithOkColor ( )
. WithTitle ( "Girl Rating For " + usr )
. AddField ( efb = > efb . WithName ( "Hot" ) . WithValue ( gr . Hot . ToString ( "F2" ) ) . WithIsInline ( true ) )
. AddField ( efb = > efb . WithName ( "Crazy" ) . WithValue ( gr . Crazy . ToString ( "F2" ) ) . WithIsInline ( true ) )
. AddField ( efb = > efb . WithName ( "Advice" ) . WithValue ( gr . Advice ) . WithIsInline ( false ) )
. WithImageUrl ( img ) ) . ConfigureAwait ( false ) ;
}
2017-02-20 22:46:34 +00:00
private double NextDouble ( double x , double y )
{
var rng = new Random ( ) ;
return rng . NextDouble ( ) * ( y - x ) + x ;
}
private GirlRating GetGirl ( ulong uid )
{
var rng = new NadekoRandom ( ) ;
var roll = rng . Next ( 1 , 1001 ) ;
2017-02-25 15:35:09 +00:00
if ( ( uid = = 185968432783687681 | |
uid = = 265642040950390784 ) & & roll > = 900 )
roll = 1000 ;
2017-02-25 03:18:44 +00:00
2017-02-25 03:40:21 +00:00
2017-02-20 22:46:34 +00:00
double hot ;
double crazy ;
string advice ;
if ( roll < 500 )
{
hot = NextDouble ( 0 , 5 ) ;
crazy = NextDouble ( 4 , 10 ) ;
advice =
2017-08-21 01:08:57 +00:00
"This is your NO-GO ZONE. We do not hang around, and date, and marry women who are at least, in our mind, a 5. " +
2017-02-20 22:46:34 +00:00
"So, this is your no-go zone. You don't go here. You just rule this out. Life is better this way, that's the way it is." ;
}
else if ( roll < 750 )
{
hot = NextDouble ( 5 , 8 ) ;
crazy = NextDouble ( 4 , . 6 * hot + 4 ) ;
advice = "Above a 5, and to about an 8, and below the crazy line - this is your FUN ZONE. You can " +
"hang around here, and meet these girls and spend time with them. Keep in mind, while you're " +
"in the fun zone, you want to move OUT of the fun zone to a more permanent location. " +
"These girls are most of the time not crazy." ;
}
else if ( roll < 900 )
{
hot = NextDouble ( 5 , 10 ) ;
crazy = NextDouble ( . 61 * hot + 4 , 10 ) ;
advice = "Above the crazy line - it's the DANGER ZONE. This is redheads, strippers, anyone named Tiffany, " +
"hairdressers... This is where your car gets keyed, you get bunny in the pot, your tires get slashed, " +
"and you wind up in jail." ;
}
else if ( roll < 951 )
{
hot = NextDouble ( 8 , 10 ) ;
2017-02-25 15:35:09 +00:00
crazy = NextDouble ( 7 , . 6 * hot + 4 ) ;
2017-02-20 22:46:34 +00:00
advice = "Below the crazy line, above an 8 hot, but still about 7 crazy. This is your DATE ZONE. " +
"You can stay in the date zone indefinitely. These are the girls you introduce to your friends and your family. " +
"They're good looking, and they're reasonably not crazy most of the time. You can stay here indefinitely." ;
}
else if ( roll < 990 )
{
hot = NextDouble ( 8 , 10 ) ;
crazy = NextDouble ( 5 , 7 ) ;
2017-03-08 23:58:58 +00:00
advice = "Above an 8 hot, and between about 7 and a 5 crazy - this is WIFE ZONE. If you meet this girl, you should consider long-term " +
2017-02-20 22:46:34 +00:00
"relationship. Rare." ;
}
else if ( roll < 999 )
{
hot = NextDouble ( 8 , 10 ) ;
crazy = NextDouble ( 2 , 3.99d ) ;
advice = "You've met a girl she's above 8 hot, and not crazy at all (below 4)... totally cool?" +
2017-03-08 23:58:58 +00:00
" You should be careful. That's a dude. You're talking to a tranny!" ;
2017-02-20 22:46:34 +00:00
}
else
{
hot = NextDouble ( 8 , 10 ) ;
crazy = NextDouble ( 4 , 5 ) ;
advice = "Below 5 crazy, and above 8 hot, this is the UNICORN ZONE, these things don't exist." +
"If you find a unicorn, please capture it safely, keep it alive, we'd like to study it, " +
"and maybe look at how to replicate that." ;
}
2017-05-27 08:19:27 +00:00
return new GirlRating ( _images , crazy , hot , roll , advice ) ;
2017-02-20 22:46:34 +00:00
}
2016-10-05 03:09:44 +00:00
[NadekoCommand, Usage, Description, Aliases]
2016-12-16 19:45:46 +00:00
public async Task Linux ( string guhnoo , string loonix )
2016-08-16 12:57:47 +00:00
{
2016-12-16 19:45:46 +00:00
await Context . Channel . SendConfirmAsync (
2016-08-16 12:57:47 +00:00
$ @ "I'd just like to interject for moment. What you're refering to as {loonix}, is in fact, {guhnoo}/{loonix}, or as I've recently taken to calling it, {guhnoo} plus {loonix}. {loonix} is not an operating system unto itself, but rather another free component of a fully functioning {guhnoo} system made useful by the {guhnoo} corelibs, shell utilities and vital system components comprising a full OS as defined by POSIX.
Many computer users run a modified version of the { guhnoo } system every day , without realizing it . Through a peculiar turn of events , the version of { guhnoo } which is widely used today is often called { loonix } , and many of its users are not aware that it is basically the { guhnoo } system , developed by the { guhnoo } Project .
There really is a { loonix } , and these people are using it , but it is just a part of the system they use . { loonix } is the kernel : the program in the system that allocates the machine ' s resources to the other programs that you run . The kernel is an essential part of an operating system , but useless by itself ; it can only function in the context of a complete operating system . { loonix } is normally used in combination with the { guhnoo } operating system : the whole system is basically { guhnoo } with { loonix } added , or { guhnoo } / { loonix } . All the so - called { loonix } distributions are really distributions of { guhnoo } / { loonix } . "
) . ConfigureAwait ( false ) ;
}
}
}