/*
* 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
*/
/* Updates started on May 12th 2001 through May 13th
* Dice Align on August 09 ;)
* A Jackpot added to the code
* Easy Colour Change of the Dice
* Easy JaCKpOT amount added
* Some other bits added too
* Fix so's not to get negative money by stratcaster
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "include/config.h"
#include "include/player.h"
#include "include/proto.h"
void dice(player * p, char *str)
{
int diceFaces = ( rand() % 36 ) + 1;
char dc[3];
char hc[3];
/* This is the colour of your dice, change at will */
sprintf (dc, "%s", get_config_msg("dc"));
/* This is the colour of your hole, change at will */
sprintf (hc, "%s", get_config_msg("hc"));
if (p->residency == NON_RESIDENT ) /* Hey, if they arent a resident, why let em play? */
{
TELLPLAYER(p, "%s", LINE);
TELLPLAYER(p, "^BSorry, but only residents may gamble their money away on dice\n"
"^YPlease talk to a staff member about residency^A\n");
TELLPLAYER(p, "%s", LINE);
}
else
{
/* Well, if they dont have the money, Why let them play? */
if (p->pennies < 200)
{
TELLPLAYER(p, "%s", LINE);
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"));
TELLPLAYER(p, "%s", LINE);
LOGF("dice", "%s is short %s to roll the dice", p->name, get_config_msg("cash_name"));
return;
}
else
{
TELLPLAYER(p, "\n%s", LINE);
p->pennies -= 200;
jpot = (jpot + 200);
TELLPLAYER(p, "^Y\t\tYou pay 200 %s to roll the dice^N\n\n", get_config_msg("cash_name"));
LOGF("dice", "%s ^ypays ^P200 ^C%s^y to roll the dice^N", p->name, get_config_msg("cash_name"));
switch (diceFaces)
{
case 1: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | | | |\n"
" | %s O%s | | %sO%s"" |\n"
" | | | |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 1! ^XOn Die Two You got a 1!^A\n", dc, hc, dc, hc, dc);
break;
case 2: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | | | %sO%s |\n"
" | %sO%s | | |\n"
" | | | %sO%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 1! ^XOn Die Two You got a 2!^A\n", dc, hc, dc, hc, dc, hc, dc);
break;
case 3: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | | | %sO%s |\n"
" | %sO%s | | %sO%s"" |\n"
" | | | %sO%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 1! ^XOn Die Two You got a 3!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 4: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | | | %sO O%s |\n"
" | %sO%s | | |\n"
" | | | %sO O%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 1! ^XOn Die Two You got a 4!^A\n", dc, hc, dc, hc, dc, hc, dc);
break;
case 5: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | | | %sO O%s |\n"
" | %sO%s | | %sO%s |\n"
" | | | %sO O%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 1! ^XOn Die Two You got a 5!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 6: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | | | %sO O%s |\n"
" | %sO%s | | %sO O%s |\n"
" | | | %sO O%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 1! ^XOn Die Two You got a 6!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 7: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s | | |\n"
" | | | %sO%s |\n"
" | %sO%s | | |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 2! ^XOn Die Two You got a 1!^A\n", dc, hc, dc, hc, dc, hc, dc);
break;
case 8: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s | | %sO%s |\n"
" | | | |\n"
" | %sO%s | | %sO%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 2! ^XOn Die Two You got a 2!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 9: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s | | %sO%s |\n"
" | | | %sO%s |\n"
" | %sO%s | | %sO%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 2! ^XOn Die Two You got a 3!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 10: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s | | %sO%s %sO%s |\n"
" | | | |\n"
" | %sO%s | | %sO%s %sO%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 2! ^XOn Die Two You got a 4!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 11: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s | | %sO%s %sO%s |\n"
" | | | %sO%s |\n"
" | %sO%s | | %sO%s %sO%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 2! ^XOn Die Two You got a 5!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 12: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s | | %sO%s %sO%s |\n"
" | | | %sO%s %sO%s |\n"
" | %sO%s | | %sO%s %sO%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 2! ^XOn Die Two You got a 6!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 13: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s | | |\n"
" | %sO%s | | %sO%s |\n"
" | %sO%s | | |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 3! ^XOn Die Two You got a 1!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 14: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s | | %sO%s |\n"
" | %sO%s | | |\n"
" | %sO%s | | %sO%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 3! ^XOn Die Two You got a 2!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 15: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s | | %sO%s |\n"
" | %sO%s | | %sO%s |\n"
" | %sO%s | | %sO%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 3! ^XOn Die Two You got a 3!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 16: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s | | %sO%s %sO%s |\n"
" | %sO%s | | |\n"
" | %sO%s | | %sO%s %sO%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 3! ^XOn Die Two You got a 4!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 17: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s | | %sO%s %sO%s |\n"
" | %sO%s | | %sO%s |\n"
" | %sO%s | | %sO%s %sO%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 3! ^XOn Die Two You got a 5!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 18: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s | | %sO%s %sO%s |\n"
" | %sO%s | | %sO%s %sO%s |\n"
" | %sO%s | | %sO%s %sO%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 3! ^XOn Die Two You got a 6!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 19: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s %sO%s | | |\n"
" | | | %sO%s |\n"
" | %sO%s %sO%s | | |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 4! ^XOn Die Two You got a 1!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 20: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s %sO%s | | %sO%s |\n"
" | | | |\n"
" | %sO%s %sO%s | | %sO%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 4! ^XOn Die Two You got a 2!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 21: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s %sO%s | | %sO%s |\n"
" | | | %sO%s |\n"
" | %sO%s %sO%s | | %sO%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 4! ^XOn Die Two You got a 3!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 22: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s %sO%s | | %sO%s %sO%s |\n"
" | | | |\n"
" | %sO%s %sO%s | | %sO%s %sO%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 4! ^XOn Die Two You got a 4!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 23: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s %sO%s | | %sO%s %sO%s |\n"
" | | | %sO%s |\n"
" | %sO%s %sO%s | | %sO%s %sO%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 4! ^XOn Die Two You got a 5!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 24: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s %sO%s | | %sO%s %sO%s |\n"
" | | | %sO%s %sO%s |\n"
" | %sO%s %sO%s | | %sO%s %sO%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 4! ^XOn Die Two You got a 6!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 25: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s %sO%s | | |\n"
" | %sO%s | | %sO%s |\n"
" | %sO%s %sO%s | | |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 5! ^XOn Die Two You got a 1!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 26: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s %sO%s | | %sO%s |\n"
" | %sO%s | | |\n"
" | %sO%s %sO%s | | %sO%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 5! ^XOn Die Two You got a 2!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 27: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s %sO%s | | %sO%s |\n"
" | %sO%s | | %sO%s |\n"
" | %sO%s %sO%s | | %sO%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 5! ^XOn Die Two You got a 3!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 28: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s %sO%s | | %sO%s %sO%s |\n"
" | %sO%s | | |\n"
" | %sO%s %sO%s | | %sO%s %sO%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 5! ^XOn Die Two You got a 4!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 29: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s %sO%s | | %sO%s %sO%s |\n"
" | %sO%s | | %sO%s |\n"
" | %sO%s %sO%s | | %sO%s %sO%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 5! ^XOn Die Two You got a 5!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 30: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s %sO%s | | %sO%s %sO%s |\n"
" | %sO%s | | %sO%s %sO%s |\n"
" | %sO%s %sO%s | | %sO%s %sO%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 5! ^XOn Die Two You got a 6!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 31: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s %sO%s | | |\n"
" | %sO%s %sO%s | | %sO%s |\n"
" | %sO%s %sO%s | | |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 6! ^XOn Die Two You got a 1!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 32: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s %sO%s | | %sO%s |\n"
" | %sO%s %sO%s | | |\n"
" | %sO%s %sO%s | | %sO%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 6! ^XOn Die Two You got a 2!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 33: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s %sO%s | | %sO%s |\n"
" | %sO%s %sO%s | | %sO%s |\n"
" | %sO%s %sO%s | | %sO%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 6! ^XOn Die Two You got a 3!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 34: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s %sO%s | | %sO%s %sO%s |\n"
" | %sO%s %sO%s | | |\n"
" | %sO%s %sO%s | | %sO%s %sO%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 6! ^XOn Die Two You got a 4!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 35: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s %sO%s | | %sO%s %sO%s |\n"
" | %sO%s %sO%s | | %sO%s |\n"
" | %sO%s %sO%s | | %sO%s %sO%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 6! ^XOn Die Two You got a 5!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
case 36: TELLPLAYER(p, " %s _________ _________\n"
" | | | |\n"
" | %sO%s %sO%s | | %sO%s %sO%s |\n"
" | %sO%s %sO%s | | %sO%s %sO%s |\n"
" | %sO%s %sO%s | | %sO%s %sO%s |\n"
" |_________| |_________|\n\n"
" ^XOn Die One You got a 6! ^XOn Die Two You got a 6!^A\n", dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc, hc, dc);
break;
}
if ( diceFaces == 36 ) /* I guess we gotta let them win
something ;) */
{
p->pennies += jpot;
TELLPLAYER(p, " Double Sixes, You just won the JackPot of %d %s\a\n", jpot,
get_config_msg("cash_name"));
LOGF("wdice", "%s ^Ygets ^RDouble ^Ysixes^R and ^Ywins ^R%d ^Y%s^N", p->name, jpot,
get_config_msg("cash_name"));
jpot = (jpot - jpot);
}
else if ( diceFaces == 32 )
{
p->pennies += 300;
TELLPLAYER(p, "\t\t Not bad, You got 300 %s\n", get_config_msg("cash_name"));
jpot = (jpot - 300);
LOGF("wdice", "%s gets a 6 on the first die", p->name);
}
else if ( diceFaces == 33 )
{
p->pennies += 300;
TELLPLAYER(p, "\t\t Not bad, You got 300 %s\n", get_config_msg("cash_name"));
jpot = (jpot - 300);
LOGF("wdice", "%s gets a 6 on the first die", p->name);
}
else if ( diceFaces == 34 )
{
p->pennies += 300;
TELLPLAYER(p, "\t\t Not bad, You got 300 %s\n", get_config_msg("cash_name"));
jpot = (jpot - 300);
LOGF("wdice", "%s gets a 6 on the first die", p->name);
}
else if ( diceFaces == 35 )
{
p->pennies -= 300;
if (p->pennies < 0) p->pennies = 0;
TELLPLAYER(p, "\t\t You just lost 300 %s\n", get_config_msg("cash_name"));
jpot = (jpot + 300);
LOGF("ldice", "%s gets a 6 and a 4 and loses 300 %s", p->name,
get_config_msg("cash_name"));
}
else if ( diceFaces == 31 ) /* 7 is an awesome number */
{
p->pennies += 900;
TELLPLAYER(p, "\t Awesome, that adds up to 7 You get 900 %s\n",
get_config_msg("cash_name"));
jpot = (jpot - 900);
LOGF("wdice", "%s ^Hgets a ^P6^H and a ^Y1^N", p->name);
}
else if ( diceFaces == 8 )
{
p->pennies += 500;
TELLPLAYER(p, "\t\tDouble Twos, thats another 500 %s\n", get_config_msg("cash_name"));
jpot = (jpot - 500);
LOGF("wdice", "%s gets doubles", p->name);
}
else if ( diceFaces == 15 )
{
p->pennies += 300;
TELLPLAYER(p, "\t\tDouble Threes, thats another 300 %s\n",
get_config_msg("cash_name"));
jpot = (jpot - 300);
LOGF("wdice", "%s gets doubles", p->name);
}
else if ( diceFaces == 22 )
{
p->pennies += 300;
TELLPLAYER(p, "\t\tDouble Fours, thats another 300 %s\n", get_config_msg("cash_name"));
jpot = (jpot - 300);
LOGF("wdice", "%s gets doubles", p->name);
}
else if ( diceFaces == 29 ) /* What, you expect them to win
on all doubles? */
{
p->pennies -= 300;
if (p->pennies < 0) p->pennies = 0;
TELLPLAYER(p, "\t You just lost 300 %s for getting double fives\n",
get_config_msg("cash_name"));
jpot = (jpot + 300);
LOGF("ldice", "%s just lost 300 %s", p->name, get_config_msg("cash_name"));
}
else if ( diceFaces == 1 ) /* Hey, gotta lose
sometime }:) */
{
p->pennies -= 1000;
if (p->pennies < 0) p->pennies = 0;
TELLPLAYER(p, "\t Ohh Man, Snake eyes, You just lost 1000 %s\a\n",
get_config_msg("cash_name"));
jpot = (jpot + 1000);
LOGF("ldice", "%s ^Ygets ^PSnake Eyes^N", p->name);
}
else /* Can't win everytime */
{
TELLPLAYER(p, "\t\tOhh well, better luck next on the next roll\n");
}
if (jpot > 0)
{
TELLPLAYER(p, "\t\t The Jackpot is now worth %d\n", jpot);
}
else if (jpot <= 0)
{
TELLPLAYER(p, "\t The Jackpot is now empty, and is being reset to %d\n",
atoi(get_config_msg("dice_pot")));
}
TELLPLAYER(p, "%s", LINE);
}
}
}
void dice_version(void)
{
stack += sprintf(stack, "^Y -=*> You are using ^BD^N^Hi^RC^N^HE^N ^Rv6^Y. (by ^gOleAndEr^Y)^N\n");
}