/*************************************************************************** * Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer, * * Michael Seifert, Hans Henrik Strfeldt, 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-1998 Russ Taylor * * ROM has been brought to you by the ROM consortium * * Russ Taylor (rtaylor@hypercube.org) * * Gabrielle Taylor (gtaylor@hypercube.org) * * 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 * **************************************************************************/ /* QuickMUD - The Lazy Man's ROM - $Id: act_info.c,v 1.3 2000/12/01 10:48:33 ring0 Exp $ */ // //#if defined(macintosh) //#include <types.h> //#else //#include <sys/types.h> //#include <sys/time.h> //#endif //#include <cstdio> //#include <cstring> //#include <cstdlib> //#include <cctype> //#include <ctime> #include <iostream> #include <vector> using namespace std; #include "merc.h" #include "interp.h" #include "recycle.h" #include "tables.h" #include "lookup.h" #include "skill.h" /*Externs.*/ extern MENU_DATA *menu_list; int keyword_lookup( const char **, char *); extern const char *fn_evals[]; int num_eval( int, int, int); int str_eval( char *, int, char *); char *const where_name[] = { "<used as light> ", "<worn on finger> ", "<worn on finger> ", "<worn around neck> ", "<worn around neck> ", "<worn on torso> ", "<worn on head> ", "<worn on legs> ", "<worn on feet> ", "<worn on hands> ", "<worn on arms> ", "<worn as shield> ", "<worn about body> ", "<worn about waist> ", "<worn around wrist> ", "<worn around wrist> ", "<wielded> ", "<held> ", "<floating nearby> ", }; struct mud_type mud; /* for keeping track of the player count */ int max_on = 0; /* * Local functions. */ int tagline_validity (CHAR_DATA *,char *, char *, int, int); char *format_obj_to_char args ((OBJ_DATA * obj, CHAR_DATA * ch, bool fShort)); void show_list_to_char args ((OBJ_DATA * list, CHAR_DATA * ch, bool fShort, bool fShowNothing)); void show_char_to_char_0 args ((CHAR_DATA * victim, CHAR_DATA * ch)); void show_char_to_char_1 args ((CHAR_DATA * victim, CHAR_DATA * ch)); void show_char_to_char args ((CHAR_DATA * list, CHAR_DATA * ch)); bool check_blind args ((CHAR_DATA * ch)); /*Player-indifferent global announcer. No need for a ch!*/ void server_msg (char *buffer) { DESCRIPTOR_DATA *d; char buf[MSL]; sprintf(buf, "{D[Skull Server]: {c%s{x\n\r", buffer); for (d = descriptor_list; d != NULL; d = d->next) { CHAR_DATA *victim; victim = d->original ? d->original : d->character; if (d->connected == CON_PLAYING && !IS_SET (victim->comm, COMM_QUIET)&& !IS_SET (victim->comm, COMM_NOCHANNELS)) { send_to_char (buf, d->character); } } return; } //New! By someone not me. JH 1/22/2004 11:54PM //By: imapopsyckle@hotmail.com /**********[ Examples ]************** Rooms: [#weather rainy: Rain drips from overhangings and clotheslines.] [#weather lightning: Bolts of lightning periodically strike treetops.] [#weather sunny: A mysterious figure shades their face from the sun beneath a cowl.] [#cha > 14: You sense something unusual about the oakwood ahead.] [#sex female: You catch several men staring at you with interest.] [#show name: Your guild is to the north $.] [#time = 19: The sun is setting above the rooftops.] [#class thief: Wealthy shoppers are practically begging to be robbed.] [#class cleric: A crowd of cripples stare at you with desperate hope.] Mobs: [#int > 14: You notice rune tattoos on their skin.] [#class warrior: It looks like a rough match-up with this creature.] [#sex male: She doesn't look like the sweep-me-off-my-feet type.] [#weather rainy: Rain cleans the filth from this troll's hide.] [#align evil: This looks like your kind of rotten guy!] Objects: [#show name: This degree is for $ as a Graduate of Mud School.] [#str < 10: This sword appears too heavy for you to use effectively.] [#weather sunny: Sunlight gleams off of the well polished mace head.] [#name: A small tag on the side says 'Made for $'.] Tag Name Usage ----------- --------------- str [#str < 9: You're a weakling!] int [#int > 15: You're a smart cookie.] cha [#cha = 10: You're no more charismatic than normal.] dex [#dex < 9: You stumble over your own feet.] con [#con > 17: You've never been sick once.] age [#age < 21: This bar is not open to minors.] sun [#sun sunset: The sunset through the leaves is nice.] time [#time > 19: Thieves come out with the night.] day [#day = 20: Today is Ribbon Day!] month [#month = 12: It is the depths of winter.] weather [#weather rainy: Rain drips from the rooflines.] plat [#plat < 2: Merchants sneer at your poor appearance.] (not in our MUD JH) gold [#gold > 40: You draw the eye of every thief here.] silver [#silver > 9: Beggars look at you hopefully.] level [#level < 50: These creatures look too hard for you.] sex [#sex female: The bartender hurries to fill your order.] race [#race kin: kins are not welcome in the village.] align [#align evil: This place stinks of holiness.] name [#name: Your guild is to the north $.] Tag Name Arguments ------------ -------------- All Stats > < = Age > < = Sun sunrise, sunset, day, night Time > < = (Time is in hours, from 1 - 24) Day > < = (There are 35 days to a month) Month > < = (There are 17 months in a year) Weather sunny, cloudy, rainy, lightning Platinum > < = -- Not in our MUD JH Gold > < = Silver > < = Level > < = Alignment good, evil, nuetral Sex male, female, none, either Race (any race name you have) Class (any class name you have) Name (no arguments) ***********************************/ /* * Notes: * * This supports room "taglines" much like HTML tags if * you've ever played with making webpages. They look like * this: * [#weather sunny: The sun shines on a field of flowers.] * [#sex male: A pretty barmaid winks at you as she goes about.] * [#cha > 16: You notice a sale on dresses in your size.] * [#name: The mirror shows your reflection $.] * * It is important to note that the operators can't really be * combined: I was just too lazy to go through the process of * determining how they combine and affect the outcome. If you * want something like 'cha >= 15', feel free to write it in. * * To Install: * Add this line to merc.h under the " act_info.c " header: * void tagline_to_char args( ( const char *text, CHAR_DATA *ch, bool formatted ) ); * * Drop the following function into act_info.c anywhere you * like. If you want to make your own taglines, there's a * section below marked for it, the format should be simple if * you have code experience. Now anywhere that send_to_char * is used to send players a description, such as do_look in the * act_info.c file, just replace send_to_char with this function. * This: "send_to_char(ch->in_room->description, ch);" * To this: "tagline_to_char(ch->in_room->description, ch, TRUE);" * * Other things might be sending extra descs to players, or * showing players' descriptions to each other. Your choice. * Examples and arguments are listed below the code. */ void tagline_to_char(char *text, CHAR_DATA *ch, bool formatted) { if (strlen(text) <= 0) return; char output[MSL]; char tag_type[MSL]; char tag_value[MSL]; char tag_string[MSL]; char *output_ptr = output; char *formatted_str; int oper = 0; /*Used to evaluate a tagline.*/ int i = 0; /*Used to copy in a tagline string.*/ int comp_value = 0; /*What a, say, #cha is compared against*/ int copy_name = 0; /*Used to copy ch->name in place of '$'.*/ int valid_tag = FALSE; output[0] = '\0'; /*[#sex male: A pretty barmaid winks at you as she goes about.]*/ /* [#cha > 16: You notice a sale on dresses in your size.]*/ while (*text != '\0') { /*Find the [.*/ while (*text && *text != '[') *output_ptr++ = *text++; *output_ptr = '\0'; /*Sanity check.*/ if (*text == '\0') break; /*Find the #.*/ text++; if (*text != '#') { bugf("Malformed tagline code: no #; starts with '%.5s'", text); ch_printf(ch, "<Broken tagline: no #>"); return; } text++; /*Parse the 'sex'.*/ text = one_argument(text, tag_type); /*Now we have a conditional to evaluate. If it's 'sex male:', we won't need to use an operand. If it's 'int > 15:', we'll have to grab another tag_value.*/ text = one_argument(text, tag_value); /*Now, see if it is an operand (>=) or a word (male).*/ if (!isalpha(tag_value[0])) { /*An operand.*/ if ((oper = keyword_lookup(fn_evals, tag_value)) < 0 ) { bugf("Malformed tagline code: invalid operand; starts with '%.5s'", text); ch_printf(ch, "<Broken tagline: invalid operand>"); return; } /*Grab the comparison--i.e. 'cha < 10', the '10'.*/ text = one_argument(text, tag_value); /*Make sure there's a semicolon to smash.*/ if (tag_value[0] == '\0' || tag_value[strlen(tag_value)-1] != ':') { bugf("Malformed tagline code: no :; starts with '%.5s'", text); ch_printf(ch, "<Broken tagline: missing :>"); wiznet(create_string("DEBUG: Missing ':' in tagline, begins with '%.10s'", text), NULL, NULL, WIZ_DEBUG, 0, MAX_LEVEL); return; } /*Smash the semicolon and snatch a value.*/ tag_value[strlen(tag_value)-1] = '\0'; comp_value = atoi(tag_value); } else /*if sex male*/ { /*Is the value valid? It needs a semicolon at the end.*/ if (tag_value[0] == '\0' || tag_value[strlen(tag_value)-1] != ':') { bugf("Malformed tagline code: no :; starts with '%.5s'", text); wiznet(create_string("DEBUG: Missing ':' in tagline, begins with '%.10s'", text), NULL, NULL, WIZ_DEBUG, 0, MAX_LEVEL); ch_printf(ch, "<Broken tagline: missing :>"); return; } /*Smash the semicolon.*/ tag_value[strlen(tag_value)-1] = '\0'; } /*We can now evaluate our tagline.*/ valid_tag = tagline_validity(ch, tag_type, tag_value, comp_value, oper); /*Strip leading spaces before copying tagline string in.*/ while (*text && *text == ' ') text++; /*Copy in tagline string.*/ /*Also have to check to see if we have a '$' for the person's name.*/ i = 0; while (*text != '\0' && *text != ']' && i < MSL - 1) { if (*text == '$') { copy_name = 0; char name_buf[128]; strcpy(name_buf, ch->name); while (name_buf[copy_name] != '\0') tag_string[i++] = name_buf[copy_name++]; } else tag_string[i++] = *text; text++; } tag_string[i] = '\0'; /*Another sanity check: no terminating ].*/ if (*text == '\0') { ch_printf(ch, "<Broken tagline: no terminating ]:>"); return; } text++; /*For the next iteration.*/ if (valid_tag && ((strlen(output) + strlen(tag_string)) < MSL)) { strcat(output, tag_string); /*Readjust output_ptr.*/ output_ptr = output + strlen(output); } } if (formatted) { formatted_str = str_dup(output); formatted_str = format_string(formatted_str); ch_printf(ch, "%s", formatted_str); free_string(formatted_str); return; } ch_printf(ch, "%s\n\r", output); return; } char *tagline_output(char *text, CHAR_DATA *ch, bool formatted) { static char static_output[MSL]; static_output[0] = '\0'; if (strlen(text) <= 0) return static_output; static char *formatted_str; char *static_ptr = static_output; char tag_type[MSL]; char tag_value[MSL]; char tag_string[MSL]; int oper = 0; /*Used to evaluate a tagline.*/ int i = 0; /*Used to copy in a tagline string.*/ int comp_value = 0; /*What a, say, #cha is compared against*/ int copy_name = 0; /*Used to copy ch->name in place of '$'.*/ int valid_tag = FALSE; /*[#sex male: A pretty barmaid winks at you as she goes about.]*/ /* [#cha > 16: You notice a sale on dresses in your size.]*/ while (*text != '\0') { /*Find the [.*/ while (*text && *text != '[') *static_ptr++ = *text++; *static_ptr = '\0'; /*Sanity check.*/ if (*text == '\0') break; /*Find the #.*/ text++; if (*text != '#') { bugf("Malformed tagline code: no #; starts with '%.5s'", text); strcpy(static_output, "<Broken tagline: no #>"); return static_output; } text++; /*Parse the 'sex'.*/ text = one_argument(text, tag_type); /*Now we have a conditional to evaluate. If it's 'sex male:', we won't need to use an operand. If it's 'int > 15:', we'll have to grab another tag_value.*/ text = one_argument(text, tag_value); /*Now, see if it is an operand (>=) or a word (male).*/ if (!isalpha(tag_value[0])) { /*An operand.*/ if ((oper = keyword_lookup(fn_evals, tag_value)) < 0 ) { bugf("Malformed tagline code: invalid operand; starts with '%.5s'", text); strcpy(static_output, "<Broken tagline: invalid operand>"); return static_output; } /*Grab the comparison--i.e. 'cha < 10', the '10'.*/ text = one_argument(text, tag_value); /*Make sure there's a semicolon to smash.*/ if (tag_value[0] == '\0' || tag_value[strlen(tag_value)-1] != ':') { bugf("Malformed tagline code: no :; starts with '%.5s'", text); wiznet(create_string("DEBUG: Missing ':' in tagline, begins with '%.10s'", text), NULL, NULL, WIZ_DEBUG, 0, MAX_LEVEL); strcpy(static_output, "<Broken tagline: no :>"); return static_output; } /*Smash the semicolon and snatch a value.*/ tag_value[strlen(tag_value)-1] = '\0'; comp_value = atoi(tag_value); } else /*if sex male*/ { /*Is the value valid? It needs a semicolon at the end.*/ if (tag_value[0] == '\0' || tag_value[strlen(tag_value)-1] != ':') { bugf("Malformed tagline code: no :; starts with '%.5s'", text); wiznet(create_string("DEBUG: Missing ':' in tagline, begins with '%.10s'", text), NULL, NULL, WIZ_DEBUG, 0, MAX_LEVEL); strcpy(static_output, "<Broken tagline: no :>"); return static_output; } /*Smash the semicolon.*/ tag_value[strlen(tag_value)-1] = '\0'; } /*We can now evaluate our tagline.*/ valid_tag = tagline_validity(ch, tag_type, tag_value, comp_value, oper); /*Strip leading spaces before copying tagline string in.*/ while (*text && *text == ' ') text++; /*Copy in tagline string.*/ /*Also have to check to see if we have a '$' for the person's name.*/ i = 0; while (*text != '\0' && *text != ']' && i < MSL - 1) { if (*text == '$') { copy_name = 0; char name_buf[128]; strcpy(name_buf, ch->name); while (name_buf[copy_name] != '\0') tag_string[i++] = name_buf[copy_name++]; } else tag_string[i++] = *text; text++; } tag_string[i] = '\0'; /*Another sanity check: no terminating ].*/ if (*text == '\0') { strcpy(static_output, "<Broken tagline: no terminating ]>"); return static_output; } text++; /*For the next iteration.*/ if (valid_tag && ((strlen(static_output) + strlen(tag_string)) < MSL)) { strcat(static_output, tag_string); /*Readjust static_ptr.*/ static_ptr = static_output + strlen(static_output); } } if (formatted) { free_string(formatted_str); formatted_str = str_dup(static_output); formatted_str = format_string(formatted_str); return formatted_str; } return static_output; } int tagline_validity(CHAR_DATA *ch, char *tag_type, char *tag_value, int comp_value, int oper) { int valid_tag = 0; switch (UPPER(tag_type[0])) { case 'A': if (!str_cmp(tag_type, "age")) break; case 'C': if (!str_cmp(tag_type, "con")) valid_tag = num_eval(get_curr_stat(ch, STAT_CON), oper, comp_value); else if (!str_cmp(tag_type, "cha")) valid_tag = num_eval(get_curr_stat(ch, STAT_CHA), oper, comp_value); break; case 'D': if (!str_cmp(tag_type, "dex")) valid_tag = num_eval(get_curr_stat(ch, STAT_DEX), oper, comp_value); else if (!str_cmp(tag_type, "day")) valid_tag = num_eval(time_info.day, oper, comp_value); break; case 'G': if (!str_cmp(tag_type, "gold")) valid_tag = num_eval(ch->gold, oper, comp_value); break; case 'I': if (!str_cmp(tag_type, "int")) valid_tag = num_eval(get_curr_stat(ch, STAT_INT), oper, comp_value); break; case 'L': if (!str_cmp(tag_type, "level")) valid_tag = num_eval(ch->level, oper, comp_value); break; case 'M': if (!str_cmp(tag_type, "month")) valid_tag = num_eval(time_info.month, oper, comp_value); break; case 'R': if (!str_cmp(tag_type, "race")) valid_tag = num_eval(race_lookup(tag_value), oper, ch->race); break; case 'S': if (!str_cmp(tag_type, "sex")) { if (ch->sex == sex_lookup(tag_value)) valid_tag = TRUE; } if (!str_cmp(tag_type, "show")) valid_tag = TRUE; else if (!str_cmp(tag_type, "silver")) valid_tag = num_eval(ch->silver, oper, comp_value); else if (!str_cmp(tag_type, "str")) valid_tag = num_eval(get_curr_stat(ch, STAT_STR), oper, comp_value); else if (!str_cmp(tag_type, "sun")) { if (!str_cmp(tag_value, "sunrise") && (weather_info.sunlight == SUN_RISE)) valid_tag = TRUE; else if (!str_cmp(tag_value, "sunset") && (weather_info.sunlight == SUN_SET)) valid_tag = TRUE; else if (!str_cmp(tag_value, "day") && (weather_info.sunlight == SUN_LIGHT)) valid_tag = TRUE; else if (!str_cmp(tag_value, "night") && (weather_info.sunlight == SUN_DARK)) valid_tag = TRUE; } break; case 'T': if (!str_cmp(tag_type, "time")) valid_tag = num_eval(time_info.hour, oper, comp_value); break; case 'W': if (!str_cmp(tag_type, "weather")) { if (!str_cmp(tag_value, "sunny") && (weather_info.sky == SKY_CLOUDLESS)) valid_tag = TRUE; else if (!str_cmp(tag_value, "cloudy") && (weather_info.sky == SKY_CLOUDY)) valid_tag = TRUE; else if (!str_cmp(tag_value, "rainy") && (weather_info.sky == SKY_RAINING)) valid_tag = TRUE; else if (!str_cmp(tag_value, "lightning") && (weather_info.sky == SKY_LIGHTNING)) valid_tag = TRUE; } break; } return valid_tag; } void do_poll (CHAR_DATA *ch, char *argument) { char arg[MIL]; MENU_DATA *menu, *gMenu; OPTION_DATA *option; int i, which; if (IS_NPC(ch)) { send_to_char("Silly wabbit, Trix are for kids, not mobs.\n\r", ch); return; } argument = one_argument(argument, arg); if (arg[0] == '\0') { do_function(ch, &do_poll, "options"); return; } //New. 5/4/2004 10:03PM if (!str_prefix(arg, "force")) { argument = one_argument(argument, arg); if (arg[0] == '\0') { send_to_char("Poll force options:\n\rclose\n\r", ch); return; } if (!str_prefix(arg, "close")) { EVENT *ev; send_to_char("Force-closing all polls...\n\r", ch); for (ev = events; ev; ev = ev->next) { if (ev->type == EVENT_POLL) { ev->delay = 0; return; } } } do_function(ch, &do_poll, "force"); return; } if (!str_prefix(arg, "new")) { if ((menu = find_menu_char (ch, "poll")) != NULL) { send_to_char("You're already creating a poll! 'poll clear' to start over.\n\r", ch); return; } menu = new_menu(); menu->name = str_dup("poll"); menu->text = str_dup("<none>"); menu->opening = str_dup(""); //menu_event(ch, menu); menu_to_char(ch, menu); //non-event style send_to_char("Poll created. Check out 'poll options' to see what needs to be set before posting.\n\r", ch); return; } if (!str_prefix(arg, "options")) { // Kind of ugly, huh? BUFFER *b; b = new_buf(); add_buf(b, "Poll options\n\r"); add_buf(b, draw_line(ch, "{w-{W-", 0)); add_buf(b, "poll new --Create a new poll to work on.\n\r"); add_buf(b, "poll clear --Erase the poll you're working on.\n\r"); add_buf(b, "poll show --Show the poll you're working on.\n\r\n\r"); add_buf(b, "poll topic --Set a poll's topic. {R(Required){x\n\r"); add_buf(b, "poll add <string> --Add a new voting choice with text <string>. {R(Required){x\n\r"); add_buf(b, "poll delete <choice>--Delete the voting choice <number>.\n\r"); add_buf(b, "poll force <option> --Force something to happen to currently-running polls.\n\r\n\r"); add_buf(b, "poll post <minutes>: Post the poll you're working on. {R(Time Required){x\n\r\n\r{C--{WExamples{C--{x:\n\r"); add_buf(b, "poll post 60 -- Posts the poll you're working on with a voting time of 60 minutes.\n\r"); add_buf(b, "poll delete 1 -- Delete the first voting choice of the poll you're working on.\n\r"); add_buf(b, "poll add Yes -- adds a voting choice of 'Yes'.\n\r"); add_buf(b, "{RNOTE{r: {xOnce a poll has been submitted, it cannot be edited.\n\r\n\r"); add_buf(b, "For more info, see 'help poll'.\n\r"); page_to_char(buf_string(b), ch); free_buf(b); return; } //Anything below here requires a valid poll, so we'll check here. if ((menu = find_menu_char (ch, "poll")) == NULL) { send_to_char("You don't seem to be working on a poll at the moment. Try 'poll new' first.\n\r", ch); return; } if (!str_prefix(arg, "clear")) { menu_from_char (ch, menu); free_menu(menu); send_to_char("Poll cleared.\n\r", ch); return; } if (!str_prefix(arg, "show")) { ch_printf(ch, "Poll Topic: {C%s{x\n\r", menu->text); send_to_char(draw_line(ch, "{w-{W-", 0), ch); send_to_char("Voting choices:\n\r\n\r", ch); i = 0; for (option = menu->option; option; option = option->next) ch_printf(ch, "{G%2d{x. {C%s{x\n\r", ++i, option->args[0]); send_to_char("When you are ready to post your poll, use 'poll post <minutes>'.\n\r", ch); return; } if (!str_prefix(arg, "topic")) { if (argument[0] == '\0') { send_to_char("Set the poll's topic to what?\n\r", ch); return; } free_string(menu->text); menu->text = str_dup(argument); do_function(ch, &do_poll, "show"); return; } if (!str_prefix(arg, "add")) { if (argument[0] == '\0') { send_to_char("Add WHAT as a new voting choice?\n\r", ch); return; } option = new_option(); option->args[0] = str_dup(argument); append_option(menu, option); do_function(ch, &do_poll, "show"); return; } if (!str_prefix(arg, "delete")) { one_argument(argument, arg); if (!is_number(arg)) { send_to_char("Delete which voting choice? Syntax: poll delete <number>.\n\r", ch); return; } which = atoi(arg); i = 0; for (option = menu->option; option; option = option->next) { if (++i == which) { option_from_menu(menu, option); do_function(ch, &do_poll, "show"); return; } } //Ran out of options send_to_char("There aren't that many voting choices. Take a look at the poll using 'poll show'.\n\r", ch); return; } if (!str_prefix(arg, "post")) { for (gMenu = menu_list; gMenu; gMenu = gMenu->next) { if (!str_cmp(gMenu->name, "poll")) { send_to_char("Sorry, there seems to be a poll currently running. You'll have to wait" " for that to finish before posting a new poll.\n\r", ch); return; } } one_argument(argument, arg); if (!is_number(arg)) { send_to_char("Post with how much of a voting time? Syntax: poll post <time in minutes>.\n\r", ch); return; } if (menu->text[0] == '\0' || menu->option == NULL) { send_to_char("There's a problem with your poll. Make sure you've set the topic\n\r" "and have added at least 1 voting choice before posting.\n\r", ch); return; } i = atoi(arg); menu_ch_to_world(ch, menu); poll_event(menu, i*60); send_to_char("Poll posted.\n\r", ch); return; } do_function(ch, &do_poll, "options"); return; } void do_vote (CHAR_DATA *ch, char *argument) { MENU_DATA *menu; OPTION_DATA *option; bool isPoll = FALSE; char arg[MIL]; int i = 0, optfind = 0; char buf[2*MSL]; if (IS_NPC(ch)) { send_to_char(".uoy etah I\n\r", ch); return; } for (menu = menu_list; menu; menu = menu->next) { if (!str_cmp(menu->name, "poll")) { isPoll = TRUE; break; } } if (!isPoll) { send_to_char("Sorry, there's no poll at the moment.\n\r", ch); return; } if (argument[0] == '\0') { ch_printf(ch, "Poll Topic: {C%s{x\n\r", menu->text); send_to_char(draw_line(ch, "{w-{W-", 0), ch); send_to_char("Voting Choices:\n\r\n\r", ch); for (option = menu->option; option; option = option->next) ch_printf(ch, "{G%2d{x. {C%s{x\n\r", ++optfind, option->args[0]); return; } if(is_exact_name(ch->name, menu->opening)) { send_to_char("You've already voted!\n\r", ch); return; } one_argument(argument, arg); if (!is_number(arg)) { send_to_char("You vote on an entry by number. Try just 'vote' to see what you can vote for.\n\r", ch); return; } i = atoi(arg); for (option = menu->option; option; option = option->next) { if (++optfind == i) { //option->key++; //rofl, I suck //had to change the above to below because key is used in append_option now option->argi++; //rofl, I suck less ;) JH 6/11/2004 9:59PM sprintf(buf, "%s %s ", menu->opening, ch->name); free_string(menu->opening); menu->opening = str_dup(buf); ch_printf(ch, "You have voted for: {C%s{x. Thanks for voting!\n\r", option->args[0]); return; } } //Ran out of options send_to_char("There aren't that many voting choices. Take a look at the poll using 'vote'.\n\r", ch); return; } char *format_obj_to_char (OBJ_DATA * obj, CHAR_DATA * ch, bool fShort) { static char buf[MAX_STRING_LENGTH]; buf[0] = '\0'; //Below hacked to allow for no long descriptions. /* *if ((fShort && (obj->short_descr == NULL || obj->short_descr[0] == '\0')) * || (obj->description == NULL || obj->description[0] == '\0')) * return buf; * */ if ((fShort && (obj->short_descr == NULL || obj->short_descr[0] == '\0')) || (!fShort && (obj->description == NULL || obj->description[0] == '\0'))) return buf; if (IS_OBJ_STAT (obj, ITEM_INVIS)) strcat (buf, "(Invis) "); if (IS_AFFECTED (ch, AFF_DETECT_EVIL) && IS_OBJ_STAT (obj, ITEM_EVIL)) strcat (buf, "(Red Aura) "); if (IS_AFFECTED (ch, AFF_DETECT_GOOD) && IS_OBJ_STAT (obj, ITEM_BLESS)) strcat (buf, "(Blue Aura) "); if (IS_AFFECTED (ch, AFF_DETECT_MAGIC) && IS_OBJ_STAT (obj, ITEM_MAGIC)) strcat (buf, "(Magical) "); if (IS_OBJ_STAT (obj, ITEM_GLOW)) strcat (buf, "(Glowing) "); if (IS_OBJ_STAT (obj, ITEM_HUM)) strcat (buf, "(Humming) "); //ch_printf(ch, "format_obj_to_char: buf before is %s\n\r", buf); if (fShort) { if (obj->short_descr != NULL) //strcat (buf, obj->short_descr); strcat (buf, tagline_output(obj->short_descr, ch, FALSE)); } else { if (obj->description != NULL) //strcat (buf, obj->description); strcat (buf, tagline_output(obj->description, ch, FALSE)); } //ch_printf(ch, "format_obj_to_char: buf after is %s\n\r", buf); return buf; } /* * Show a list to a character. * Can coalesce duplicated items. */ void show_list_to_char (OBJ_DATA * list, CHAR_DATA * ch, bool fShort, bool fShowNothing) { char buf[MAX_STRING_LENGTH]; BUFFER *output; char **prgpstrShow; int *prgnShow; char *pstrShow; OBJ_DATA *obj; int nShow; int iShow; int count; bool fCombine; if (ch->desc == NULL) return; count = 0; for (obj = list; obj != NULL; obj = obj->next_content) { //I added 'itemcnt' because the MUD will crash if the buffer gets too big, I think. //We'll cap items to 250 for now. JH 2/2/2004 1:47AM if (++count > 250) { send_to_char("Way too many items in a list. Bailing out.\n\r", ch); return; } } /* * Alloc space for output lines. */ output = new_buf (); prgpstrShow = (char**) alloc_mem (count * sizeof (char *)); prgnShow = (int *) alloc_mem (count * sizeof (int)); nShow = 0; /* * Format the list of objects. */ for (obj = list; obj != NULL; obj = obj->next_content) { if (obj->wear_loc == WEAR_NONE && can_see_obj (ch, obj)) { pstrShow = format_obj_to_char (obj, ch, fShort); fCombine = FALSE; if (IS_NPC (ch) || IS_SET (ch->comm, COMM_COMBINE)) { /* * Look for duplicates, case sensitive. * Matches tend to be near end so run loop backwords. */ for (iShow = nShow - 1; iShow >= 0; iShow--) { if (!strcmp (prgpstrShow[iShow], pstrShow)) { prgnShow[iShow]++; fCombine = TRUE; break; } } } /* * Couldn't combine, or didn't want to. */ if (!fCombine) { prgpstrShow[nShow] = str_dup (pstrShow); prgnShow[nShow] = 1; nShow++; } } } /* * Output the formatted list. */ for (iShow = 0; iShow < nShow; iShow++) { if (prgpstrShow[iShow][0] == '\0') { free_string (prgpstrShow[iShow]); continue; } if (IS_NPC (ch) || IS_SET (ch->comm, COMM_COMBINE)) { if (prgnShow[iShow] != 1) { sprintf (buf, "(%2d) ", prgnShow[iShow]); add_buf (output, buf); } else { add_buf (output, " "); } } add_buf (output, prgpstrShow[iShow]); add_buf (output, "\n\r"); free_string (prgpstrShow[iShow]); } if (fShowNothing && nShow == 0) { if (IS_NPC (ch) || IS_SET (ch->comm, COMM_COMBINE)) send_to_char (" ", ch); send_to_char ("Nothing.\n\r", ch); } page_to_char (buf_string (output), ch); /* * Clean up. */ free_buf (output); free_mem (prgpstrShow, count * sizeof (char *)); free_mem (prgnShow, count * sizeof (int)); return; } void show_char_to_char_0 (CHAR_DATA * victim, CHAR_DATA * ch) { char buf[MAX_STRING_LENGTH], message[MAX_STRING_LENGTH]; char sbuf[MSL]; buf[0] = '\0'; /* JH 3/26/2004 5:07AM *Does the mob maybe want to be hidden? I think so. */ if (IS_NPC(victim) && victim->position == victim->start_pos && victim->long_descr[0] == '\0') return; if (IS_SET (victim->comm, COMM_AFK)) strcat (buf, "[AFK] "); if (IS_AFFECTED (victim, AFF_INVISIBLE)) strcat (buf, "(Invis) "); if (victim->invis_level >= LEVEL_HERO) strcat (buf, "(Wizi) "); if (IS_AFFECTED (victim, AFF_HIDE)) strcat (buf, "(Hide) "); if (IS_AFFECTED (victim, AFF_CHARM)) strcat (buf, "(Charmed) "); if (IS_AFFECTED (victim, AFF_PASS_DOOR)) strcat (buf, "(Translucent) "); if (IS_AFFECTED (victim, AFF_FAERIE_FIRE)) strcat (buf, "(Pink Aura) "); if (IS_EVIL (victim) && IS_AFFECTED (ch, AFF_DETECT_EVIL)) strcat (buf, "(Red Aura) "); if (IS_GOOD (victim) && IS_AFFECTED (ch, AFF_DETECT_GOOD)) strcat (buf, "(Golden Aura) "); if (IS_AFFECTED (victim, AFF_SANCTUARY)) strcat (buf, "(White Aura) "); if (!IS_NPC (victim) && IS_SET (victim->act, PLR_KILLER)) strcat (buf, "(KILLER) "); if (!IS_NPC (victim) && IS_SET (victim->act, PLR_THIEF)) strcat (buf, "(THIEF) "); if (victim->position == victim->start_pos && victim->long_descr[0] != '\0') { strcat (buf, victim->long_descr); send_to_char (buf, ch); return; } strcat (buf, PERS (victim, ch)); if (!IS_NPC (victim) && !IS_SET (ch->comm, COMM_BRIEF) && victim->position == POS_STANDING && ch->on == NULL) strcat (buf, victim->pcdata->title); switch (victim->position) { case POS_DEAD: strcat (buf, " is DEAD!!"); break; case POS_MORTAL: strcat (buf, " is mortally wounded."); break; case POS_INCAP: strcat (buf, " is incapacitated."); break; case POS_STUNNED: strcat (buf, " is lying here stunned."); break; case POS_SLEEPING: if (victim->on != NULL) { if (IS_SET (victim->on->value[2], SLEEP_AT)) { sprintf (message, " is sleeping at %s.", victim->on->short_descr); strcat (buf, message); } else if (IS_SET (victim->on->value[2], SLEEP_ON)) { sprintf (message, " is sleeping on %s.", victim->on->short_descr); strcat (buf, message); } else { sprintf (message, " is sleeping in %s.", victim->on->short_descr); strcat (buf, message); } } else strcat (buf, " is sleeping here."); break; case POS_RESTING: if (victim->on != NULL) { if (IS_SET (victim->on->value[2], REST_AT)) { sprintf (message, " is resting at %s.", victim->on->short_descr); strcat (buf, message); } else if (IS_SET (victim->on->value[2], REST_ON)) { sprintf (message, " is resting on %s.", victim->on->short_descr); strcat (buf, message); } else { sprintf (message, " is resting in %s.", victim->on->short_descr); strcat (buf, message); } } else strcat (buf, " is resting here."); break; case POS_ENSCONCED: if (victim->on != NULL) { if (IS_SET (victim->on->value[2], SIT_AT)) { sprintf (message, " is sitting at %s.", victim->on->short_descr); strcat (buf, message); } else if (IS_SET (victim->on->value[2], SIT_ON)) { sprintf (message, " is sitting on %s.", victim->on->short_descr); strcat (buf, message); } else { sprintf (message, " is sitting in %s.", victim->on->short_descr); strcat (buf, message); } } else { sprintf(sbuf, " is %s here.", ensconce_flags[victim->ensconce_type].name); strcat (buf, sbuf); } break; case POS_STANDING: if (victim->on != NULL) { if (IS_SET (victim->on->value[2], STAND_AT)) { sprintf (message, " is standing at %s.", victim->on->short_descr); strcat (buf, message); } else if (IS_SET (victim->on->value[2], STAND_ON)) { sprintf (message, " is standing on %s.", victim->on->short_descr); strcat (buf, message); } else { sprintf (message, " is standing in %s.", victim->on->short_descr); strcat (buf, message); } } else strcat (buf, " is here."); break; case POS_FIGHTING: strcat (buf, " is here, fighting "); if (victim->fighting == NULL) strcat (buf, "thin air??"); else if (victim->fighting == ch) strcat (buf, "YOU!"); else if (victim->in_room == victim->fighting->in_room) { strcat (buf, PERS (victim->fighting, ch)); strcat (buf, "."); } else strcat (buf, "someone who left??"); break; } strcat (buf, "\n\r"); buf[0] = UPPER (buf[0]); send_to_char (buf, ch); return; } /* JH 1/9/2004 4:19AM -- below was split; EQ side is now in do_glance.*/ void show_char_to_char_1 (CHAR_DATA * victim, CHAR_DATA * ch) { char buf[MAX_STRING_LENGTH]; int percent; if (can_see (victim, ch)) { if (ch == victim) act ("$n looks at $mself.", ch, NULL, NULL, TO_ROOM); else { act ("$n looks at you.", ch, NULL, victim, TO_VICT); act ("$n looks at $N.", ch, NULL, victim, TO_NOTVICT); } } if (victim->description[0] != '\0') { //JH new 1/23/2004 12:03AM tagline_to_char (victim->description, ch, TRUE); //send_to_char (victim->description, ch); } else { act ("You see nothing special about $M.", ch, NULL, victim, TO_CHAR); } //JH Fixes double-seeing condition when fighting. if (ch->fighting == victim) return; if (victim->max_hit > 0) percent = (100 * victim->hit) / victim->max_hit; else percent = -1; strcpy (buf, PERS (victim, ch)); if (percent >= 100) strcat (buf, " is in excellent condition.\n\r"); else if (percent >= 90) strcat (buf, " has a few scratches.\n\r"); else if (percent >= 75) strcat (buf, " has some small wounds and bruises.\n\r"); else if (percent >= 50) strcat (buf, " has quite a few wounds.\n\r"); else if (percent >= 30) strcat (buf, " has some big nasty wounds and scratches.\n\r"); else if (percent >= 15) strcat (buf, " looks pretty hurt.\n\r"); else if (percent >= 0) strcat (buf, " is in awful condition.\n\r"); else strcat (buf, " is bleeding to death.\n\r"); buf[0] = UPPER (buf[0]); send_to_char (buf, ch); return; } void show_char_to_char (CHAR_DATA * list, CHAR_DATA * ch) { CHAR_DATA *rch; for (rch = list; rch != NULL; rch = rch->next_in_room) { if (rch == ch) continue; if (get_trust (ch) < rch->invis_level) continue; if (can_see (ch, rch)) { show_char_to_char_0 (rch, ch); } else if (room_is_dark (ch->in_room) && IS_AFFECTED (rch, AFF_INFRARED)) { send_to_char ("You see glowing red eyes watching YOU!\n\r", ch); } } return; } bool check_blind (CHAR_DATA * ch) { if (!IS_NPC (ch) && IS_SET (ch->act, PLR_HOLYLIGHT)) return TRUE; if (IS_AFFECTED (ch, AFF_BLIND)) { send_to_char ("You can't see a thing!\n\r", ch); return FALSE; } return TRUE; } /* changes your scroll */ void do_scroll (CHAR_DATA * ch, char *argument) { char arg[MAX_INPUT_LENGTH]; char buf[100]; int lines; one_argument (argument, arg); if (arg[0] == '\0') { if (ch->lines == 0) send_to_char ("You do not page long messages.\n\r", ch); else { sprintf (buf, "You currently display %d lines per page.\n\r", ch->lines + 2); send_to_char (buf, ch); } return; } if (!is_number (arg)) { send_to_char ("You must provide a number.\n\r", ch); return; } lines = atoi (arg); if (lines == 0) { send_to_char ("Paging disabled.\n\r", ch); ch->lines = 0; return; } if (lines < 10 || lines > 100) { send_to_char ("You must provide a reasonable number.\n\r", ch); return; } sprintf (buf, "Scroll set to %d lines.\n\r", lines); send_to_char (buf, ch); ch->lines = lines - 2; } /* RT does socials */ void do_socials (CHAR_DATA * ch, char *argument) { char buf[MAX_STRING_LENGTH]; int iSocial; int col; col = 0; for (iSocial = 0; social_table[iSocial].name[0] != '\0'; iSocial++) { sprintf (buf, "%-12s", social_table[iSocial].name); send_to_char (buf, ch); if (++col % 6 == 0) send_to_char ("\n\r", ch); } if (col % 6 != 0) send_to_char ("\n\r", ch); return; } /* RT Commands to replace news, motd, imotd, etc from ROM */ void do_motd (CHAR_DATA * ch, char *argument) { do_function (ch, &do_oldhelp, "motd"); } void do_imotd (CHAR_DATA * ch, char *argument) { do_function (ch, &do_oldhelp, "imotd"); } void do_rules (CHAR_DATA * ch, char *argument) { do_function (ch, &do_oldhelp, "rules"); } void do_story (CHAR_DATA * ch, char *argument) { do_function (ch, &do_oldhelp, "story"); } void do_wizlist (CHAR_DATA * ch, char *argument) { do_function (ch, &do_oldhelp, "wizlist"); } /* RT this following section holds all the auto commands from ROM, as well as replacements for config */ void do_autolist (CHAR_DATA * ch, char *argument) { /* lists most player flags */ if (IS_NPC (ch)) return; send_to_char (" action status\n\r", ch); send_to_char ("---------------------\n\r", ch); send_to_char ("autoassist ", ch); if (IS_SET (ch->act, PLR_AUTOASSIST)) send_to_char ("{GON{x\n\r", ch); else send_to_char ("{ROFF{x\n\r", ch); send_to_char ("autoexit ", ch); if (IS_SET (ch->act, PLR_AUTOEXIT)) send_to_char ("{GON{x\n\r", ch); else send_to_char ("{ROFF{x\n\r", ch); send_to_char ("autogold ", ch); if (IS_SET (ch->act, PLR_AUTOGOLD)) send_to_char ("{GON{x\n\r", ch); else send_to_char ("{ROFF{x\n\r", ch); send_to_char ("autoloot ", ch); if (IS_SET (ch->act, PLR_AUTOLOOT)) send_to_char ("{GON{x\n\r", ch); else send_to_char ("{ROFF{x\n\r", ch); send_to_char ("autosac ", ch); if (IS_SET (ch->act, PLR_AUTOSAC)) send_to_char ("{GON{x\n\r", ch); else send_to_char ("{ROFF{x\n\r", ch); send_to_char ("autosplit ", ch); if (IS_SET (ch->act, PLR_AUTOSPLIT)) send_to_char ("{GON{x\n\r", ch); else send_to_char ("{ROFF{x\n\r", ch); send_to_char ("telnetga ", ch); if (IS_SET (ch->comm, COMM_TELNET_GA)) send_to_char ("{GON{x\n\r", ch); else send_to_char ("{ROFF{x\n\r",ch); send_to_char ("compact mode ", ch); if (IS_SET (ch->comm, COMM_COMPACT)) send_to_char ("{GON{x\n\r", ch); else send_to_char ("{ROFF{x\n\r", ch); send_to_char ("prompt ", ch); if (IS_SET (ch->comm, COMM_PROMPT)) send_to_char ("{GON{x\n\r", ch); else send_to_char ("{ROFF{x\n\r", ch); send_to_char ("combine items ", ch); if (IS_SET (ch->comm, COMM_COMBINE)) send_to_char ("{GON{x\n\r", ch); else send_to_char ("{ROFF{x\n\r", ch); if (!IS_SET (ch->act, PLR_CANLOOT)) send_to_char ("Your corpse is safe from thieves.\n\r", ch); else send_to_char ("Your corpse may be looted.\n\r", ch); if (IS_SET (ch->act, PLR_NOSUMMON)) send_to_char ("You cannot be summoned.\n\r", ch); else send_to_char ("You can be summoned.\n\r", ch); if (IS_SET (ch->act, PLR_NOFOLLOW)) send_to_char ("You do not welcome followers.\n\r", ch); else send_to_char ("You accept followers.\n\r", ch); } void do_autoassist (CHAR_DATA * ch, char *argument) { if (IS_NPC (ch)) return; if (IS_SET (ch->act, PLR_AUTOASSIST)) { send_to_char ("Autoassist removed.\n\r", ch); REMOVE_BIT (ch->act, PLR_AUTOASSIST); } else { send_to_char ("You will now assist when needed.\n\r", ch); SET_BIT (ch->act, PLR_AUTOASSIST); } } void do_autoexit (CHAR_DATA * ch, char *argument) { if (IS_NPC (ch)) return; if (IS_SET (ch->act, PLR_AUTOEXIT)) { send_to_char ("Exits will no longer be displayed.\n\r", ch); REMOVE_BIT (ch->act, PLR_AUTOEXIT); } else { send_to_char ("Exits will now be displayed.\n\r", ch); SET_BIT (ch->act, PLR_AUTOEXIT); } } void do_autogold (CHAR_DATA * ch, char *argument) { if (IS_NPC (ch)) return; if (IS_SET (ch->act, PLR_AUTOGOLD)) { send_to_char ("Autogold removed.\n\r", ch); REMOVE_BIT (ch->act, PLR_AUTOGOLD); } else { send_to_char ("Automatic gold looting set.\n\r", ch); SET_BIT (ch->act, PLR_AUTOGOLD); } } void do_autoloot (CHAR_DATA * ch, char *argument) { if (IS_NPC (ch)) return; if (IS_SET (ch->act, PLR_AUTOLOOT)) { send_to_char ("Autolooting removed.\n\r", ch); REMOVE_BIT (ch->act, PLR_AUTOLOOT); } else { send_to_char ("Automatic corpse looting set.\n\r", ch); SET_BIT (ch->act, PLR_AUTOLOOT); } } void do_autosac (CHAR_DATA * ch, char *argument) { if (IS_NPC (ch)) return; if (IS_SET (ch->act, PLR_AUTOSAC)) { send_to_char ("Autosacrificing removed.\n\r", ch); REMOVE_BIT (ch->act, PLR_AUTOSAC); } else { send_to_char ("Automatic corpse sacrificing set.\n\r", ch); SET_BIT (ch->act, PLR_AUTOSAC); } } void do_autosplit (CHAR_DATA * ch, char *argument) { if (IS_NPC (ch)) return; if (IS_SET (ch->act, PLR_AUTOSPLIT)) { send_to_char ("Autosplitting removed.\n\r", ch); REMOVE_BIT (ch->act, PLR_AUTOSPLIT); } else { send_to_char ("Automatic gold splitting set.\n\r", ch); SET_BIT (ch->act, PLR_AUTOSPLIT); } } void do_autoall (CHAR_DATA *ch, char * argument) { if (IS_NPC(ch)) return; if (!strcmp (argument, "on")) { SET_BIT(ch->act,PLR_AUTOASSIST); SET_BIT(ch->act,PLR_AUTOEXIT); SET_BIT(ch->act,PLR_AUTOGOLD); SET_BIT(ch->act,PLR_AUTOLOOT); SET_BIT(ch->act,PLR_AUTOSAC); SET_BIT(ch->act,PLR_AUTOSPLIT); send_to_char("All autos turned on.\n\r",ch); } else if (!strcmp (argument, "off")) { REMOVE_BIT (ch->act, PLR_AUTOASSIST); REMOVE_BIT (ch->act, PLR_AUTOEXIT); REMOVE_BIT (ch->act, PLR_AUTOGOLD); REMOVE_BIT (ch->act, PLR_AUTOLOOT); REMOVE_BIT (ch->act, PLR_AUTOSAC); REMOVE_BIT (ch->act, PLR_AUTOSPLIT); send_to_char("All autos turned off.\n\r", ch); } else send_to_char("Usage: autoall [on|off]\n\r", ch); } void do_brief (CHAR_DATA * ch, char *argument) { if (IS_SET (ch->comm, COMM_BRIEF)) { send_to_char ("Full descriptions activated.\n\r", ch); REMOVE_BIT (ch->comm, COMM_BRIEF); } else { send_to_char ("Short descriptions activated.\n\r", ch); SET_BIT (ch->comm, COMM_BRIEF); } } void do_compact (CHAR_DATA * ch, char *argument) { if (IS_SET (ch->comm, COMM_COMPACT)) { send_to_char ("Compact mode removed.\n\r", ch); REMOVE_BIT (ch->comm, COMM_COMPACT); } else { send_to_char ("Compact mode set.\n\r", ch); SET_BIT (ch->comm, COMM_COMPACT); } } void do_show (CHAR_DATA * ch, char *argument) { if (IS_SET (ch->comm, COMM_SHOW_AFFECTS)) { send_to_char ("Affects will no longer be shown in score.\n\r", ch); REMOVE_BIT (ch->comm, COMM_SHOW_AFFECTS); } else { send_to_char ("Affects will now be shown in score.\n\r", ch); SET_BIT (ch->comm, COMM_SHOW_AFFECTS); } } void do_prompt (CHAR_DATA * ch, char *argument) { char buf[MAX_STRING_LENGTH]; if (argument[0] == '\0') { if (IS_SET (ch->comm, COMM_PROMPT)) { send_to_char ("You will no longer see prompts.\n\r", ch); REMOVE_BIT (ch->comm, COMM_PROMPT); } else { send_to_char ("You will now see prompts.\n\r", ch); SET_BIT (ch->comm, COMM_PROMPT); } return; } if (!strcmp (argument, "all")) strcpy (buf, "<%hhp %cc %ee %ff %ll %vmv> "); else { if (strlen (argument) > 50) argument[50] = '\0'; strcpy (buf, argument); smash_tilde (buf); if (str_suffix ("%c", buf)) strcat (buf, " "); } free_string (ch->prompt); ch->prompt = str_dup (buf); sprintf (buf, "Prompt set to %s\n\r", ch->prompt); send_to_char (buf, ch); return; } void do_combine (CHAR_DATA * ch, char *argument) { if (IS_SET (ch->comm, COMM_COMBINE)) { send_to_char ("Long inventory selected.\n\r", ch); REMOVE_BIT (ch->comm, COMM_COMBINE); } else { send_to_char ("Combined inventory selected.\n\r", ch); SET_BIT (ch->comm, COMM_COMBINE); } } void do_noloot (CHAR_DATA * ch, char *argument) { if (IS_NPC (ch)) return; if (IS_SET (ch->act, PLR_CANLOOT)) { send_to_char ("Your corpse is now safe from thieves.\n\r", ch); REMOVE_BIT (ch->act, PLR_CANLOOT); } else { send_to_char ("Your corpse may now be looted.\n\r", ch); SET_BIT (ch->act, PLR_CANLOOT); } } void do_nofollow (CHAR_DATA * ch, char *argument) { if (IS_NPC (ch)) return; if (IS_SET (ch->act, PLR_NOFOLLOW)) { send_to_char ("You now accept followers.\n\r", ch); REMOVE_BIT (ch->act, PLR_NOFOLLOW); } else { send_to_char ("You no longer accept followers.\n\r", ch); SET_BIT (ch->act, PLR_NOFOLLOW); die_follower (ch); } } void do_nosummon (CHAR_DATA * ch, char *argument) { if (IS_NPC (ch)) { if (IS_SET (ch->imm_flags, IMM_SUMMON)) { send_to_char ("You are no longer immune to summon.\n\r", ch); REMOVE_BIT (ch->imm_flags, IMM_SUMMON); } else { send_to_char ("You are now immune to summoning.\n\r", ch); SET_BIT (ch->imm_flags, IMM_SUMMON); } } else { if (IS_SET (ch->act, PLR_NOSUMMON)) { send_to_char ("You are no longer immune to summon.\n\r", ch); REMOVE_BIT (ch->act, PLR_NOSUMMON); } else { send_to_char ("You are now immune to summoning.\n\r", ch); SET_BIT (ch->act, PLR_NOSUMMON); } } } /* JH 1/9/2004 4:20AM -- look shows condition and desc, glance shows EQ.*/ void do_glance (CHAR_DATA * ch, char *argument) { int percent; CHAR_DATA *victim; char arg1[MIL]; char buf[MSL]; bool found; int iWear; OBJ_DATA *obj; if (ch->desc == NULL) return; if (ch->position < POS_SLEEPING) { send_to_char ("You can't see anything but stars!\n\r", ch); return; } if (ch->position == POS_SLEEPING) { send_to_char ("You can't see anything, you're sleeping!\n\r", ch); return; } if (!check_blind (ch)) return; if (!IS_NPC (ch) && !IS_SET (ch->act, PLR_HOLYLIGHT) && room_is_dark (ch->in_room)) { send_to_char ("It is pitch black ... \n\r", ch); show_char_to_char (ch->in_room->people, ch); return; } argument = one_argument (argument, arg1); if ((victim = get_char_room (ch, NULL, arg1)) != NULL) { if (can_see (victim, ch)) { if (ch == victim) act ("$n glances at $mself.", ch, NULL, NULL, TO_ROOM); else { act ("$n glances at you.", ch, NULL, victim, TO_VICT); act ("$n glances at $N.", ch, NULL, victim, TO_NOTVICT); } } if (victim->max_hit > 0) percent = (100 * victim->hit) / victim->max_hit; else percent = -1; if (IS_IMMORTAL(ch)) { sprintf (buf, "Hp: %d/%d Move: %d/%d\n\r", victim->hit, victim->max_hit, victim->move, victim->max_move); send_to_char (buf, ch); sprintf (buf, "Chi: %d/%d Ele: %d/%d Fae: %d/%d Ley: %d/%d\n\r", victim->magic_points[MAG_CHI], victim->max_magic_points[MAG_CHI], victim->magic_points[MAG_ELE], victim->max_magic_points[MAG_ELE], victim->magic_points[MAG_FAE], victim->max_magic_points[MAG_FAE], victim->magic_points[MAG_LEY], victim->max_magic_points[MAG_LEY]); send_to_char (buf, ch); } strcpy (buf, PERS (victim, ch)); if (percent >= 100) strcat (buf, " is in excellent condition.\n\r"); else if (percent >= 90) strcat (buf, " has a few scratches.\n\r"); else if (percent >= 75) strcat (buf, " has some small wounds and bruises.\n\r"); else if (percent >= 50) strcat (buf, " has quite a few wounds.\n\r"); else if (percent >= 30) strcat (buf, " has some big nasty wounds and scratches.\n\r"); else if (percent >= 15) strcat (buf, " looks pretty hurt.\n\r"); else if (percent >= 0) strcat (buf, " is in awful condition.\n\r"); else strcat (buf, " is bleeding to death.\n\r"); buf[0] = UPPER (buf[0]); send_to_char (buf, ch); found = FALSE; for (iWear = 0; iWear < MAX_WEAR; iWear++) { if ((obj = get_eq_char (victim, iWear)) != NULL && can_see_obj (ch, obj)) { if (!found) { send_to_char ("\n\r", ch); act ("$N is using:", ch, NULL, victim, TO_CHAR); found = TRUE; } send_to_char (where_name[iWear], ch); send_to_char (format_obj_to_char (obj, ch, TRUE), ch); send_to_char ("\n\r", ch); } } if ((victim != ch && !IS_NPC (ch) && number_percent () < get_skill (ch, gsn_dummy)) || IS_IMMORTAL(ch)) { send_to_char ("\n\rYou peek at the inventory:\n\r", ch); check_improve (ch, gsn_dummy, TRUE, 4); show_list_to_char (victim->carrying, ch, TRUE, TRUE); } } else { send_to_char("They aren't here.\n\r", ch); } return; } void do_look (CHAR_DATA * ch, char *argument) { char buf[MAX_STRING_LENGTH]; char arg1[MAX_INPUT_LENGTH]; char arg2[MAX_INPUT_LENGTH]; char arg3[MAX_INPUT_LENGTH]; EXIT_DATA *pexit; CHAR_DATA *victim; OBJ_DATA *obj; char *pdesc; int door; int number, count; if (ch->desc == NULL) return; if (ch->position < POS_SLEEPING) { send_to_char ("You can't see anything but stars!\n\r", ch); return; } if (ch->position == POS_SLEEPING) { send_to_char ("You can't see anything, you're sleeping!\n\r", ch); return; } if (!check_blind (ch)) return; if (!IS_NPC (ch) && !IS_SET (ch->act, PLR_HOLYLIGHT) && room_is_dark (ch->in_room)) { send_to_char ("{DIt's too dark to see anything.{x\n\r", ch); show_char_to_char (ch->in_room->people, ch); return; } argument = one_argument (argument, arg1); argument = one_argument (argument, arg2); number = number_argument (arg1, arg3); count = 0; if (arg1[0] == '\0' || !str_cmp (arg1, "auto")) { /* 'look' or 'look auto' */ if ((IS_IMMORTAL (ch) && (IS_NPC (ch) || IS_SET (ch->act, PLR_HOLYLIGHT))) || IS_BUILDER (ch, ch->in_room->area)) { sprintf (buf, "{r[{y%d{r] ", ch->in_room->vnum); send_to_char (buf, ch); } send_to_char ("{s", ch); send_to_char (ch->in_room->name, ch); send_to_char ("\n\r", ch); if (arg1[0] == '\0' || (!IS_NPC (ch) && !IS_SET (ch->comm, COMM_BRIEF))) { send_to_char (" ", ch); send_to_char ("{S", ch); //New JH 1/23/2004 12:01AM if (IS_SET(ch->in_room->room_flags, ROOM_NOFORMATTING)) tagline_to_char(ch->in_room->description, ch, FALSE); else tagline_to_char(ch->in_room->description, ch, TRUE); //send_to_char (ch->in_room->description, ch); send_to_char ("{x", ch); } if (!IS_NPC (ch) && IS_SET (ch->act, PLR_AUTOEXIT)) { //send_to_char ("\n\r", ch); do_function (ch, &do_exits, "auto"); } show_list_to_char (ch->in_room->contents, ch, FALSE, FALSE); show_char_to_char (ch->in_room->people, ch); return; } if (!str_cmp (arg1, "i") || !str_cmp (arg1, "in") || !str_cmp (arg1, "on")) { /* 'look in' */ if (arg2[0] == '\0') { send_to_char ("Look in what?\n\r", ch); return; } if ((obj = get_obj_here (ch, NULL, arg2)) == NULL) { send_to_char ("You do not see that here.\n\r", ch); return; } switch (obj->item_type) { default: send_to_char ("That is not a container.\n\r", ch); break; case ITEM_DRINK_CON: if (obj->value[1] <= 0) { send_to_char ("It is empty.\n\r", ch); break; } sprintf (buf, "It's %sfilled with a %s liquid.\n\r", obj->value[1] < obj->value[0] / 4 ? "less than half-" : obj->value[1] < 3 * obj->value[0] / 4 ? "about half-" : "more than half-", liq_table[obj->value[2]].liq_color); send_to_char (buf, ch); break; case ITEM_CONTAINER: case ITEM_CORPSE_NPC: case ITEM_CORPSE_PC: if (IS_SET (obj->value[1], CONT_CLOSED)) { send_to_char ("It is closed.\n\r", ch); break; } act ("$p holds:", ch, obj, NULL, TO_CHAR); show_list_to_char (obj->contains, ch, TRUE, TRUE); break; } return; } if ((victim = get_char_room (ch, NULL, arg1)) != NULL) { show_char_to_char_1 (victim, ch); return; } for (obj = ch->carrying; obj != NULL; obj = obj->next_content) { if (can_see_obj (ch, obj)) { /* player can see object */ pdesc = get_extra_descr (arg3, obj->extra_descr); if (pdesc != NULL) { if (++count == number) { //New JH 1/23/2004 12:02AM tagline_to_char (pdesc, ch, TRUE); //send_to_char(pdesc, ch); return; } else continue; } pdesc = get_extra_descr (arg3, obj->pIndexData->extra_descr); if (pdesc != NULL) { if (++count == number) { //New JH 1/23/2004 12:02AM tagline_to_char (pdesc, ch, TRUE); send_to_char ("\n\r", ch); //send_to_char(pdesc, ch); return; } else continue; } if (is_name (arg3, obj->name)) if (++count == number) { //New JH 1/23/2004 12:02AM tagline_to_char (obj->description, ch, TRUE); //send_to_char(obj->description, ch); send_to_char ("\n\r", ch); return; } } } //Rooms descripts now come before objects on the ground long/extra descrips, //as per a change requested by Pooky on 4/11/2004 8:46PM. pdesc = get_extra_descr (arg3, ch->in_room->extra_descr); if (pdesc != NULL) { if (++count == number) { // send_to_char (pdesc, ch); tagline_to_char (pdesc, ch, TRUE); send_to_char ("\n\r", ch); return; } } for (obj = ch->in_room->contents; obj != NULL; obj = obj->next_content) { if (can_see_obj (ch, obj)) { pdesc = get_extra_descr (arg3, obj->extra_descr); if (pdesc != NULL) if (++count == number) { //send_to_char (pdesc, ch); tagline_to_char (pdesc, ch, TRUE); return; } pdesc = get_extra_descr (arg3, obj->pIndexData->extra_descr); if (pdesc != NULL) if (++count == number) { //send_to_char (pdesc, ch); tagline_to_char (pdesc, ch, TRUE); send_to_char ("\n\r", ch); return; } if (is_name (arg3, obj->name)) if (++count == number) { //send_to_char (obj->description, ch); //send_to_char ("\n\r", ch); tagline_to_char (obj->description, ch, TRUE); send_to_char ("\n\r", ch); return; } } } if (count > 0 && count != number) { if (count == 1) sprintf (buf, "You only see one %s here.\n\r", arg3); else sprintf (buf, "You only see %d of those here.\n\r", count); send_to_char (buf, ch); return; } if (!str_cmp (arg1, "n") || !str_cmp (arg1, "north")) door = 0; else if (!str_cmp (arg1, "e") || !str_cmp (arg1, "east")) door = 1; else if (!str_cmp (arg1, "s") || !str_cmp (arg1, "south")) door = 2; else if (!str_cmp (arg1, "w") || !str_cmp (arg1, "west")) door = 3; else if (!str_cmp (arg1, "u") || !str_cmp (arg1, "up")) door = 4; else if (!str_cmp (arg1, "d") || !str_cmp (arg1, "down")) door = 5; else { send_to_char ("You do not see that here.\n\r", ch); return; } /* 'look direction' */ if ((pexit = ch->in_room->exit[door]) == NULL) { send_to_char ("Nothing special there.\n\r", ch); return; } //JH added 1/25/2004 6:30PM if (IS_SET (pexit->exit_info, EX_SECRET)) { send_to_char ("Nothing special there.\n\r", ch); if (IS_IMMORTAL(ch)) { if (pexit->keyword != NULL && pexit->keyword[0] != '\0' && pexit->keyword[0] != ' ') ch_printf(ch, "{DImmortal: Exit's keywords: %s{x", pexit->keyword); else send_to_char("{DImmortal: This door is actually unopenable. Secret doors need " "doornames to be able to be opened.\n\r", ch); } return; } if (pexit->description != NULL && pexit->description[0] != '\0') send_to_char (pexit->description, ch); else send_to_char ("Nothing special there.\n\r", ch); if (pexit->keyword != NULL && pexit->keyword[0] != '\0' && pexit->keyword[0] != ' ') { if (IS_SET (pexit->exit_info, EX_CLOSED)) { act ("The $d is closed.", ch, NULL, pexit->keyword, TO_CHAR); } else if (IS_SET (pexit->exit_info, EX_ISDOOR)) { act ("The $d is open.", ch, NULL, pexit->keyword, TO_CHAR); } } return; } /* RT added back for the hell of it */ void do_read (CHAR_DATA * ch, char *argument) { do_function (ch, &do_look, argument); } void do_examine (CHAR_DATA * ch, char *argument) { char buf[MAX_STRING_LENGTH]; char arg[MAX_INPUT_LENGTH]; OBJ_DATA *obj; one_argument (argument, arg); if (arg[0] == '\0') { send_to_char ("Examine what?\n\r", ch); return; } do_function (ch, &do_look, arg); if ((obj = get_obj_here (ch, NULL, arg)) != NULL) { switch (obj->item_type) { default: break; case ITEM_JUKEBOX: do_function (ch, &do_play, "list"); break; case ITEM_MONEY: if (obj->value[0] == 0) { if (obj->value[1] == 0) sprintf (buf, "Odd...there's no coins in the pile.\n\r"); else if (obj->value[1] == 1) sprintf (buf, "Wow. One gold coin.\n\r"); else sprintf (buf, "There are %d gold coins in the pile.\n\r", obj->value[1]); } else if (obj->value[1] == 0) { if (obj->value[0] == 1) sprintf (buf, "Wow. One silver coin.\n\r"); else sprintf (buf, "There are %d silver coins in the pile.\n\r", obj->value[0]); } else sprintf (buf, "There are %d gold and %d silver coins in the pile.\n\r", obj->value[1], obj->value[0]); send_to_char (buf, ch); break; case ITEM_DRINK_CON: case ITEM_CONTAINER: case ITEM_CORPSE_NPC: case ITEM_CORPSE_PC: sprintf (buf, "in %s", argument); do_function (ch, &do_look, buf); } } return; } /* * Thanks to Zrin for auto-exit part. */ void do_exits (CHAR_DATA * ch, char *argument) { extern char *const dir_name[]; char buf[MAX_STRING_LENGTH]; EXIT_DATA *pexit; bool found; bool fAuto; int door; bool first = TRUE; fAuto = !str_cmp (argument, "auto"); if (!check_blind (ch)) return; if (fAuto) sprintf (buf, "{o Obvious exits are "); else if (IS_IMMORTAL (ch)) sprintf (buf, "{oObvious exits from room %d:\n\r", ch->in_room->vnum); else sprintf (buf, "{oObvious exits:\n\r"); found = FALSE; for (door = 0; door <= 5; door++) { if ((pexit = ch->in_room->exit[door]) != NULL && pexit->u1.to_room != NULL && can_see_room (ch, pexit->u1.to_room)) { if (IS_SET (pexit->exit_info, EX_CLOSED) && IS_SET (pexit->exit_info, EX_SECRET) && !IS_IMMORTAL(ch)) continue; found = TRUE; if (fAuto) { if (!first) strcat (buf, ", "); else first = FALSE; //hack JH 1/25/2004 6:37PM if (IS_SET (pexit->exit_info, EX_CLOSED) && IS_SET (pexit->exit_info, EX_SECRET)) { strcat (buf, "{R({r"); strcat (buf, dir_name[door]); strcat (buf, "{R){o"); } else if (IS_SET (pexit->exit_info, EX_CLOSED)) { strcat (buf, "{Y({y"); strcat (buf, dir_name[door]); strcat (buf, "{Y){o"); } else strcat (buf, dir_name[door]); } else { //Worse hack JH 1/25/2004 6:39PM if (IS_SET (pexit->exit_info, EX_CLOSED) && !IS_IMMORTAL(ch)) continue; sprintf (buf + strlen (buf), "%-5s - {s%s{o", capitalize (dir_name[door]), room_is_dark (pexit->u1.to_room) ? "{DToo dark to tell{o" : pexit->u1.to_room->name); if (IS_IMMORTAL (ch)) { if (IS_SET (pexit->exit_info, EX_CLOSED)) sprintf (buf + strlen (buf)," {Y({ydoor{Y){o"); if (IS_SET (pexit->exit_info, EX_SECRET)) sprintf (buf + strlen (buf)," {R({rsecret{R){o"); sprintf (buf + strlen (buf)," {G(room %d){o\n\r", pexit->u1.to_room->vnum); } else sprintf (buf + strlen (buf), "\n\r"); } } } //strcat (buf, fAuto ? " none" : "None.\n\r"); if (fAuto) strcat (buf, ".{x\n\r"); if (!found) send_to_char ("{oThere are no obvious exits from here.{x\n\r", ch); else send_to_char (buf, ch); return; } void do_worth (CHAR_DATA * ch, char *argument) { char buf[MAX_STRING_LENGTH]; if (IS_NPC (ch)) { sprintf (buf, "You have %ld gold and %ld silver.\n\r", ch->gold, ch->silver); send_to_char (buf, ch); return; } sprintf (buf, "You have %ld gold, %ld silver, and %d experience (%d exp to level).\n\r", ch->gold, ch->silver, ch->exp, ((ch->level + 1) * EXP_PER_LEVEL) - ch->exp); send_to_char (buf, ch); return; } void do_score (CHAR_DATA * ch, char *argument) { char buf[MAX_STRING_LENGTH]; BUFFER *b; int i; b = new_buf(); sprintf (buf, "You are %s%s, level %d, %d years old (%d hours).\n\r", ch->name, IS_NPC (ch) ? "" : ch->pcdata->title, ch->level, get_age (ch), (ch->played + (int) (current_time - ch->logon)) / 3600); send_to_char (buf, ch); if (get_trust (ch) != ch->level) { sprintf (buf, "You are trusted at level %d.\n\r", get_trust (ch)); send_to_char (buf, ch); } sprintf (buf, "Race: %s Sex: %s\n\r", race_table[ch->race].name, ch->sex == 0 ? "sexless" : ch->sex == 1 ? "male" : "female"); send_to_char (buf, ch); sprintf (buf, "You have %d/%d hit, %d/%d movement.\n\r", ch->hit, ch->max_hit, ch->move, ch->max_move); send_to_char (buf, ch); add_buf(b, "You have available "); for (i = 0; i < REAL_MAX_MAGIC_TYPE; i++) { sprintf(buf, "{c%d{x/{C%d{y %s{x", ch->magic_points[i], ch->max_magic_points[i], capitalize(magic_table[i].name)); add_buf(b, buf); i == (REAL_MAX_MAGIC_TYPE -1) ? add_buf(b, ".\n\r") : add_buf(b, ", "); } add_buf(b, "{cMagic levels:\n\r "); for (i = 0; i < REAL_MAX_MAGIC_TYPE; i++) { sprintf(buf, "{C%s{c: {y%d{x ", capitalize(magic_table[i].name), ch->magic_levels[i]); add_buf(b, buf); } add_buf(b, "\n\r"); send_to_char (buf_string(b), ch); free_buf(b); sprintf (buf, "You are carrying %d/%d items with weight %ld/%d pounds.\n\r", ch->carry_number, can_carry_n (ch), get_carry_weight (ch) / 10, can_carry_w (ch) / 10); send_to_char (buf, ch); sprintf (buf, "Str: %d(%d) Int: %d(%d) Dex: %d(%d) Con: %d(%d) Cha: %d(%d)\n\r", ch->perm_stat[STAT_STR], get_curr_stat (ch, STAT_STR), ch->perm_stat[STAT_INT], get_curr_stat (ch, STAT_INT), ch->perm_stat[STAT_DEX], get_curr_stat (ch, STAT_DEX), ch->perm_stat[STAT_CON], get_curr_stat (ch, STAT_CON), ch->perm_stat[STAT_CHA], get_curr_stat (ch, STAT_CHA)); send_to_char (buf, ch); sprintf (buf, "You have scored %d exp, and have %ld gold and %ld silver coins.\n\r", ch->exp, ch->gold, ch->silver); send_to_char (buf, ch); if (!IS_NPC (ch) && ch->level < LEVEL_HERO) { sprintf (buf, "You need %d exp to level.\n\r", ((ch->level + 1) * EXP_PER_LEVEL - ch->exp)); send_to_char (buf, ch); } /*Nope JH 3/26/2004 12:48AM sprintf (buf, "Wimpy set to %d hit points.\n\r", ch->wimpy); send_to_char (buf, ch);*/ if (!IS_NPC (ch) && ch->pcdata->condition[COND_DRUNK] > 10) send_to_char ("You are drunk.\n\r", ch); if (!IS_NPC (ch) && ch->pcdata->condition[COND_THIRST] == 0) send_to_char ("You are thirsty.\n\r", ch); if (!IS_NPC (ch) && ch->pcdata->condition[COND_HUNGER] == 0) send_to_char ("You are hungry.\n\r", ch); switch (ch->position) { case POS_DEAD: send_to_char ("You are DEAD!!\n\r", ch); break; case POS_MORTAL: send_to_char ("You are mortally wounded.\n\r", ch); break; case POS_INCAP: send_to_char ("You are incapacitated.\n\r", ch); break; case POS_STUNNED: send_to_char ("You are stunned.\n\r", ch); break; case POS_SLEEPING: send_to_char ("You are sleeping.\n\r", ch); break; case POS_RESTING: send_to_char ("You are resting.\n\r", ch); break; case POS_ENSCONCED: ch_printf (ch, "You are %s.\n\r", ensconce_flags[ch->ensconce_type].name); break; case POS_STANDING: send_to_char ("You are standing.\n\r", ch); break; case POS_FIGHTING: send_to_char ("You are fighting.\n\r", ch); break; } if (ch->level >= 25) { sprintf (buf, "Armor: pierce: %d bash: %d slash: %d magic: %d\n\r", GET_AC (ch, AC_PIERCE), GET_AC (ch, AC_BASH), GET_AC (ch, AC_SLASH), GET_AC(ch, AC_EXOTIC) ); send_to_char (buf, ch); } for (i = 0; i < 4; i++) { char *temp; switch (i) { case (AC_PIERCE): temp = "piercing"; break; case (AC_BASH): temp = "bashing"; break; case (AC_SLASH): temp = "slashing"; break; case (AC_EXOTIC): temp = "magic"; break; default: temp = "error"; break; } send_to_char ("You are ", ch); if (GET_AC (ch, i) >= 101) sprintf (buf, "hopelessly vulnerable to %s.\n\r", temp); else if (GET_AC (ch, i) >= 80) sprintf (buf, "defenseless against %s.\n\r", temp); else if (GET_AC (ch, i) >= 60) sprintf (buf, "barely protected from %s.\n\r", temp); else if (GET_AC (ch, i) >= 40) sprintf (buf, "slightly armored against %s.\n\r", temp); else if (GET_AC (ch, i) >= 20) sprintf (buf, "somewhat armored against %s.\n\r", temp); else if (GET_AC (ch, i) >= 0) sprintf (buf, "armored against %s.\n\r", temp); else if (GET_AC (ch, i) >= -20) sprintf (buf, "well-armored against %s.\n\r", temp); else if (GET_AC (ch, i) >= -40) sprintf (buf, "very well-armored against %s.\n\r", temp); else if (GET_AC (ch, i) >= -60) sprintf (buf, "heavily armored against %s.\n\r", temp); else if (GET_AC (ch, i) >= -80) sprintf (buf, "superbly armored against %s.\n\r", temp); else if (GET_AC (ch, i) >= -100) sprintf (buf, "almost invulnerable to %s.\n\r", temp); else sprintf (buf, "divinely armored against %s.\n\r", temp); send_to_char (buf, ch); } if (IS_IMMORTAL (ch)) { send_to_char ("Holy Light: ", ch); if (IS_SET (ch->act, PLR_HOLYLIGHT)) send_to_char ("on", ch); else send_to_char ("off", ch); if (ch->invis_level) { sprintf (buf, " Invisible: level %d", ch->invis_level); send_to_char (buf, ch); } if (ch->incog_level) { sprintf (buf, " Incognito: level %d", ch->incog_level); send_to_char (buf, ch); } send_to_char ("\n\r", ch); } ch_printf(ch, "Perception: %d Will: %d Reflex: %d\n\r", ch->perception, ch->will, ch->reflex); /* if (ch->level >= 15) { sprintf (buf, "Hitroll: %d Damroll: %d.\n\r", GET_HITROLL (ch), GET_DAMROLL (ch)); send_to_char (buf, ch); } */ if (IS_SET (ch->comm, COMM_SHOW_AFFECTS)) do_function (ch, &do_affects, ""); } void do_affects (CHAR_DATA * ch, char *argument) { AFFECT_DATA *paf, *paf_last = NULL; char buf[MAX_STRING_LENGTH]; if (ch->affected != NULL) { send_to_char ("You are affected by the following spells:\n\r", ch); for (paf = ch->affected; paf != NULL; paf = paf->next) { //quick fixme one-liner just for now if (paf->type < 0 || paf->type >= SkillTable.size()) continue; if (paf_last != NULL && paf->type == paf_last->type) sprintf (buf, " "); else sprintf (buf, "Spell: %-15s", SkillTable[paf->type].name.c_str()); send_to_char (buf, ch); //ch_printf (ch, " paf->type: %d ", paf->type); sprintf (buf, ": modifies %s by %d ", affect_loc_name (paf->location), paf->modifier); send_to_char (buf, ch); if (paf->duration == -1) sprintf (buf, "permanently"); else sprintf (buf, "for %d seconds", paf->duration); send_to_char (buf, ch); send_to_char ("\n\r", ch); paf_last = paf; } } else send_to_char ("You are not affected by any spells.\n\r", ch); return; } char *const day_name[] = { "the Moon", "the Bull", "Deception", "Thunder", "Freedom", "the Great Gods", "the Sun" }; char *const month_name[] = { "Winter", "the Winter Wolf", "the Frost Giant", "the Old Forces", "the Grand Struggle", "the Spring", "Nature", "Futility", "the Dragon", "the Sun", "the Heat", "the Battle", "the Dark Shades", "the Shadows", "the Long Shadows", "the Ancient Darkness", "the Great Evil" }; void do_time (CHAR_DATA * ch, char *argument) { extern char str_boot_time[]; char buf[MAX_STRING_LENGTH]; char *suf; int day; day = time_info.day + 1; if (day > 4 && day < 20) suf = "th"; else if (day % 10 == 1) suf = "st"; else if (day % 10 == 2) suf = "nd"; else if (day % 10 == 3) suf = "rd"; else suf = "th"; sprintf (buf, "It is %d o'clock %s, Day of %s, %d%s the Month of %s.\n\r", (time_info.hour % 12 == 0) ? 12 : time_info.hour % 12, time_info.hour >= 12 ? "pm" : "am", day_name[day % 7], day, suf, month_name[time_info.month]); send_to_char (buf, ch); sprintf (buf, "ROM started up at %s\n\rThe system time is %s.\n\r", str_boot_time, (char *) ctime (¤t_time)); send_to_char (buf, ch); return; } void do_weather (CHAR_DATA * ch, char *argument) { char buf[MAX_STRING_LENGTH]; static char *const sky_look[4] = { "cloudless", "cloudy", "rainy", "lit by flashes of lightning" }; if (!IS_OUTSIDE (ch)) { send_to_char ("You can't see the weather indoors.\n\r", ch); return; } sprintf (buf, "The sky is %s and %s.\n\r", sky_look[weather_info.sky], weather_info.change >= 0 ? "a warm southerly breeze blows" : "a cold northern gust blows"); send_to_char (buf, ch); return; } /* whois command */ void do_whois (CHAR_DATA * ch, char *argument) { char arg[MAX_INPUT_LENGTH]; BUFFER *output; char buf[MAX_STRING_LENGTH]; DESCRIPTOR_DATA *d; bool found = FALSE; one_argument (argument, arg); if (arg[0] == '\0') { send_to_char ("You must provide a name.\n\r", ch); return; } output = new_buf (); for (d = descriptor_list; d != NULL; d = d->next) { CHAR_DATA *wch; char const *lvltype; if (d->connected != CON_PLAYING || !can_see (ch, d->character)) continue; wch = (d->original != NULL) ? d->original : d->character; if (!can_see (ch, wch)) continue; if (!str_prefix (arg, wch->name)) { found = TRUE; /* work out the printing */ switch (wch->level) { case MAX_LEVEL - 0: lvltype = "IMP"; break; case MAX_LEVEL - 1: lvltype = "CRE"; break; case MAX_LEVEL - 2: lvltype = "SUP"; break; case MAX_LEVEL - 3: lvltype = "DEI"; break; case MAX_LEVEL - 4: lvltype = "GOD"; break; case MAX_LEVEL - 5: lvltype = "IMM"; break; case MAX_LEVEL - 6: lvltype = "DEM"; break; case MAX_LEVEL - 7: lvltype = "ANG"; break; case MAX_LEVEL - 8: lvltype = "AVA"; break; default: lvltype = "PLR"; break; } /* a little formatting */ sprintf (buf, "[%2d %6s %s] %s%s%s%s%s%s%s%s\n\r", wch->level, wch->race < MAX_PC_RACE ? pc_race_table[wch-> race].who_name : " ", lvltype, wch->incog_level >= LEVEL_HERO ? "(Incog) " : "", wch->invis_level >= LEVEL_HERO ? "(Wizi) " : "", clan_table[wch->clan].who_name, IS_SET (wch->comm, COMM_AFK) ? "[AFK] " : "", IS_SET (wch->act, PLR_KILLER) ? "(KILLER) " : "", IS_SET (wch->act, PLR_THIEF) ? "(THIEF) " : "", wch->name, IS_NPC (wch) ? "" : wch->pcdata->title); add_buf (output, buf); } } if (!found) { send_to_char ("No one of that name is playing.\n\r", ch); return; } page_to_char (buf_string (output), ch); free_buf (output); } /* * New 'who' command originally by Alander of Rivers of Mud. */ void do_who (CHAR_DATA * ch, char *argument) { char buf[MAX_STRING_LENGTH]; char buf2[MAX_STRING_LENGTH]; BUFFER *output; DESCRIPTOR_DATA *d; int iRace; int iClan; int iLevelLower; int iLevelUpper; int nNumber; int nMatch; bool rgfRace[MAX_PC_RACE]; bool rgfClan[MAX_CLAN]; bool fClanRestrict = FALSE; bool fClan = FALSE; bool fRaceRestrict = FALSE; bool fImmortalOnly = FALSE; /* * Set default arguments. */ iLevelLower = 0; iLevelUpper = MAX_LEVEL; for (iRace = 0; iRace < MAX_PC_RACE; iRace++) rgfRace[iRace] = FALSE; for (iClan = 0; iClan < MAX_CLAN; iClan++) rgfClan[iClan] = FALSE; /* * Parse arguments. */ nNumber = 0; for (;;) { char arg[MAX_STRING_LENGTH]; argument = one_argument (argument, arg); if (arg[0] == '\0') break; if (is_number (arg)) { switch (++nNumber) { case 1: iLevelLower = atoi (arg); break; case 2: iLevelUpper = atoi (arg); break; default: send_to_char ("Only two level numbers allowed.\n\r", ch); return; } } } /* * Now show matching chars. */ nMatch = 0; buf[0] = '\0'; output = new_buf (); send_to_char(" {W={w={B[{wSkuLL{B]{w={W={x\n\r", ch); send_to_char("{w&{W&{w&{D&{w&{W&{w&{D&{w&{W&{w&{D&{w&{W&{w&{D&{w&{W&{w&{D&{w&{W&{w&{D&{w&{W&" "{w&{D&{w&{W&{w&{D&{w&{W&{w&{D&{w&{W&{w&{D&{w&{W&{w&{D&{w&{W&{w&{D&{w&{W&{w&{D&" "{w&{W&{w&{D&{w&{W&{w&{D&{w&{W&{w&{D&{w&{W&{w&{D&{w&{W&{w&{D&{w&{W&{w&{D&{w&{W&" "{w&{D&{w&{x\n\r", ch); for (d = descriptor_list; d != NULL; d = d->next) { CHAR_DATA *wch; /* * Check for match against restrictions. * Don't use trust as that exposes trusted mortals. */ if ((d->connected != CON_PLAYING && !(d->connected >= CON_NOTE_TO && d->connected <= CON_NOTE_FINISH)) || !can_see (ch, d->character)) continue; wch = (d->original != NULL) ? d->original : d->character; if (!can_see (ch, wch)) continue; if (wch->level < iLevelLower || wch->level > iLevelUpper || (fImmortalOnly && wch->level < LEVEL_IMMORTAL) || (fRaceRestrict && !rgfRace[wch->race]) || (fClan && !is_clan (wch)) || (fClanRestrict && !rgfClan[wch->clan])) continue; nMatch++; /* * Format it up. */ sprintf (buf, "/%2d %6s/ %s%s%s%s%s%s%s%s%s\n\r", wch->level, wch->race < MAX_PC_RACE ? pc_race_table[wch->race].who_name : " ", (d->pString) ? "{Y<{yediting{Y>{x " : "", wch->incog_level >= LEVEL_HERO ? "({DIncog{x) " : "", wch->invis_level >= LEVEL_HERO ? "{R({rWizi{R){x " : "", clan_table[wch->clan].who_name, IS_SET (wch->comm, COMM_AFK) ? "{B[{CAFK{B]{x " : "", IS_SET (wch->act, PLR_KILLER) ? "{r({RKILLER{r){x " : "", IS_SET (wch->act, PLR_THIEF) ? "{D({MTHIEF{D){x " : "", wch->name, IS_NPC (wch) ? "" : wch->pcdata->title); add_buf (output, buf); } sprintf (buf2, "\n\rPlayers found: %d\n\r", nMatch); add_buf (output, buf2); page_to_char (buf_string (output), ch); free_buf (output); if (mud.ispoll) send_to_char("\n\r{DThere is a poll running--'vote' to vote.{x\n\r", ch); return; } void do_count (CHAR_DATA * ch, char *argument) { int count; DESCRIPTOR_DATA *d; char buf[MAX_STRING_LENGTH]; count = 0; for (d = descriptor_list; d != NULL; d = d->next) if (d->connected == CON_PLAYING && can_see (ch, d->character)) count++; max_on = UMAX (count, max_on); if (max_on == count) sprintf (buf, "There are %d characters on, the most so far today.\n\r", count); else sprintf (buf, "There are %d characters on, the most on today was %d.\n\r", count, max_on); send_to_char (buf, ch); } void do_inventory (CHAR_DATA * ch, char *argument) { send_to_char ("You are carrying:\n\r", ch); show_list_to_char (ch->carrying, ch, TRUE, TRUE); return; } void do_equipment (CHAR_DATA * ch, char *argument) { OBJ_DATA *obj; int iWear; bool found; send_to_char ("You are using:\n\r", ch); found = FALSE; for (iWear = 0; iWear < MAX_WEAR; iWear++) { if ((obj = get_eq_char (ch, iWear)) == NULL) continue; send_to_char (where_name[iWear], ch); if (can_see_obj (ch, obj)) { send_to_char (format_obj_to_char (obj, ch, TRUE), ch); send_to_char ("\n\r", ch); } else { send_to_char ("something.\n\r", ch); } found = TRUE; } if (!found) send_to_char ("Nothing.\n\r", ch); return; } void do_compare (CHAR_DATA * ch, char *argument) { char arg1[MAX_INPUT_LENGTH]; char arg2[MAX_INPUT_LENGTH]; OBJ_DATA *obj1; OBJ_DATA *obj2; int value1; int value2; char *msg; argument = one_argument (argument, arg1); argument = one_argument (argument, arg2); if (arg1[0] == '\0') { send_to_char ("Compare what to what?\n\r", ch); return; } if ((obj1 = get_obj_carry (ch, arg1, ch)) == NULL) { send_to_char ("You do not have that item.\n\r", ch); return; } if (arg2[0] == '\0') { for (obj2 = ch->carrying; obj2 != NULL; obj2 = obj2->next_content) { if (obj2->wear_loc != WEAR_NONE && can_see_obj (ch, obj2) && obj1->item_type == obj2->item_type && (obj1->wear_flags & obj2->wear_flags & ~ITEM_TAKE) != 0) break; } if (obj2 == NULL) { send_to_char ("You aren't wearing anything comparable.\n\r", ch); return; } } else if ((obj2 = get_obj_carry (ch, arg2, ch)) == NULL) { send_to_char ("You do not have that item.\n\r", ch); return; } msg = NULL; value1 = 0; value2 = 0; if (obj1 == obj2) { msg = "You compare $p to itself. It looks about the same."; } else if (obj1->item_type != obj2->item_type) { msg = "You can't compare $p and $P."; } else { switch (obj1->item_type) { default: msg = "You can't compare $p and $P."; break; case ITEM_ARMOR: value1 = obj1->value[0] + obj1->value[1] + obj1->value[2]; value2 = obj2->value[0] + obj2->value[1] + obj2->value[2]; break; case ITEM_WEAPON: if (obj1->pIndexData->new_format) value1 = (1 + obj1->value[2]) * obj1->value[1]; else value1 = obj1->value[1] + obj1->value[2]; if (obj2->pIndexData->new_format) value2 = (1 + obj2->value[2]) * obj2->value[1]; else value2 = obj2->value[1] + obj2->value[2]; break; } } if (msg == NULL) { if (value1 == value2) msg = "$p and $P look about the same."; else if (value1 > value2) msg = "$p looks better than $P."; else msg = "$p looks worse than $P."; } act (msg, ch, obj1, obj2, TO_CHAR); return; } void do_credits (CHAR_DATA * ch, char *argument) { do_function (ch, &do_oldhelp, "diku"); return; } void do_where (CHAR_DATA * ch, char *argument) { char buf[MAX_STRING_LENGTH]; char arg[MAX_INPUT_LENGTH]; CHAR_DATA *victim; DESCRIPTOR_DATA *d; bool found; one_argument (argument, arg); if (arg[0] == '\0') { send_to_char ("Players near you:\n\r", ch); found = FALSE; for (d = descriptor_list; d; d = d->next) { if (d->connected == CON_PLAYING && (victim = d->character) != NULL && !IS_NPC (victim) && victim->in_room != NULL && !IS_SET (victim->in_room->room_flags, ROOM_NOWHERE) && (is_room_owner (ch, victim->in_room) || !room_is_private (victim->in_room)) && victim->in_room->area == ch->in_room->area && can_see (ch, victim)) { found = TRUE; sprintf (buf, "%-28s %s\n\r", victim->name, victim->in_room->name); send_to_char (buf, ch); } } if (!found) send_to_char ("None\n\r", ch); } else { found = FALSE; for (victim = char_list; victim != NULL; victim = victim->next) { if (victim->in_room != NULL && victim->in_room->area == ch->in_room->area && !IS_AFFECTED (victim, AFF_HIDE) && !IS_AFFECTED (victim, AFF_SNEAK) && can_see (ch, victim) && is_name (arg, victim->name)) { found = TRUE; sprintf (buf, "%-28s %s\n\r", PERS (victim, ch), victim->in_room->name); send_to_char (buf, ch); break; } } if (!found) act ("You didn't find any $T.", ch, NULL, arg, TO_CHAR); } return; } void do_consider (CHAR_DATA * ch, char *argument) { char arg[MAX_INPUT_LENGTH]; CHAR_DATA *victim; char *msg; int diff; one_argument (argument, arg); if (arg[0] == '\0') { send_to_char ("Consider killing whom?\n\r", ch); return; } if ((victim = get_char_room (ch, NULL, arg)) == NULL) { send_to_char ("They're not here.\n\r", ch); return; } if (is_safe (ch, victim)) { send_to_char ("Don't even think about it.\n\r", ch); return; } diff = victim->level - ch->level; if (diff <= -10) msg = "You can kill $N naked and weaponless."; else if (diff <= -5) msg = "$N is no match for you."; else if (diff <= -2) msg = "$N looks like an easy kill."; else if (diff <= 1) msg = "The perfect match!"; else if (diff <= 4) msg = "$N says 'Do you feel lucky, punk?'."; else if (diff <= 9) msg = "$N laughs at you mercilessly."; else msg = "Death will thank you for your gift."; act (msg, ch, NULL, victim, TO_CHAR); return; } void set_title (CHAR_DATA * ch, char *title) { char buf[MAX_STRING_LENGTH]; if (IS_NPC (ch)) { bug ("Set_title: NPC.", 0); return; } if (title[0] != '.' && title[0] != ',' && title[0] != '!' && title[0] != '?') { buf[0] = ' '; strcpy (buf + 1, title); } else { strcpy (buf, title); } free_string (ch->pcdata->title); ch->pcdata->title = str_dup (buf); return; } void do_title (CHAR_DATA * ch, char *argument) { int i; if (IS_NPC (ch)) return; /* Changed this around a bit to do some sanitization first * * before checking length of the title. Need to come up with * * a centralized user input sanitization scheme. FIXME! * * JR -- 10/15/00 */ if (strlen (argument) > 45) argument[45] = '\0'; i = strlen(argument); if (argument[i-1] == '{' && argument[i-2] != '{') argument[i-1] = '\0'; if (argument[0] == '\0') { send_to_char ("Change your title to what?\n\r", ch); return; } smash_tilde (argument); set_title (ch, argument); send_to_char ("Ok.\n\r", ch); } void do_description (CHAR_DATA * ch, char *argument) { char buf[MAX_STRING_LENGTH]; if (argument[0] != '\0') { buf[0] = '\0'; smash_tilde (argument); if (argument[0] == '-') { int len; bool found = FALSE; if (ch->description == NULL || ch->description[0] == '\0') { send_to_char ("No lines left to remove.\n\r", ch); return; } strcpy (buf, ch->description); for (len = strlen (buf); len > 0; len--) { if (buf[len] == '\r') { if (!found) { /* back it up */ if (len > 0) len--; found = TRUE; } else { /* found the second one */ buf[len + 1] = '\0'; free_string (ch->description); ch->description = str_dup (buf); send_to_char ("Your description is:\n\r", ch); send_to_char (ch->description ? ch->description : "(None).\n\r", ch); return; } } } buf[0] = '\0'; free_string (ch->description); ch->description = str_dup (buf); send_to_char ("Description cleared.\n\r", ch); return; } if (argument[0] == '+') { if (ch->description != NULL) strcat (buf, ch->description); argument++; while (isspace (*argument)) argument++; } if (strlen (buf) >= 1024) { send_to_char ("Description too long.\n\r", ch); return; } strcat (buf, argument); strcat (buf, "\n\r"); free_string (ch->description); ch->description = str_dup (buf); } send_to_char ("Your description is:\n\r", ch); send_to_char (ch->description ? ch->description : "(None).\n\r", ch); return; } void do_panic (CHAR_DATA *ch, char *argument) { EVENT *ev, *ev_next; send_to_char("MUD's events:\n\r\n\r", ch); if (!events) { send_to_char("No events.\n\r", ch); return; } send_to_char("-----------------------------------------------------------------\n\r", ch); for (ev = events; ev; ev = ev->next) { ch_printf(ch, "Event comments: %s Event delay: %d seconds\n\r", ev->comments, ev->delay); } send_to_char("-----------------------------------------------------------------\n\r", ch); /*send_to_char("Prototype menus:\n\r\n\r", ch); for (menu = menu_list; menu; menu = menu->next) { sprintf(buf, "Menu Prototype: %s\n\r", menu->name); send_to_char(buf, ch); }*/ send_to_char("<Killing events>\n\r", ch); for(ev = events; ev; ev = ev_next) { ev_next = ev->next; if (ev == events) events = NULL; free_event(ev); } return; } void do_events (CHAR_DATA *ch, char *argument) { EVENT *ev; send_to_char("MUD's events:\n\r\n\r", ch); if (!events) { send_to_char("No events.\n\r", ch); return; } send_to_char("-----------------------------------------------------------------\n\r", ch); for (ev = events; ev; ev = ev->next) { ch_printf(ch, "Event comments: %s Event delay: %d seconds\n\r", ev->comments, ev->delay); } send_to_char("-----------------------------------------------------------------\n\r", ch); return; } void do_menus (CHAR_DATA *ch, char *argument) { char buf[MSL]; MENU_DATA *menu; //MENU_DATA *menu_next; OPTION_DATA *option; *buf = '\0'; send_to_char("Your menus:\n\r\n\r", ch); for (menu = ch->pcdata->menu; menu; menu = menu->next) { send_to_char("-----------------------------------------------------------------\n\r", ch); sprintf(buf, "Menu: %s\n\r", menu->name); send_to_char(buf, ch); for (option = menu->option; option; option = option->next) { sprintf(buf, "Option %d: %s\n\r", option->key, option->args[0]); send_to_char(buf, ch); } } /*send_to_char("(Killing your menus now)\n\r", ch); for (menu = ch->pcdata->menu; menu; menu = menu_next) { menu_next = menu->next; menu_from_char(ch, menu); send_to_char("Menu cleared\n\r", ch); }*/ send_to_char("-----------------------------------------------------------------\n\r", ch); send_to_char("Prototype menus (MUD menus):\n\r\n\r", ch); for (menu = menu_list; menu; menu = menu->next) { sprintf(buf, "Menu Prototype: %s\n\r", menu->name); send_to_char(buf, ch); } return; } void do_report (CHAR_DATA * ch, char *argument) { //send_to_char("In 10 seconds, you'll see 'Hello sir! How are you?'\n\r", ch); //print_event(ch, 10, "Hello sir! How are you?\n\r"); ch_printf(ch, "Report was hijacked for Tamraine's nefarious purposes. Type report with an arg.\n\r"); if (argument[0]) { ch_printf(ch, "\n\rInfecting you with [Skull] for 70 seconds (1/2 ingame hour)...\n\r"); AFFECT_DATA af; af.where = TO_AFFECTS; af.type = 0; //gsn_skull; af.level = ch->level; af.duration = 70; af.location = APPLY_NONE; af.modifier = 0; af.bitvector = 0; affect_to_char (ch, &af); } /* char *moocow; char buf_first[MSL]; strcpy(buf, "if %actor.str% > 10"); ch_printf(ch, "Passing in: %s\n\r", buf); moocow = first_arg(buf, buf_first, FALSE); ch_printf(ch, "Here's the results:\n\rmoocow: %s\n\rbuf_first: %s\n\rbuf: %s\n\r\n\r", moocow,buf_first,buf); ch_printf(ch, "Moving along...\n\r"); while (*moocow != '\0') { moocow = first_arg(moocow, buf_first, FALSE); ch_printf(ch, "Here's the results:\n\rmoocow: %s\n\rbuf_first: %s\n\r\n\r", moocow,buf_first); } */ /*char buf[MSL]; MENU_DATA *menu; MENU_DATA *menu_next; OPTION_DATA *option; *buf = '\0'; send_to_char("Your menus:\n\r\n\r", ch); for (menu = ch->pcdata->menu; menu; menu = menu->next) { send_to_char("-----------------------------------------------------------------\n\r", ch); sprintf(buf, "Menu: %s\n\r", menu->name); send_to_char(buf, ch); for (option = menu->option; option; option = option->next) { sprintf(buf, "Option %d: %s\n\r", option->key, option->args[0]); send_to_char(buf, ch); } }*/ /*send_to_char("(Killing your menus now)\n\r", ch); for (menu = ch->pcdata->menu; menu; menu = menu_next) { menu_next = menu->next; menu_from_char(ch, menu); send_to_char("Menu cleared\n\r", ch); }*/ /*send_to_char("MUD's events:\n\r\n\r", ch); EVENT *ev; send_to_char("-----------------------------------------------------------------\n\r", ch); for (ev = events; ev; ev = ev->next) { ch_printf(ch, "Ev action type: %d Ev delay: %d seconds\n\r", ev->action, ev->delay); }*/ /*send_to_char("-----------------------------------------------------------------\n\r", ch); send_to_char("Prototype menus:\n\r\n\r", ch); for (menu = menu_list; menu; menu = menu->next) { sprintf(buf, "Menu Prototype: %s\n\r", menu->name); send_to_char(buf, ch); }*/ //send_to_char("Your menu:\n\r", ch); /*send_to_char("In report...\n\r", ch); if (ch->pcdata->menu != NULL) { sprintf(buf, "Name: %s Address of function: %p ", ch->pcdata->menu->name, ch->pcdata->menu->fun_call); //sprintf(buf, "Address of do_buy: %p\n\r", &do_buy); for (cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++) { sprintf(dbg, "Address of cmd #%d: %p\n\r", cmd, cmd_table[cmd].do_fun); send_to_char(dbg, ch); if (*cmd_table[cmd].fun_call == *ch->pcdata->menu->fun_call) { send_to_char("Memory match!\n\r", ch); sprintf(smbuf, "(Name of function: %s)\n\r", cmd_table[cmd].name); strcat(buf, smbuf); } } send_to_char(buf, ch); } else send_to_char("(none)\n\r", ch);*/ /* char buf[MAX_INPUT_LENGTH]; sprintf (buf, "You say 'I have %d/%d hp %d/%d mv %d xp.'\n\r", ch->hit, ch->max_hit, ch->move, ch->max_move, ch->exp); send_to_char (buf, ch); sprintf (buf, "$n says 'I have %d/%d hp %d/%d mv %d xp.'", ch->hit, ch->max_hit, ch->move, ch->max_move, ch->exp); act (buf, ch, NULL, NULL, TO_ROOM); */ return; } void do_password (CHAR_DATA * ch, char *argument) { char arg1[MAX_INPUT_LENGTH]; char arg2[MAX_INPUT_LENGTH]; char *pArg; char *pwdnew; char *p; char cEnd; if (IS_NPC (ch)) return; /* * Can't use one_argument here because it smashes case. * So we just steal all its code. Bleagh. */ pArg = arg1; while (isspace (*argument)) argument++; cEnd = ' '; if (*argument == '\'' || *argument == '"') cEnd = *argument++; while (*argument != '\0') { if (*argument == cEnd) { argument++; break; } *pArg++ = *argument++; } *pArg = '\0'; pArg = arg2; while (isspace (*argument)) argument++; cEnd = ' '; if (*argument == '\'' || *argument == '"') cEnd = *argument++; while (*argument != '\0') { if (*argument == cEnd) { argument++; break; } *pArg++ = *argument++; } *pArg = '\0'; if (arg1[0] == '\0' || arg2[0] == '\0') { send_to_char ("Syntax: password <old> <new>.\n\r", ch); return; } if (strcmp (crypt (arg1, ch->pcdata->pwd), ch->pcdata->pwd)) { WAIT_STATE (ch, 40); send_to_char ("Wrong password. Wait 10 seconds.\n\r", ch); return; } if (strlen (arg2) < 5) { send_to_char ("New password must be at least five characters long.\n\r", ch); return; } /* * No tilde allowed because of player file format. */ pwdnew = crypt (arg2, ch->name); for (p = pwdnew; *p != '\0'; p++) { if (*p == '~') { send_to_char ("New password not acceptable, try again.\n\r", ch); return; } } free_string (ch->pcdata->pwd); ch->pcdata->pwd = str_dup (pwdnew); save_char_obj (ch); send_to_char ("Ok.\n\r", ch); return; } void do_telnetga (CHAR_DATA * ch, char *argument) { if (IS_NPC (ch)) return; if (IS_SET (ch->comm, COMM_TELNET_GA)) { send_to_char ("Telnet GA removed.\n\r", ch); REMOVE_BIT (ch->comm, COMM_TELNET_GA); } else { send_to_char ("Telnet GA enabled.\n\r", ch); SET_BIT (ch->comm, COMM_TELNET_GA); } }