Ok... Well... i was bored.. So I would contribute to the rom community somewhat by fixing up your code and making it a little nicer, neater, and easier to expand :). Oh yeah.. i havn't tested this.. should work though.. sat down and spent just a couple minutes fixing it up :). -Kharas ------------------------------------------------------------------------------- /*************************************************************************** * This snippet was written by Donut for the Khrooon Mud. * * Original Coded by Yago Diaz * * (C) June 1997 * * (C) Last Modification October 1997 * * Major enhancement/neatening done by * * Kharas (root@fading.tcimet.net) * * (eg: Made sum_dat table, shortened function, etc) * ***************************************************************************/ /*************************************************************************** * Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer, * * Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe. * * * * Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael * * Chastain, Michael Quan, and Mitchell Tse. * * * * In order to use any part of this Merc Diku Mud, you must comply with * * both the original Diku license in 'license.doc' as well the Merc * * license in 'license.txt'. In particular, you may not remove either of * * these copyright notices. * * * * Much time and thought has gone into this software and you are * * benefitting. We hope that you share your changes too. What goes * * around, comes around. * **************************************************************************/ /*************************************************************************** * ROM 2.4 is copyright 1993-1996 Russ Taylor * * ROM has been brought to you by the ROM consortium * * Russ Taylor (rtaylor@efn.org) * * Gabrielle Taylor * * Brian Moore (zump@rom.org) * * By using this code, you have agreed to follow the terms of the * * ROM license, in the file Rom24/doc/rom.license * ***************************************************************************/ #include #include #include #include #include #include "merc.h" #define MONEY "Platinum" /* Put what you want the money called here */ struct summoner_data { char *name; int cost; /* If using Rom2.4.. this cost is the silver needed */ int vnum; } sum_dat = { /* Name */ /* Cost */ /* Vnum */ {"Ofcol", 50, 601 }, {"New Thalos", 75, 9506 }, {"Sesame Street", 100, 24000 }, {"Hell", 100, 10416 }, {"Divided Souls", 75, 27000 }, {"Drakyri Isle", 100, 11700 }, {NULL,0,0 } /* End of list - must always end with this! - Kharas */ }; DECLARE_DO_FUN( do_look ); CHAR_DATA * find_summoner args( ( CHAR_DATA *ch ) ); CHAR_DATA *find_summoner ( CHAR_DATA *ch ) { CHAR_DATA * summoner; for ( summoner = ch->in_room->people; summoner != NULL; summoner = summoner->next_in_room ) { if (!IS_NPC(summoner)) continue; if (summoner->spec_fun == spec_lookup( "spec_summoner" )) return summoner; } if (summoner == NULL || summoner->spec_fun != spec_lookup( "spec_summoner" )) { send_to_char("You can't do that here.\n\r",ch); return NULL; } if ( summoner->fighting != NULL) { send_to_char("Wait until the fighting stops.\n\r",ch); return NULL; } return NULL; } void do_travel(CHAR_DATA *ch, char *argument) { CHAR_DATA *summoner,*pet; ROOM_INDEX_DATA *room; int i; char buf[MAX_STRING_LENGTH], arg[MAX_STRING_LENGTH]; char arg1[MAX_STRING_LENGTH]; argument = one_argument(argument, arg ); argument = one_argument(argument, arg1); summoner = find_summoner (ch); if (!summoner) return; if (arg[0] == '\0') { sprintf(buf, "You must tell me what travel you want to do:\n\r" "\tTRAVEL list - shows possible locations to travel to.\n\r" "\tTRAVEL buy - Travel to selected location.\n\r"); act("$N says '$t'.", ch, buf, summoner, TO_CHAR); return; } if (!strcmp( arg, "list")) { sprintf(buf, "%s says you may travel to the following locations:\n\r", PERS(ch,summoner)); send_to_char(buf,ch); for(i=0;sum_dat[i].name != NULL;i++) { sprintf(buf,"\t%-15s - %-3d %s\n\r", sum_dat[i].name,sum_dat[i].cost, MONEY); send_to_char(buf,ch); } return; } if (!strcmp( arg, "buy")) { if (arg1[0] == '\0') { sprintf(buf, "You must tell me where you wish to travel"); act("$N says '$t'.", ch, buf, summoner, TO_CHAR); return; } for(i=0;sum_dat[i].name != NULL;i++) if(is_name(arg1,sum_dat[i].name)) break; if(sum_dat[i].name == NULL) { sprintf(buf, "That location of travel is not on the list"); act("$N says '$t'.", ch, buf, summoner, TO_CHAR); return; } /* Use this if check instead if you are using rom2.4 if ( (ch->silver + 100 * ch->gold) < sum_dat[i].cost ) */ if( ch->platinum < sum_dat[i].cost) { sprintf(buf, "You don't have enough %s for my services",MONEY); act("$N says '$t'.", ch, buf, summoner, TO_CHAR); return; } if( (room = get_room_index(sum_dat[i].vnum) == NULL) { send_to_char("That location's room doesn't seem to exist," "please inform your Imp.\n\r",ch); return; } if ( (pet = ch->pet) != NULL && pet->in_room == ch->in_room) { char_from_room( pet ); char_to_room( pet, get_room_index(sum_dat[i].vnum) ); } char_from_room( ch ); char_to_room( ch, get_room_index(sum_dat[i].vnum) ); /* Uncomment the following lines if you are using Rom2.4 and comment out the lines dealing with platinum. deduct_cost(ch,sum_dat[i].cost); */ ch->platinum -= sum_dat[i].cost; summoner->platinum += sum_dat[i].cost; sprintf(buf, "%s utters the words 'hasidsindsad'\n\rYou are surrounded by a violet fog.\n\r", summoner->short_descr); send_to_char(buf, ch); do_look (ch, ""); return; } } else do_travel(ch,""); }