/*
* Original buggy and crappy and small version by NtPotJmaU
* Bug fixes made by OleAndEr, Addition of ASCII art by OleAndEr
* Addition of not enough money by OleAndEr, Addition of non residency
* cannot play by OleAndEr, Addition of dice log, wdice log and ldice log
* by OleAndEr, Addition of DiCE vervion by OleAndEr, and the Addition of
* just about everything else by OleAndEr
*/
#include <stdio.h>
#include <stdlib.h>
#include "include/config.h"
#include "include/player.h"
#include "include/proto.h"
void dice(player * p)
{
int dieOne = ( rand() % 6 ) + 1;
int dieTwo = ( rand() % 6 ) + 1;
if (p->residency < BASE ) /* Hey, if they arent a resident, why let em play? */
{
TELLPLAYER(p, "^BSorry, but only residents may gamble their money away on dice\n"
"^YPlease talk to a staff member about residency^A\n");
}
else
{
/* Well, if they dont have the money, Why let them play? */
if (p->pennies < 200)
{
TELLPLAYER(p, " Sorry, But, you can't lose what you don't have.\n"
" (You need at least 200 %s to play)\n", get_config_msg("cash_name"));
LOGF("dice", "%s is short %s to roll the dice", p->name, get_config_msg("cash_name"));
return;
}
p->pennies -= 200;
TELLPLAYER(p, "^Y-=*> You pay 200 %s to roll the dice^N\n\n", get_config_msg("cash_name"));
LOGF("dice", "%s ^ypays ^P200 %s^y to roll the dice^N", p->name, get_config_msg("cash_name"));
switch (dieOne)
{
case 1: tell_player(p, "^H _________ \n"
"^H | | \n"
"^H | | \n"
"^H | ^a O^H | \n"
"^H | | \n"
"^H |_________| \n\n"
"^XOn Die One You got a 1!^A\n");
break;
case 2: tell_player(p, "^H _________ \n"
"^H | | \n"
"^H | ^aO^H | \n"
"^H | | \n"
"^H | ^aO^H | \n"
"^H |_________| \n\n"
"^XOn Die One You got a 2!^A\n");
break;
case 3: tell_player(p, "^H _________ \n"
"^H | | \n"
"^H | ^aO^H | \n"
"^H | ^aO^H | \n"
"^H | ^aO^H | \n"
"^H |_________| \n\n"
"^XOn Die One You got a 3!\n");
break;
case 4: tell_player(p, "^H _________ \n"
"^H | | \n"
"^H | ^aO O^H | \n"
"^H | | \n"
"^H | ^aO O^H | \n"
"^H |_________| \n\n"
"^XOn Die One You got a 4!^A\n");
break;
case 5: tell_player(p, "^H _________ \n"
"^H | | \n"
"^H | ^aO O^H | \n"
"^H | ^aO^H | \n"
"^H | ^aO O^H | \n"
"^H |_________| \n\n"
"^XOn Die One You got a 5!^A\n");
break;
case 6: tell_player(p, "^H _________ \n"
"^H | | \n"
"^H | ^aO O^H | \n"
"^H | ^aO O^H | \n"
"^H | ^aO O^H | \n"
"^H |_________| \n"
"^XOn Die One You got a 6!^A\n");
break;
}
switch (dieTwo)
{
case 1: tell_player(p, "^H _________ \n"
"^H | | \n"
"^H | | \n"
"^H | ^aO^H | \n"
"^H | | \n"
"^H |_________| \n\n"
"^XOn Die Two You got a 1!^A\n\n");
break;
case 2: tell_player(p, "^H _________ \n"
"^H | | \n"
"^H | ^aO^H | \n"
"^H | | \n"
"^H | ^aO^H | \n"
"^H |_________| \n\n"
"^XOn Die Two You got a 2!^A\n\n");
break;
case 3: tell_player(p, "^H _________ \n"
"^H | | \n"
"^H | ^aO^H | \n"
"^H | ^aO^H | \n"
"^H | ^aO^H | \n"
"^H |_________| \n\n"
"^XOn Die Two You got a 3!^A\n\n");
break;
case 4: tell_player(p, "^H _________ \n"
"^H | | \n"
"^H | ^aO O^H | \n"
"^H | | \n"
"^H | ^aO O^N^H | \n"
"^H |_________| \n\n"
"^XOn Die Two You got a 4!^A\n\n");
break;
case 5: tell_player(p, "^H _________ \n"
"^H | | \n"
"^H | ^aO O^H | \n"
"^H | ^aO^H | \n"
"^H | ^aO O^H | \n"
"^H |_________| \n\n"
"^XOn Die Two You got a 5!^A\n\n");
break;
case 6: tell_player(p, "^H _________ \n"
"^H | | \n"
"^H | ^aO O^H | \n"
"^H | ^aO O^H | \n"
"^H | ^aO O^H | \n"
"^H |_________| \n\n"
"^XOn Die Two You got a 6!^N\n\n");
break;
}
if ( dieOne == 6 && dieTwo == 6 ) /* I guess we gotta let them win something ;) */
{
p->pennies += 1000;
TELLPLAYER(p, "Double Sixes, You just got 1000 %s\a\n", get_config_msg("cash_name"));
LOGF("wdice", "%s ^Ygets ^RDouble ^Ysixes^N", p->name);
}
else if ( dieOne == 6 && dieTwo == 2 )
{
p->pennies += 300;
TELLPLAYER(p, "Not bad, You got 300 %s\n", get_config_msg("cash_name"));
LOGF("wdice", "%s gets a 6 on the first die", p->name);
}
else if ( dieOne == 6 && dieTwo == 3 )
{
p->pennies += 300;
TELLPLAYER(p, "Not bad, You got 300 %s\n", get_config_msg("cash_name"));
LOGF("wdice", "%s gets a 6 on the first die", p->name);
}
else if ( dieOne == 6 && dieTwo == 4 )
{
p->pennies += 300;
TELLPLAYER(p, "Not bad, You got 300 %s\n", get_config_msg("cash_name"));
LOGF("wdice", "%s gets a 6 on the first die", p->name);
}
else if ( dieOne == 6 && dieTwo == 5 )
{
p->pennies -= 300;
TELLPLAYER(p, "You just lost 300 %s\n", get_config_msg("cash_name"));
LOGF("ldice", "%s gets a 6 and a five and looses 300 %s", p->name, get_config_msg("cash_name"));
}
else if ( dieOne == 6 && dieTwo == 1 ) /* 7 is an awesome number */
{
p->pennies += 900;
TELLPLAYER(p, "Awesome, that adds up to 7 You get 900 %s\n", get_config_msg("cash_name"));
LOGF("wdice", "%s ^Hgets a ^P6^H and a ^Y1^N", p->name);
}
else if ( dieOne == 2 && dieTwo == 2 )
{
p->pennies += 500;
TELLPLAYER(p, "Doubles Twos, thats another 500 %s\n", get_config_msg("cash_name"));
LOGF("wdice", "%s gets doubles", p->name);
}
else if ( dieOne == 3 && dieTwo == 3 )
{
p->pennies += 300;
TELLPLAYER(p, "Doubles Threes, thats another 300 %s\n", get_config_msg("cash_name"));
LOGF("wdice", "%s gets doubles", p->name);
}
else if ( dieOne == 4 && dieTwo == 4 )
{
p->pennies += 300;
TELLPLAYER(p, "Doubles Fours, thats another 300 %s\n", get_config_msg("cash_name"));
LOGF("wdice", "%s gets doubles", p->name);
}
else if ( dieOne == 5 && dieTwo == 5 ) /* What, you expect them to win on all doubles? */
{
p->pennies -= 300;
TELLPLAYER(p, "You just lost 300 %s for getting double fives\n", get_config_msg("cash_name"));
LOGF("ldice", "%s just lost 300 %s", p->name, get_config_msg("cash_name"));
}
else if ( dieOne == 1 && dieTwo == 1 ) /* Hey, gotta lose sometime }:) */
{
p->pennies -= 1000;
TELLPLAYER(p, "Ohh Man, Snake eyes, You just lost 1000 %s\a\n", get_config_msg("cash_name"));
LOGF("ldice", "%s ^Ygets ^PSnake Eyes^N", p->name);
}
else /* Can't win everytime */
{
TELLPLAYER(p, "Ohh well, better luck next on the next roll\n");
}
}
}
void dice_version(void)
{
stack += sprintf(stack, "^Y -=*> You are using ^BD^N^Hi^RC^N^HE^N ^Rv5.2^Y. (by ^gOleAndEr^Y)^N\n");
}