/
roa/
roa/lib/boards/
roa/lib/config/
roa/lib/edits/
roa/lib/help/
roa/lib/misc/
roa/lib/plrobjs/
roa/lib/quests/
roa/lib/socials/
roa/lib/www/
roa/lib/www/LEDSign/
roa/lib/www/LEDSign/fonts/
roa/lib/www/LEDSign/scripts/
roa/src/s_inc/
roa/src/sclient/
roa/src/sclient/binary/
roa/src/sclient/text/
roa/src/util/
/************************************************************************
	Realms of Aurealis 		James Rhone aka Vall of RoA

objact.c				Flag driven object spec procs...
					Note: Many (almost all) of these
					procs are flag driven, meaning a
					builder can assign certain flags 
					to objects on the fly in RoAOLC.

		******** Heavily modified and expanded ********
		******** 100% Completely Original Code ********
		*** BE AWARE OF ALL RIGHTS AND RESERVATIONS ***
		******** Heavily modified and expanded ********
		******** 100% Completely Original Code ********
		        All rights reserved henceforth. 

    Please note that no guarantees are associated with any code from
Realms of Aurealis.  All code which has been released to the general
public has been done so with an 'as is' pretense.  RoA is based on both
Diku and CircleMUD and ALL licenses from both *MUST* be adhered to as well
as the RoA license.   *** Read, Learn, Understand, Improve ***
*************************************************************************/
#include "conf.h"
#include "sysdep.h"

#include "structures.h"
#include "utils.h"
#include "comm.h"
#include "interpreter.h"
#include "acmd.h"
#include "handler.h"
#include "db.h"
#include "mudlimits.h"
#include "lists.h"
#include "global.h"

/* scan room for a bank object, if is, do the deed   RoA jtrhone */
/* note, not hard wired anymore */
// use runtime currency names  11/28/97 -jtrhone
ACMD(do_bank)
{
  int amount;
  obdata *ob;
  BOOL found = FALSE;

  if (IN_NOWHERE(ch)) return;

  for (ob = world[ch->in_room].contents; ob; ob = ob->next_content)
    if (OBJ_FLAGGED2(ob, ITEM_BANK))
    {
      found = TRUE;
      break;
    }

  if (!found)
  {
    send_to_char("You cannot do that here.\n\r",ch);
    return;
  }

  one_argument(argument, arg);

  switch (subcmd) {

  case SCMD_BALANCE:
    if (GET_BANK_GOLD(ch) > 0)
      sprintf(buf, "Your current balance is %d %s.\n\r",GET_BANK_GOLD(ch), currency_name_plural);
    else
      sprintf(buf, "You currently have nothing deposited.\n\r");
    S2C();
    break;

  case SCMD_WITHDRAW:
      if ((amount = atoi(arg)) <= 0)
	 send_to_char("How much do you want to withdraw?\n\r", ch);
      else
      if (GET_BANK_GOLD(ch) < amount)
	 send_to_char("You don't have that much deposited!\n\r", ch);
      else
      {
        GET_GOLD(ch) += amount;
        GET_BANK_GOLD(ch) -= amount;
        sprintf(buf, "You withdraw %d %s.\n\r", amount, currency_name_plural);
	S2C();
  
        sprintf(buf, "$n withdraws some %s from $p.", currency_name_plural);
        act(buf, TRUE, ch, ob, FALSE, TO_ROOM);
      }
    break;

  case SCMD_DEPOSIT:
      if ((amount = atoi(arg)) <= 0) 
	 send_to_char("How much do you want to deposit?\n\r", ch);
      else
      if (GET_GOLD(ch) < amount)
	 send_to_char("You don't have that much!\n\r", ch);
      else
      {
        GET_GOLD(ch) -= amount;
        GET_BANK_GOLD(ch) += amount;
        sprintf(buf, "You deposit %d %s.\n\r", amount, currency_name_plural);
	S2C();

        sprintf(buf, "$n deposits some %s in $p.", currency_name_plural);
        act(buf, TRUE, ch, ob, FALSE, TO_ROOM);
      }
    break;
  }
}