/************************************************************************************ * Convert * * * * Function - converts Silver into Gold coins * * * * Usage: a command (you type in CONVERT by itself whenever you want to) * * * * You can make things even easier by putting a call in update.c somewhere, or * * you can make it harder by making it only work in certain rooms. * * This makes life a LOT easier for players. * * * * Works perfectly for Rom 2.4b. May work on other code bases. * * * * Written by Ichike from World of Naruto on 15th May 2008. *\ * Minor bugfix 12th January 2009 * * * Come visit us at http://narutomud.mudmagic.com/ * * or telnet://narutomud.mudmagic.com:9000 * * * * E-mail me if you have problems with this, or would like to say * * thanks, offer coin, etc: * * therealadrian@hotmail.com * * * ***********************************************************************************/ /* Add to interp.c */ {"convert", do_convert, POS_STANDING, 0, LOG_NORMAL, 1}, /* Add to interp.h */ DECLARE_DO_FUN( do_convert ); /* Add this to any relevant .c file - I added it to a file I created called naruto.c but this could be added to fight.c if you want to */ void do_convert (CHAR_DATA * ch, char * argument) { /* command to convert Ryo/ryo into more manageable amounts */ char buf[MAX_STRING_LENGTH]; if (ch->silver < 100) { sprintf (buf, "You do not need to convert - you only have %ld silver\n\r", ch->silver); send_to_char (buf, ch); return; } long worth = (ch->gold * 100) + ch->silver; long newgold = 0; long newsilver = 0; newsilver = worth; send_to_char ("You have over 100 mon - converting excess silver to Gold...\n\r", ch); sprintf (buf, "You currently have %ld Gold and %ld silver - total worth %ld\n\r", ch->gold, ch->silver, worth); send_to_char (buf, ch); while (newsilver > 99) { newsilver -= 100; newgold += 1; } ch->gold = newgold; ch->silver = newsilver; sprintf (buf, "You now have %ld Gold and %ld silver - total worth %ld\n\r", ch->gold, ch->silver, worth); send_to_char (buf, ch); return; } /* This is the helpfile to add to help.are in your area directory */ 0 CONVERT~ Usage: CONVERT Converts Silver/Gold into more manageable amounts e.g. If you have 30 Gold and 4515 Silver it will convert it to 75 Gold and 15 Silver ~