Author Information.
Name, Country : Rainer Roomet, Estonia.
Email/MSN     : rainer_roomet@hotmail.com
Url           : http://www.zone.ee/gain/
Telnet        : telnet://irc.nohik.ee 4242
MUD name      : The Lost Lands of Arion 
		J.R.R. Tolkien Theme PK and RP MUD.
		(http://www.zone.ee/gain/Changelog


Snippet Information.
--------------------
   This snippet converts silver and coppers into gold pennies,
   if nessecary. 20 copper = 1 silver, 20 silver = 1 gold and 400
   coppers = 1 gold. If you have 19 coppers and you type worth
   then you see: You have 19 copper pennies. If you get 2 coppers
   more and now you have 21 copper, then this snippet converts
   21 coppers to 1 silver and 1 copper. Same as buying, selling
   etc. Good for MUDs what love RP.

Credits.
--------

    I don't need any credit. Maybe if you find some bug or type
    or you have some idea, you may email or msn to me at
    rainer_roomet@hotmail.com.

   
Installing.
-----------
    First BACKUP your code! 

First type "grep 'ch->silver' *.[c,h]" 
Also you have to check 'victim->silver', keeper->silver etc.

And delete all ch->silver functions or replace them ch->gold.

then   

OPEN the file 'handler.c'
and add the following at the end of the file:

char *format_coins(int amount)
{

   static char buf[MAX_STRING_LENGTH];
 
   int copper = amount;
   int silver = amount/20;
   int gold = amount/400;

  /*
   * definitions of currency
   * 20 copper		== 1 silver;
   * 20 silver 		== 1 gold;
   * 4,00 copper 	== 1 gold;
   */

   if (amount < 20)
   {
     sprintf(buf, "%d copper penn%s",
     amount, amount > 1 ? "ies" : "y");
     return buf;
   }
   else if (amount >= 20 && amount < 400
	&& (amount - silver * 20) == 0)
   {
     sprintf(buf, "%d silver penn%s",
        silver, 
	silver > 1 ? "ies" : "y" );
     return buf;
   }
   else if (amount >= 20 && amount < 400)
   {
     sprintf(buf, "%d silver and %d copper penn%s",
     amount/20, copper - silver * 20, copper > 1 ? "ies" : "y" );
     return buf;
   }
   else if (amount >= 400
        && (amount/20 - gold * 20) == 0
        && (amount - silver *  20) == 0)
   {
     sprintf(buf, "%d gold penn%s", gold, gold > 1 ? "ies" : "y");
     return buf;
   }
   else if (amount > 400 && (amount/20 - gold * 20) == 0) 
   {
     sprintf(buf, "%d gold and %d copper penn%s",
     gold, copper - gold * 400,
     copper - gold * 400 > 1 ? "ies" : "y");
     return buf;
   }
   else if (amount > 400 && (amount - silver * 20 ) == 0)
   {
     sprintf(buf, "%d gold and %d silver penn%s",
     gold, (amount - gold * 400) / 20,
     (amount - gold * 400) / 20 > 1 ? "ies" : "y");
     return buf;
   }
   else if (amount > 400 && (amount - silver * 20 ) != 0 
   && (amount/20 - gold * 20) != 0)
   {
     sprintf(buf, "%d gold, %d silver and %d copper penn%s",
     gold, 
     (amount - gold * 400) / 20, 
     copper - silver * 20,
     copper - silver * 20 > 1 ? "ies" : "y");
     return buf;
   }
  return buf;
}


NOW TYPE:
grep 'ch->victim' *.[c,h]
and PUT
format_coins(ch->victim)


Thank you for using my snippet.
Rainer Roomet.
Email/MSN: rainer_roomet@hotmail.com