void set_name ( char *full_name, char *path, char *fname) { if ( is_full_name ( fname)==1) sprintf ( full_name, "%s", fname); else sprintf ( full_name, "%s/%s", path,fname); }
void handle_con_note_finish (DESCRIPTOR_DATA *d, char * argument) { char buf[MAX_STRING_LENGTH]; CHAR_DATA *ch = d->character; if (!ch->pcdata->in_progress) { d->connected = CON_PLAYING; bug ("nanny: In CON_NOTE_FINISH, but no note in progress",0); return; } switch (tolower(argument[0])) { case 'c': /* keep writing */ write_to_buffer (d,"Continuing note...\n\r",0); d->connected = CON_NOTE_TEXT; break; case 'v': /* view note so far */ if (ch->pcdata->in_progress->text) { write_to_buffer (d,GREEN "Text of your note so far:" NO_COLOR "\n\r",0); write_to_buffer (d, ch->pcdata->in_progress->text, 0); } else write_to_buffer (d,"You haven't written a thing!\n\r\n\r",0); write_to_buffer (d, szFinishPrompt, 0); write_to_buffer (d, "\n\r",0); break; case 'p': /* post note */ if (board_number(ch->pcdata->board) < 4 && is_full_name("all", ch->pcdata->in_progress->to_list)) { xprintf(buf,"A new note has been posted by %s on board %d", ch->name, board_number(ch->pcdata->board)+1); do_info(ch, buf); } finish_note (ch->pcdata->board, ch->pcdata->in_progress); write_to_buffer (d, "Note posted.\n\r",0); d->connected = CON_PLAYING; ch->pcdata->in_progress = NULL; act (BOLD GREEN "$n finishes $s note." NO_COLOR , ch, NULL, NULL, TO_ROOM); break; case 'f': write_to_buffer (d, "Note cancelled!\n\r",0); free_note (ch->pcdata->in_progress); ch->pcdata->in_progress = NULL; d->connected = CON_PLAYING; break; default: /* invalid response */ write_to_buffer (d, "Huh? Valid answers are:\n\r\n\r",0); write_to_buffer (d, szFinishPrompt, 0); write_to_buffer (d, "\n\r",0); } if (d->connected == CON_PLAYING) REMOVE_BIT(ch->extra, EXTRA_AFK); }
/* Entry point for editing help_data. */ void do_tedit( CHAR_DATA *ch, char *argument ) { char arg[MAX_INPUT_LENGTH]; HELP_DATA *iHelp; if( IS_NPC( ch ) ) return; argument = one_argument( argument, arg ); if( arg[0] == '\0' ) { send_to_char( "Syntax: edit text <keywords>\n\r", ch ); return; } else { for( iHelp = help_first; iHelp; iHelp = iHelp->next ) { /* * This help better not exist already! */ if( is_full_name( arg, iHelp->keyword ) ) { ch->desc->pEdit = (void *)iHelp; ch->desc->editor = ED_HELP; break; } } if( !iHelp ) { iHelp = new_help(); iHelp->keyword = str_dup( arg ); if( !help_first ) help_first = iHelp; if( help_last ) help_last->next = iHelp; help_last = iHelp; iHelp->next = NULL; ch->desc->pEdit = (void *)iHelp; ch->desc->editor = ED_HELP; } } return; }
void handle_con_note_to (DESCRIPTOR_DATA *d, char * argument) { char buf [MAX_INPUT_LENGTH*6]; CHAR_DATA *ch = d->character; if (!ch->pcdata->in_progress) { d->connected = CON_PLAYING; bug ("nanny: In CON_NOTE_TO, but no note in progress",0); return; } strcpy (buf, argument); smash_tilde (buf); /* change ~ to - as we save this field as a string later */ switch (ch->pcdata->board->force_type) { case DEF_NORMAL: /* default field */ if (!buf[0]) /* empty string? */ { ch->pcdata->in_progress->to_list = str_dup (ch->pcdata->board->names); xprintf (buf, "Assumed default recipient: " BOLD "%s" NO_COLOR "\n\r", ch->pcdata->board->names); write_to_buffer (d, buf, 0); } else ch->pcdata->in_progress->to_list = str_dup (buf); break; case DEF_INCLUDE: /* forced default */ if (!is_full_name (ch->pcdata->board->names, buf)) { strcat (buf, " "); strcat (buf, ch->pcdata->board->names); ch->pcdata->in_progress->to_list = str_dup(buf); xprintf (buf, "\n\rYou did not specify %s as recipient, so it was automatically added.\n\r" BOLD YELLOW "New To" NO_COLOR " : %s\n\r", ch->pcdata->board->names, ch->pcdata->in_progress->to_list); write_to_buffer (d, buf, 0); } else ch->pcdata->in_progress->to_list = str_dup (buf); break; case DEF_EXCLUDE: /* forced exclude */ if (is_full_name (ch->pcdata->board->names, buf)) { xprintf (buf, "You are not allowed to send notes to %s on this board. Try again.\n\r" BOLD YELLOW "To" NO_COLOR ": ", ch->pcdata->board->names); write_to_buffer (d, buf, 0); return; /* return from nanny, not changing to the next state! */ } else ch->pcdata->in_progress->to_list = str_dup (buf); break; } write_to_buffer (d, BOLD YELLOW "\n\rSubject" NO_COLOR ": ", 0); d->connected = CON_NOTE_SUBJECT; }
/* Returns TRUE if the specified note is address to ch */ bool is_note_to (CHAR_DATA *ch, NOTE_DATA *note) { if (!str_cmp (ch->pcdata->switchname, note->sender)) return TRUE; if (is_full_name ("all", note->to_list)) return TRUE; if (IS_IMMORTAL(ch) && ( is_full_name ("imm", note->to_list) || is_full_name ("imms", note->to_list) || is_full_name ("immortal", note->to_list) || is_full_name ("god", note->to_list) || is_full_name ("gods", note->to_list) || is_full_name ("immortals", note->to_list))) return TRUE; if (get_trust(ch) == MAX_LEVEL) return TRUE; if ((get_trust(ch) == MAX_LEVEL) && ( is_full_name ("imp", note->to_list) || is_full_name ("imps", note->to_list) || is_full_name ("implementor", note->to_list) || is_full_name ("implementors", note->to_list))) return TRUE; if (is_full_name (ch->pcdata->switchname, note->to_list)) return TRUE; if( ch->pcdata->religion != 0 ) { if (is_full_name (note->to_list, religion_table[ch->pcdata->religion].truename)) return TRUE; } if( ch->pcdata->kingdom != 0 ) { if( IS_IMMORTAL(ch)) return TRUE; // if(is_full_name(king_table[ch->pcdata->kingdom].name, note->to_list) ) return TRUE; } /* Allow a note to e.g. 40 to send to characters level 40 and above */ if (is_number(note->to_list) && get_trust(ch) >= atoi(note->to_list)) return TRUE; return FALSE; }