Re: Currencies

From: Ron Hensley (ron@CROSS.DMV.COM)
Date: 11/28/97


On Fri, 28 Nov 1997, Will Shaw wrote:

> I am looking to implement a gold/copper/silver system of currency on my
> mud, rather than having one gold coinage.  I'm not asking for code,
> specifically, but does anyone have ideas as to where to get started with
> this?  I've been poking around but I'm not exactly sure where to start.
> Thanks in advance for any ideas.
>

Did this myself, as well as remove banks as we didnt find banks to be in
theme. Basically, we didnt really change anything. Everywhere in the game
that money is used, I.E. shops, renting, and banking, we simply added
code to display the players GET_GOLD(ch) as 3 strings instead of one string.

In our system:
  1 gold = 20 silvers = 2000 coppers

for instance in shop.c

char *buy_prices(struct obj_data * obj, int shop_nr) {
  int c,s,g;
  static char buf[256];

/* Find out how many gold, silver, and coppers the amount is worth */
  g = ((int) (GET_OBJ_COST(obj) * SHOP_BUYPROFIT(shop_nr))) / 2000;
  s = ((int) (GET_OBJ_COST(obj) * SHOP_BUYPROFIT(shop_nr))) % 2000 / 100;
  c = ((int) (GET_OBJ_COST(obj) * SHOP_BUYPROFIT(shop_nr))) % 2000 % 100;

  buf[0] = '\0';

  if (g)
    sprintf(buf,"%4d Lauren%s", g, (g > 1) ? "s" : "");
  if (s)
    sprintf(buf,"%s%s%3d Celeb%s", buf, (g) ? " " : "", s, (s > 1) ? "s"  : "");
  if (c)
    sprintf(buf,"%s%s%3d Busc%s", buf, (g | s) ? " " : "", c, (c > 1) ?  "s" : "$

  return (buf);
}

We use this function where shops list object prices.
So basically we do the division to get the coinage everywhere money is shown.

Buying is automated, that is player does not specify how much to give,
only what to buy, so its only an iformational message after saying gow  much.

ATM cards and banking require adding code to parse the arguments:
  deposit 1 gold   /* means 1 * 2000 coppers */
  deposit 1 silver /* Means 1 * 100 coppers */

We store the players money as coppers by the way.

    *******************************************************************
    *   Ron Hensley                     ron@dmv.com                   *
    *   Network Administrator           http://www.dmv.com/~ron       *
    *                                   PGP Key at WWW Page           *
    *   DelMarVa OnLine                 749-7898 Ext. 403             *
    *******************************************************************


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST