#include <sys/types.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "emlen.h"
void
do_convert (CHAR_DATA * ch, char *argy)
{
CHAR_DATA *mob;
int monnn;
char buf[STD_LENGTH];
DEFINE_COMMAND ("convert", do_convert, POSITION_RESTING, 0, LOG_NORMAL, "This command allows you to convert copper into gold at a bank.")
check_room_more (ch->in_room);
for (mob = ch->in_room->more->people; mob != NULL; mob = mob->next_in_room)
{
if (IS_MOB (mob) && IS_SET (mob->act, ACT_BANK_TELLER))
break;
}
if (mob == NULL)
{
send_to_char ("You say 'Excuse me, can I convert my currency?'\n\r", ch);
send_to_char ("Unfortunately, there is no banker in sight.\n\r", ch);
return;
}
monnn = tally_coins (ch);
if (monnn <= 0)
return;
sub_coins (monnn, ch);
sprintf (buf, "%d", monnn);
create_amount (monnn, ch, NULL, NULL);
/*do_coins(ch,buf); */
send_to_char ("Your money has now been converted.\n\r", ch);
return;
}
void
do_balance (CHAR_DATA * ch, char *argy)
{
CHAR_DATA *mob;
char buf[STD_LENGTH];
DEFINE_COMMAND ("balance", do_balance, POSITION_RESTING, 0, LOG_NORMAL, "This command allows you to see your bank balance when you are at a bank.")
check_room_more (ch->in_room);
for (mob = ch->in_room->more->people; mob != NULL; mob = mob->next_in_room)
{
if (IS_MOB (mob) && IS_SET (mob->act, ACT_BANK_TELLER))
break;
}
if (mob == NULL)
{
send_to_char ("You say 'Excuse me, what's my balance?'\n\r", ch);
send_to_char ("Unfortunately, there is no banker in sight.\n\r", ch);
return;
}
sprintf (buf, "The banker tells you 'You have %ld coins in your account.'\n\r", ch->pcdata->bank);
send_to_char (buf, ch);
return;
}
void
do_store (CHAR_DATA * ch, char *argy)
{
CHAR_DATA *mob;
char buf[STD_LENGTH];
SINGLE_OBJECT *obj;
char arg1[STD_LENGTH];
bool found;
int k;
DEFINE_COMMAND ("store", do_store, POSITION_RESTING, 0, LOG_NORMAL, "This command allows you to store an object in the bank vaults.")
if (IS_MOB (ch))
return;
found = FALSE;
if (argy == "" || argy[0] == '\0')
{
/*list all stored objects */
send_to_char ("\x1B[30;1m[\x1B[34mItems on storage in the bank vault\x1B[30m]\x1B[37;0m\n\r\n\r", ch);
for (k = 0; k < MAXST; k++)
{
if (ch->pcdata->storage[k] != NULL)
{
found = TRUE;
sprintf (buf, "\x1B[37;1m%-2d> \x1B[0m%-30s \x1B[30;1m[\x1B[34m%d coins get back\x1B[30m]\x1B[37;0m\n\r", k + 1, strip_ansi_codes (OOSTR (ch->pcdata->storage[k], short_descr)), ch->pcdata->storage[k]->cost / STOREDIV);
send_to_char (buf, ch);
}
}
if (found)
{
send_to_char ("\n\rTo get back a stored object, go to the bank and type UNSTORE #\n\r", ch);
send_to_char ("To store an item, go to the bank and type STORE <item>\n\r", ch);
}
else
{
send_to_char ("Nothing.\n\r", ch);
}
return;
}
/*End no arg */
argy = one_argy (argy, arg1);
if (arg1[0] == '\0')
return;
if (IS_MOB (ch))
return;
check_room_more (ch->in_room);
for (mob = ch->in_room->more->people; mob != NULL; mob = mob->next_in_room)
{
if (IS_MOB (mob) && IS_SET (mob->act, ACT_BANK_TELLER))
break;
}
if (mob == NULL)
{
send_to_char ("You can only store items at a bank.\n\r", ch);
return;
}
if ((obj = get_obj_inv (ch, arg1)) == NULL)
{
send_to_char ("You don't have that object.\n\r", ch);
return;
}
if (IS_SET (obj->extra_flags, ITEM_NOSTORE))
{
send_to_char ("Storage of this item is forbidden.\n\r", ch);
return;
}
if (obj->wear_loc != WEAR_NONE)
{
send_to_char ("You must remove that object first.\n\r", ch);
return;
}
if (obj->in_obj != NULL || obj->contains != NULL)
{
send_to_char ("Get the object into your normal inventory first.\n\r", ch);
send_to_char ("IE: remove from backpack or sack, etc...\n\r", ch);
return;
}
if (obj->cost < 5)
{
send_to_char ("We will not store that item for you.\n\r", ch);
return;
}
/*for (k=0;k<MAXST;k++)
{
if (ch->pcdata->storage[k]->pIndexData->vnum==obj->pIndexData->vnum)
{
send_to_char("We will not store more than one of any specific object.\n\r",ch);
return;
}
}
*/
sprintf (buf, "The banker will store that item for %s.\n\r(Payable upon removal of item.)\n\r", name_amount (obj->cost / STOREDIV));
send_to_char (buf, ch);
if (argy == "" || argy[0] == '\0' || str_cmp (argy, "yes"))
{
send_to_char ("Type store <item> YES to actually put this item in storage.\n\r", ch);
return;
}
k = free_storage (ch);
if (k == -1)
{
send_to_char ("Sorry, we will not store any more items for you.\n\r", ch);
return;
}
obj_from (obj);
ch->pcdata->storage[k] = obj;
send_to_char ("Your object is now safe in the vaults of the bank!\n\r", ch);
save_char_obj (ch);
return;
}
void
do_unstore (CHAR_DATA * ch, char *argy)
{
CHAR_DATA *mob;
char buf[STD_LENGTH];
SINGLE_OBJECT *obj;
char arg1[STD_LENGTH];
int itemnum;
int k;
bool found;
int remove_cost;
DEFINE_COMMAND ("unstore", do_unstore, POSITION_RESTING, 0, LOG_NORMAL, "This command allows you to unstore an object from the bank vaults.")
if (IS_MOB (ch))
return;
found = FALSE;
if (argy == "" || argy[0] == '\0')
{
/*list all stored objects */
send_to_char ("\x1B[30;1m[\x1B[34mItems on storage in the bank vault\x1B[30m]\x1B[37;0m\n\r\n\r", ch);
for (k = 0; k < MAXST; k++)
{
if (ch->pcdata->storage[k] != NULL)
{
found = TRUE;
sprintf (buf, "\x1B[37;1m%-2d> \x1B[0m%-30s \x1B[30;1m[\x1B[34m%d coins get back\x1B[30m]\x1B[37;0m\n\r", k + 1, strip_ansi_codes (OOSTR (ch->pcdata->storage[k], short_descr)), ch->pcdata->storage[k]->cost / STOREDIV);
send_to_char (buf, ch);
}
}
if (found)
{
send_to_char ("\n\rTo get back a stored object, go to the bank and type UNSTORE #\n\r", ch);
send_to_char ("To store an item, go to the bank and type STORE <item>\n\r", ch);
}
else
{
send_to_char ("Nothing.\n\r", ch);
}
return;
}
/*End no arg */
argy = one_argy (argy, arg1);
check_room_more (ch->in_room);
for (mob = ch->in_room->more->people; mob != NULL; mob = mob->next_in_room)
{
if (IS_MOB (mob) && IS_SET (mob->act, ACT_BANK_TELLER))
break;
}
if (mob == NULL)
{
send_to_char ("You can only get store items back at a bank.\n\r", ch);
return;
}
if (arg1[0] != '\0' && is_number (arg1))
{
/*Start numeric withdrawl */
itemnum = atoi (arg1);
if (itemnum > 30 || itemnum < 1)
return;
itemnum--;
if (ch->pcdata->storage[itemnum] == NULL)
{
send_to_char ("I could not find that number on storage.\n\r", ch);
return;
}
obj = ch->pcdata->storage[itemnum];
k = itemnum;
}
else
/*end numeric withdrawl */
{
/*start named withdrawl */
arg1[0] = UPPER (arg1[0]);
obj = NULL;
for (k = 0; k < MAXST; k++)
{
if (ch->pcdata->storage[k] != NULL && is_name (arg1, ch->pcdata->storage[k]->pIndexData->name))
{
obj = ch->pcdata->storage[k];
break;
}
}
if (obj == NULL)
{
send_to_char ("I couldn't find that in storage.\n\r", ch);
return;
}
}
/*End named withdrawl */
if (obj == NULL)
{
send_to_char ("I couldn't find that in storage.\n\r", ch);
return;
}
remove_cost = obj->cost / STOREDIV;
sprintf (buf, "The banker will give you the item back for %s.\n\r", name_amount (remove_cost));
send_to_char (buf, ch);
if (argy == "" || argy[0] == '\0' || str_cmp (argy, "yes"))
{
send_to_char ("Type unstore <item> YES to actually get the item back from storage.\n\r", ch);
return;
}
if (tally_coins (ch) < remove_cost && ch->pcdata->bank < remove_cost)
{
send_to_char ("Sorry, you do not have enough money to get the item back.\n\r", ch);
return;
}
if (tally_coins (ch) >= remove_cost)
{
sub_coins (remove_cost, ch);
}
else
ch->pcdata->bank -= remove_cost;
obj_to (obj, ch);
ch->pcdata->storage[k] = NULL;
send_to_char ("Item withdrawn from the bank vaults.\n\r", ch);
save_char_obj (ch);
return;
}
int
find_clan_in (CHAR_DATA * ch)
{
CLAN_DATA *cdat;
int retval;
retval = -1;
for (cdat = get_clan_index (1); cdat != NULL; cdat = get_clan_index (cdat->vnum + 1))
{
if (ch->in_room->vnum >= cdat->start_vnum + 1 && ch->in_room->vnum <= cdat->start_vnum + 20)
retval = cdat->vnum;
}
return retval;
}
void
do_clanstore (CHAR_DATA * ch, char *argy)
{
char buf[STD_LENGTH];
SINGLE_OBJECT *obj;
char arg1[STD_LENGTH];
CLAN_DATA *clan;
int cnum;
bool found;
int k;
DEFINE_COMMAND ("clanstore", do_clanstore, POSITION_RESTING, 0, LOG_NORMAL, "Allows a character to put an object into clan storage.")
if (IS_MOB (ch))
return;
cnum = find_clan_in (ch);
found = FALSE;
if (cnum < 1)
{
send_to_char ("You are not in the clan storage location...\n\r", ch);
return;
}
if (!IS_PLAYER (ch))
return;
if ((clan = get_clan_index (cnum)) == NULL)
return;
if (argy == "" || argy[0] == '\0')
{
/*list all stored objects */
send_to_char ("\x1B[30;1m[\x1B[34mItems on storage in the clan vault\x1B[30m]\x1B[37;0m\n\r\n\r", ch);
for (k = 0; k < MAX_CLAN_STORAGE; k++)
{
if (clan->storage[k] != NULL)
{
found = TRUE;
sprintf (buf, "\x1B[36;1m%-2d> \x1B[37m%-30s \x1B[34m[Clan Vault - Free]\x1B[37;0m\n\r", k + 1, strip_ansi_codes (OOSTR (clan->storage[k], short_descr)));
send_to_char (buf, ch);
}
}
if (found)
{
send_to_char ("\n\rTo get an object from clan vaults, use CUNSTORE #\n\r", ch);
send_to_char ("To store a clan item, go to the clan donation and type CSTORE <item>\n\r", ch);
}
else
{
send_to_char ("Nothing.\n\r", ch);
}
return;
}
/*End no arg */
if (!IS_SET (ch->in_room->room_flags, ROOM_CLANSTORE))
{
send_to_char ("You can only store clan objects in the clanhouse.\n\r", ch);
return;
}
argy = one_argy (argy, arg1);
if ((obj = get_obj_inv (ch, arg1)) == NULL)
{
send_to_char ("You don't have that object.\n\r", ch);
return;
}
if (IS_SET (obj->extra_flags, ITEM_NOSTORE))
{
send_to_char ("Storage of this item is forbidden.\n\r", ch);
return;
}
if (obj->wear_loc != WEAR_NONE)
{
send_to_char ("You must remove that object first.\n\r", ch);
return;
}
if (obj->in_obj != NULL || obj->contains != NULL)
{
send_to_char ("Get the object into your normal inventory first.\n\r", ch);
send_to_char ("IE: remove from backpack or sack, etc...\n\r", ch);
return;
}
/*if (argy=="" || argy[0]=='\0' || str_cmp(argy,"yes"))
{
send_to_char("Type cstore <item> YES to actually put this item in clan storage.\n\r",ch);
return;
}
*/
k = free_clan_storage (clan);
if (k == -1)
{
send_to_char ("Sorry, game currently limits clan storage to 30 items.\n\r", ch);
return;
}
obj_from (obj);
clan->storage[k] = obj;
send_to_char ("Your object is now safe in the vaults of the clanhouse!\n\r", ch);
fwrite_clan_storage (cnum);
return;
}
void
do_clanunstore (CHAR_DATA * ch, char *argy)
{
char buf[STD_LENGTH];
SINGLE_OBJECT *obj;
char arg1[STD_LENGTH];
int itemnum;
int k;
bool found;
int cnum;
CLAN_DATA *clan;
DEFINE_COMMAND ("clanunstore", do_clanunstore, POSITION_RESTING, 0, LOG_NORMAL, "Allows a character to get an object from clan storage.")
if (IS_MOB (ch))
return;
cnum = find_clan_in (ch);
found = FALSE;
if (cnum < 1)
{
send_to_char ("You are not in the clan storage location...\n\r", ch);
return;
}
if ((clan = get_clan_index (cnum)) == NULL)
return;
if (argy == "" || argy[0] == '\0')
{
/*list all stored objects */
send_to_char ("\x1B[30;1m[\x1B[34mItems on storage in the clan vault\x1B[30m]\x1B[37;0m\n\r\n\r", ch);
for (k = 0; k < MAX_CLAN_STORAGE; k++)
{
if (clan->storage[k] != NULL)
{
found = TRUE;
sprintf (buf, "\x1B[36;1m%-2d> \x1B[37m%-30s \x1B[34m[Clan Vault - Free]\x1B[37;0m\n\r", k + 1, strip_ansi_codes (OOSTR (clan->storage[k], short_descr)));
send_to_char (buf, ch);
}
}
if (found)
{
send_to_char ("\n\rTo get an object from clan vaults, use CUNSTORE #\n\r", ch);
send_to_char ("To store a clan item, go to the clan donation and type CSTORE <item>\n\r", ch);
}
else
{
send_to_char ("Nothing.\n\r", ch);
}
return;
}
/*End no arg */
if (!IS_SET (ch->in_room->room_flags, ROOM_CLANSTORE))
{
send_to_char ("You can only unstore clan objects in the clanhouse.\n\r", ch);
return;
}
argy = one_argy (argy, arg1);
if (arg1[0] != '\0' && is_number (arg1))
{
/*Start numeric withdrawl */
itemnum = atoi (arg1);
if (itemnum > MAX_CLAN_STORAGE || itemnum < 1)
return;
itemnum--;
if (clan->storage[itemnum] == NULL)
{
send_to_char ("I could not find that number on storage.\n\r", ch);
return;
}
obj = clan->storage[itemnum];
k = itemnum;
}
else
/*end numeric withdrawl */
{
/*start named withdrawl */
arg1[0] = UPPER (arg1[0]);
obj = NULL;
for (k = 0; k < MAXST; k++)
{
if (clan->storage[k] != NULL && is_name (arg1, clan->storage[k]->pIndexData->name))
{
obj = clan->storage[k];
break;
}
}
if (obj == NULL)
{
send_to_char ("I couldn't find that in storage.\n\r", ch);
return;
}
}
/*End named withdrawl */
/*if (argy=="" || argy[0]=='\0' || str_cmp(argy,"yes"))
{
send_to_char("Type cunstore <item> YES to actually get the item back from storage.\n\r",ch);
return;
}
*/
if (obj == NULL)
{
send_to_char ("I couldn't find that in storage.\n\r", ch);
return;
}
obj_to (obj, ch);
clan->storage[k] = NULL;
send_to_char ("Item withdrawn from the clan vaults.\n\r", ch);
save_char_obj (ch);
fwrite_clan_storage (cnum);
return;
}
void
do_deposit (CHAR_DATA * ch, char *argy)
{
CHAR_DATA *mob;
char buf[STD_LENGTH];
int amount;
char arg1[STD_LENGTH];
DEFINE_COMMAND ("deposit", do_deposit, POSITION_RESTING, 0, LOG_NORMAL, "This allows you to deposit coins into the bank.")
argy = one_argy (argy, arg1);
if (IS_MOB (ch))
return;
check_room_more (ch->in_room);
for (mob = ch->in_room->more->people; mob != NULL; mob = mob->next_in_room)
{
if (IS_MOB (mob) && IS_SET (mob->act, ACT_BANK_TELLER))
break;
}
if (mob == NULL)
{
send_to_char ("You say 'I'd like to deposit some coins.'\n\r", ch);
send_to_char ("... If only there was a banker here.\n\r", ch);
return;
}
if (!str_cmp (arg1, "all"))
{
amount = tally_coins (ch);
if (amount < 1)
{
send_to_char ("You have no money to deposit!\n\r", ch);
return;
}
ch->pcdata->bank += amount;
sprintf (buf, "You deposit %d coins into your account.\n\r", amount);
send_to_char (buf, ch);
sprintf (buf, "Your new balance is: %ld copper.\n\r", ch->pcdata->bank);
send_to_char (buf, ch);
sub_coins (amount, ch);
return;
}
if (!is_number (arg1))
return;
amount = atoi (arg1);
if (amount < 1)
return;
if (!str_cmp (argy, "silver"))
amount *= 10;
if (!str_cmp (argy, "gold"))
amount *= 100;
if (!str_cmp (argy, "platinum"))
amount *= 1000;
if (!str_cmp (argy, "obsidian"))
amount *= 10000;
if (amount < 0 || amount > tally_coins (ch))
{
send_to_char ("You do not have that many coins.\n\r", ch);
send_to_char ("Note: Deposit all and Withdraw all works too.\n\r", ch);
return;
}
sub_coins (amount, ch);
ch->pcdata->bank += amount;
sprintf (buf, "You deposit %d coins into your account.\n\r", amount);
send_to_char (buf, ch);
sprintf (buf, "Your new balance is: %ld copper.\n\r", ch->pcdata->bank);
send_to_char (buf, ch);
return;
}
void
do_withdraw (CHAR_DATA * ch, char *argy)
{
CHAR_DATA *mob;
char buf[STD_LENGTH];
int amount, surcharge;
char arg1[STD_LENGTH];
DEFINE_COMMAND ("withdraw", do_withdraw, POSITION_RESTING, 0, LOG_NORMAL, "This command allows you to withdraw coins from your bank account.")
if (IS_MOB (ch))
return;
if ((auto_xfer && auction_tochar != NULL && ch == auction_tochar) ||
(e_auto_xfer && e_auction_tochar != NULL && ch == e_auction_tochar))
{
send_to_char ("You cannot withdraw while you are bidding in an auction!\n\r", ch);
return;
}
argy = one_argy (argy, arg1);
check_room_more (ch->in_room);
for (mob = ch->in_room->more->people; mob != NULL; mob = mob->next_in_room)
{
if (IS_MOB (mob) && IS_SET (mob->act, ACT_BANK_TELLER))
break;
}
if (mob == NULL)
{
send_to_char ("You can only do that at a bank.\n\r", ch);
return;
}
if (!str_cmp (arg1, "all"))
{
/*if (get_bet_slot(NAME(ch))!=-1)
{
send_to_char("Not while you have a bet on the arena battle going!\n\r",ch);
return;
}
*/
amount = ch->pcdata->bank;
if (amount < 5)
return;
surcharge = UMAX (1, (amount * .03));
create_amount (amount - surcharge, ch, NULL, NULL);
ch->pcdata->bank -= amount;
sprintf (buf, "You withdraw \e[1;36m%d\e[0m from your account, and the bank keeps \e[1;36m%d\e[0m as interest.\n\r", amount - surcharge, surcharge);
send_to_char (buf, ch);
sprintf (buf, "Your new balance is: \e[1;36m%ld\e[0m.\n\r", ch->pcdata->bank);
send_to_char (buf, ch);
return;
}
amount = atoi (arg1);
if (!str_cmp (argy, "silver"))
amount *= 10;
if (!str_cmp (argy, "gold"))
amount *= 100;
if (!str_cmp (argy, "platinum"))
amount *= 1000;
if (!str_cmp (argy, "obsidian"))
amount *= 10000;
if (amount <= 0)
{
send_to_char ("Please specify how much you wish to withdraw or ALL.\n\r", ch);
return;
}
if (amount < 1 || amount > ch->pcdata->bank)
{
send_to_char ("You do not have that much in your account!\n\r", ch);
send_to_char ("Withdraw ALL now works too.\n\r", ch);
return;
}
surcharge = UMAX (1, (amount * .03));
if (amount - surcharge <= 0)
{
send_to_char ("But you would get no money back with the three percent surcharge!\n\r", ch);
return;
}
create_amount (amount - surcharge, ch, NULL, NULL);
ch->pcdata->bank -= amount;
sprintf (buf, "You withdraw \e[1;36m%d\e[0m from your account, and the bank keeps \e[1;36m%d\e[0m as interest.\n\r", amount - surcharge, surcharge);
send_to_char (buf, ch);
sprintf (buf, "Your new balance is: \e[1;36m%ld\e[0m.\n\r", ch->pcdata->bank);
send_to_char (buf, ch);
return;
}
#ifdef BNEW_WORLD
void
do_blackjack (CHAR_DATA * ch, char *argy)
{
CHAR_DATA *mob;
char buf[STD_LENGTH];
int amount, pcard[6], ccard[6], ptotal = 0, ctotal = 0;
int a, N;
char arg1[STD_LENGTH];
DEFINE_COMMAND ("blackjack", do_blackjack, POSITION_RESTING, 0, LOG_NORMAL, "This allows you to deposit coins into the bank.")
argy = one_argy (argy, arg1);
if (IS_MOB (ch))
return;
check_room_more (ch->in_room);
for (mob = ch->in_room->more->people; mob != NULL; mob = mob->next_in_room)
{
if (IS_MOB (mob) && IS_SET (mob->act, ACT_BANK_TELLER))
break;
}
if (mob == NULL)
{
send_to_char ("You say 'I'd like to play blackjack.'\n\r", ch);
send_to_char ("... If only there was a banker here.\n\r", ch);
return;
}
if (!is_number (arg1))
return;
amount = atoi (arg1);
if (amount < 1 || amount > tally_coins (ch))
{
send_to_char ("You do not have that many coins.\n\r", ch);
return;
}
for (N = 0; N != 5; N++)
{
pcard[N] = number_range (1, 13);
if (pcard[N] == 11)
send_to_char ("You receive a Jack.\n\r", ch);
else if (pcard[N] == 12)
send_to_char ("You receive a Queen.\n\r", ch);
else if (pcard[N] == 13)
send_to_char ("You receive a King.\n\r", ch);
else if (pcard[N] == 1)
send_to_char ("You receive an Ace.\n\r", ch);
else
{
sprintf (buf, "You receive a %d.\n\r", pcard[N]);
send_to_char (buf, ch);
}
if (pcard[N] > 10)
pcard[N] = 10;
if (pcard[N] == 1)
pcard[N] = 11;
ptotal += pcard[N];
if (ptotal > 21)
for (a = -1; a != N; a++)
{
if (pcard[a] == 11)
{
ptotal -= 10;
pcard[a] = 1;
}
}
if (ptotal > 16)
break;
}
send_to_char ("\n\r", ch);
for (N = 0; N != 5; N++)
{
ccard[N] = number_range (1, 13);
if (ccard[N] == 11)
send_to_char ("Dealer receives a Jack.\n\r", ch);
else if (ccard[N] == 12)
send_to_char ("Dealer receives a Queen.\n\r", ch);
else if (ccard[N] == 13)
send_to_char ("Dealer receives a King.\n\r", ch);
else if (ccard[N] == 1)
send_to_char ("Dealer receives an Ace.\n\r", ch);
else
{
sprintf (buf, "Dealer receives a %d.\n\r", ccard[N]);
send_to_char (buf, ch);
}
if (ccard[N] > 10)
ccard[N] = 10;
if (ccard[N] == 1)
ccard[N] = 11;
ctotal += ccard[N];
if (ctotal > 21)
for (a = -1; a != N; a++)
{
if (ccard[a] == 11)
{
ctotal -= 10;
ccard[a] = 1;
}
}
if (ctotal > 16)
break;
}
send_to_char ("\n\r", ch);
sprintf (buf, "Your total is %d.\n\r", ptotal);
send_to_char (buf, ch);
sprintf (buf, "Computer's total is %d.\n\r", ctotal);
send_to_char (buf, ch);
if ((ptotal > ctotal) && (ptotal < 22))
{
send_to_char ("Congratulations! You won...!\n\r", ch);
ch->pcdata->bank += amount;
}
if ((ptotal == ctotal) && (ptotal < 22))
{
send_to_char ("Tie... Dealer wins.\n\r", ch);
ch->pcdata->bank -= amount;
}
if ((ptotal < ctotal) && (ctotal < 22))
{
send_to_char ("You lost...\n\r", ch);
ch->pcdata->bank -= amount;
}
if ((ptotal > 21) && (ctotal < 22))
{
send_to_char ("You lost...\n\r", ch);
ch->pcdata->bank -= amount;
}
if ((ctotal > 21) && (ptotal < 22))
{
send_to_char ("Congratulations! You won...!\n\r", ch);
ch->pcdata->bank += amount;
}
if ((ptotal > 21) && (ctotal > 21))
send_to_char ("Draw.. Both you and the dealer are over.\n\r", ch);
return;
}
#endif