#include <sys/types.h> #include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include "emlen.h" #ifndef WINDOWS #include <sys/time.h> #endif char *chan[2][30][MAX_SCROLLBACK]; short chan_count[2][30]; void talk_channel (CHAR_DATA * ch, char *argy, int channel, const char *verb); void super_channel_function (char *name, int align, int level, char *argy, CHANNEL * c, int channel, int cnum); #define ENDMARKER "^^" char *java_color(char *c) { static char tt[50]; char *t; for (t=c; *t!='\0'; t++) { if (*t>='1' && *t<='9') { tt[0]=*t; tt[1]='\0'; return tt; } } return "7"; } void check_rit (DESCRIPTOR_DATA * d, char *argy) { #ifndef WINDOWS DESCRIPTOR_DATA *e; DESCRIPTOR_DATA *e_next; #endif return; } void rlagit (CHAR_DATA * ch, char *argy) { DESCRIPTOR_DATA *d = NULL; char to[500]; char to_place[100]; int i; DEFINE_COMMAND ("rlagit", rlagit, POSITION_DEAD, 110, LOG_NORMAL, "Tests lag state.") argy = one_argy (argy, to_place); for (i = 0; i < 5; i++) { if (connectiond[i] != NULL && !str_cmp (to_place, connection_names[i])) d = connectiond[i]; } if (!d) { send_to_char ("That remote site was not found!\n\r", ch); return; } /* doesn't do anything now */ send_to_char ("Linkage test working...done.\n\r", ch); return; } void rdoit (CHAR_DATA * ch, char *argy) { DESCRIPTOR_DATA *d = NULL; char to[500]; char to_place[100]; int i; DEFINE_COMMAND ("rdoit", rdoit, POSITION_DEAD, 110, LOG_NORMAL, "None.") argy = one_argy (argy, to_place); for (i = 0; i < 5; i++) { if (connectiond[i] != NULL && !str_cmp (to_place, connection_names[i])) d = connectiond[i]; } if (!d) { send_to_char ("That remote site was not found!\n\r", ch); return; } return; } /* Syntax is: $$<I/V> <show_to> <level> <from> <message> $$X <show_to> = player was not found/not vis. */ void do_rtell (CHAR_DATA * ch, char *argy) { char buf[1000]; DESCRIPTOR_DATA *d; char to[500]; char to_place[100]; int i; DEFINE_COMMAND ("rtell", do_rtell, POSITION_DEAD, 110, LOG_NORMAL, "This allows you to send remote tells.") to_place[0] = '\0'; argy = one_argy (argy, to_place); if (strlen (to_place) != 3) { send_to_char ("You must specify RTELL <to place> <to person> <message>.\n\r", ch); return; } argy = one_argy (argy, to); if (to[0] == '\0') { send_to_char ("To whom?\n\r", ch); return; } d = NULL; for (i = 0; i < 5; i++) { if (connectiond[i] != NULL && !str_cmp (to_place, connection_names[i])) d = connectiond[i]; } if (!d) { send_to_char ("That remote site was not found!\n\r", ch); return; } sprintf (buf, "$$%s %s %d %s %s\n\r", ch->pcdata->wizinvis > 10 ? "I" : "V", to, LEVEL (ch), NAME (ch), argy); write_to_descriptor2 (d, buf, 0); send_to_char ("Remote tell sent.\n\r", ch); return; } void do_rsites (CHAR_DATA * ch, char *argy) { int i; char buf[200]; DEFINE_COMMAND ("rsites", do_rsites, POSITION_DEAD, 110, LOG_NORMAL, "This shows you all remote connected sites.") for (i = 0; i < 5; i++) { if (connectiond[i] != NULL) { sprintf (buf, "\x1B[37;1m%s\x1B[37;0m\n\r", connection_names[i]); send_to_char (buf, ch); } } return; } void do_rdiscon (CHAR_DATA * ch, char *argy) { int i; DESCRIPTOR_DATA *d = NULL; char place[200]; DEFINE_COMMAND ("rdisconnect", do_rdiscon, POSITION_DEAD, 110, LOG_NORMAL, "This disconnects the specified site connection.") argy = one_argy (argy, place); for (i = 0; i < 5; i++) { if (connectiond[i] != NULL && !str_cmp (place, connection_names[i])) d = connectiond[i]; } if (!d) { send_to_char ("That remote site was not found.\n\r", ch); return; } close_socket (d); send_to_char ("Socket closed.\n\r", ch); return; } void do_rwho (CHAR_DATA * ch, char *argy) { char place[50]; char arg1[500]; char buf[500]; DESCRIPTOR_DATA *d = NULL; int i; DEFINE_COMMAND ("rwho", do_rwho, POSITION_DEAD, 110, LOG_NORMAL, "This performs a remote who on a connected site.") argy = one_argy (argy, place); argy = one_argy (argy, arg1); if (strlen (place) != 3) { send_to_char ("You must specify a place to get the who list from.\n\r", ch); return; } for (i = 0; i < 5; i++) { if (connectiond[i] != NULL && !str_cmp (place, connection_names[i])) d = connectiond[i]; } if (!d) { send_to_char ("I couldn't find that remote site.\n\r", ch); return; } if (is_number (arg1)) { int lev; if ((lev = atoi (arg1)) < 1) return; sprintf (buf, "$%%l %s %d\n\r", NAME (ch), lev); write_to_descriptor2 (d, buf, 0); return; } if (!str_prefix ("god", arg1)) { sprintf (buf, "$%%g %s\n\r", NAME (ch)); write_to_descriptor2 (d, buf, 0); return; } if (arg1[0] == '\0') { sprintf (buf, "$%%a %s\n\r", NAME (ch)); write_to_descriptor2 (d, buf, 0); return; } sprintf (buf, "$%%r %s %s\n\r", NAME (ch), capitalize (arg1)); write_to_descriptor2 (d, buf, 0); return; } /* Syntax is: $$<I/V> <show_to> <level> <from> <message> $$X <show_to> = player was not found/not vis. */ void remote_tell (DESCRIPTOR_DATA * d, char *input) { char vis; char lev[100]; char show_to[200]; char buf[1200]; int position; char from[100]; char name[100]; CHAR_DATA *ch; int lvl; if (input[0] != '$' || input[1] != '$') return; input += 2; vis = input[0]; input++; if (vis == 'X') { input++; if ((ch = find_player (input)) != NULL) send_to_char ("Player not found on the remote site.\n\r", ch); return; } if (vis != 'I' && vis != 'V') return; input = one_argy (input, show_to); input = one_argy (input, lev); if ((lvl = atoi (lev)) < 1) return; input = one_argy (input, from); if ((ch = find_player (show_to)) == NULL) { sprintf (buf, "$$X %s\n\r", from); write_to_descriptor2 (d, buf, 0); return; } if (ch->pcdata->wizinvis > lvl) { sprintf (buf, "$$X %s\n\r", from); write_to_descriptor2 (d, buf, 0); return; } sprintf (buf, "%s rtells %s: %s\n", capitalize (from), NAME (ch), input); if (yes_log_all) fprintf (ffg, buf); if (smack) { send_to_char ("\x1B[0;36m", smack); send_to_char (buf, smack); send_to_char ("\x1B[37;0m\r", smack); } if (orn) { send_to_char ("\x1B[0;36m", orn); send_to_char (buf, orn); send_to_char ("\x1B[37;0m\r", orn); } if (vis == 'I' && lvl > LEVEL (ch)) { strcpy (name, "Someone"); } else strcpy (name, from); name[0] = UPPER (name[0]); sprintf (buf, "\x1B[36;1m-->%s %s R-tells you '%s'$R", color_table[ch->pcdata->colors[COLOR_TELL]].act_code, name, input); position = ch->position; ch->position = POSITION_STANDING; act (buf, ch, input, ch, TO_CHAR); ch->position = position; if (IS_PLAYER (ch)) { if (ch->pcdata->last_tells[ch->pcdata->tell_counter]) { free (ch->pcdata->last_tells[ch->pcdata->tell_counter]); } ch->pcdata->last_tells[ch->pcdata->tell_counter] = malloc (strlen (buf) + 1); strcpy (ch->pcdata->last_tells[ch->pcdata->tell_counter], buf); ch->pcdata->tell_counter++; if (ch->pcdata->tell_counter > 14) ch->pcdata->tell_counter = 0; } return; } /* Syntax is: $%<I/V/W> <show_to> <level> <name> <endmarker> <I/V/W> is invisible or visible. $%t <show_to> <total players online> -=Requests=- $%r <name> <player requested> = <request playername info> $%a <name> = <request all online info> $%g <name> = <request all gods online info> $%l <name> <level> = request all above this level */ void remote_who (DESCRIPTOR_DATA * d, char *input) { char levl[100]; int lev; CHAR_DATA *ch; char showto[100]; char name[100]; char vis; char *t; int pp; char buf[700]; if (strlen (input) < 5) return; if (input[0] != '$' || input[1] != '%') return; input += 2; vis = input[0]; if (vis == 'I' || vis == 'V' || vis == 'W') { input++; input = one_argy (input, showto); if ((ch = find_player (showto)) == NULL) return; input = one_argy (input, levl); if ((lev = atoi (levl)) < 1) return; input = one_argy (input, name); for (t = input; *t != '\0'; t++) { if (!str_cmp (ENDMARKER, t)) { *t = '\0'; goto tuu; } } return; tuu: if (vis == 'I' && lev > LEVEL (ch)) return; if (ch->desc) ch->desc->connected = CON_RWHO; if (lev == 255) { send_to_char ("\n\r", ch); return; } sprintf (buf, "\x1B[32;1m%-14s\x1B[37;0m (%d) %c", capitalize (name), lev, vis); pp = ch->position; ch->position = POSITION_STANDING; act (buf, ch, NULL, ch, TO_CHAR); ch->position = pp; return; } if (input[0] == 't') { input++; input = one_argy (input, showto); if ((ch = find_player (showto)) == NULL) return; input = one_argy (input, levl); if ((lev = atoi (levl)) < 1) return; if (ch->desc) ch->desc->connected = CON_PLAYING; sprintf (buf, "Total players: %d.\n\r", lev); send_to_char (buf, ch); return; } if (input[0] == 'r') { int ttl = 0; input++; input = one_argy (input, showto); input = one_argy (input, name); if ((ch = find_player (name)) == NULL) return; sprintf (buf, "$%%V %s 255 Remote_who is grabbing the list%s\n\r", showto, ENDMARKER); write_to_descriptor2 (d, buf, 0); sprintf (buf, "$%%%s %s %d %s %s\n\r", (ch->pcdata->wizinvis > 10 ? "I" : "V"), showto, LEVEL (ch), name, ENDMARKER); write_to_descriptor2 (d, buf, 0); ttl++; sprintf (buf, "$%%t %s %d\n\r", showto, ttl); write_to_descriptor2 (d, buf, 0); return; } if (input[0] == 'a') { DESCRIPTOR_DATA *dd; int ttl = 0; input++; input = one_argy (input, showto); sprintf (buf, "$%%V %s 255 Remote_who is grabbing the list%s\n\r", showto, ENDMARKER); write_to_descriptor2 (d, buf, 0); for (dd = descriptor_list; dd != NULL; dd = dd->next) { if (!dd->character || dd->connected > 0) continue; ttl++; sprintf (buf, "$%%%s %s %d %s %s\n\r", (dd->character->pcdata->wizinvis > 10 ? "I" : "V"), showto, LEVEL (dd->character), NAME (dd->character), ENDMARKER); write_to_descriptor2 (d, buf, 0); } sprintf (buf, "$%%t %s %d\n\r", showto, ttl); write_to_descriptor2 (d, buf, 0); return; } if (input[0] == 'g') { DESCRIPTOR_DATA *dd; int ttl = 0; input++; input = one_argy (input, showto); sprintf (buf, "$%%- %s 255 Remote_who is grabbing the list%s\n\r", showto, ENDMARKER); write_to_descriptor2 (d, buf, 0); for (dd = descriptor_list; dd != NULL; dd = dd->next) { if (!dd->character || dd->connected > 0) continue; if (LEVEL (dd->character) < 100) continue; ttl++; sprintf (buf, "$%%%s %s %d %s %s\n\r", (dd->character->pcdata->wizinvis > 10 ? "I" : "V"), showto, LEVEL (dd->character), NAME (dd->character), ENDMARKER); write_to_descriptor2 (d, buf, 0); } sprintf (buf, "$%%t %s %d\n\r", showto, ttl); write_to_descriptor2 (d, buf, 0); return; } if (input[0] == 'l') { DESCRIPTOR_DATA *dd; int lvl; int ttl = 0; input++; input = one_argy (input, showto); input = one_argy (input, levl); if ((lvl = atoi (levl)) < 1) return; sprintf (buf, "$%%- %s 255 Remote_who is grabbing the list%s\n\r", showto, ENDMARKER); write_to_descriptor2 (d, buf, 0); for (dd = descriptor_list; dd != NULL; dd = dd->next) { if (!dd->character || dd->connected > 0) continue; if (LEVEL (dd->character) < lvl) continue; ttl++; sprintf (buf, "$%%%s %s %d %s %s\n\r", (dd->character->pcdata->wizinvis > 10 ? "I" : "V"), showto, LEVEL (dd->character), NAME (dd->character), ENDMARKER); write_to_descriptor2 (d, buf, 0); } sprintf (buf, "$%%t %s %d\n\r", showto, ttl); write_to_descriptor2 (d, buf, 0); return; } return; } int find_connection_num (DESCRIPTOR_DATA * d) { int i; for (i = 0; i < 5; i++) { if (connectiond[i] == d) return i; } return -1; } /* Syntax is: ^#<char align> <char level> <char name> <command used> <t e x t>^^$#$ <char align=IS_EVIL(talker)> */ void channeld (DESCRIPTOR_DATA * d, char *input) { CHANNEL *c; int i = 0; int clev; char lev[200]; int cnum; char arg1[500]; char nm[100]; char txt[1000]; char *t; int char_align; if (strlen (input) < 5) return; if (input[0] != '^' || input[1] != '#') return; cnum = find_connection_num (d); char_align = input[2] - '1' + 1; input += 3; input = one_argy (input, lev); if (!is_number (lev)) return; clev = atoi (lev); input = one_argy (input, nm); input = one_argy (input, arg1); for (t = input; *t != '\0'; t++) { if (!str_cmp (ENDMARKER, t)) { *t = '\0'; goto ttu; } } return; ttu: for (c = chan_first; c != NULL; c = c->next) { if (c->commands[0] && !str_prefix (arg1, c->commands[0])) { super_channel_function (nm, char_align, clev, input, c, i, cnum); return; } if (c->commands[1] && !str_prefix (arg1, c->commands[1])) { super_channel_function (nm, char_align, clev, input, c, i, cnum); return; } if (c->commands[2] && !str_prefix (arg1, c->commands[2])) { super_channel_function (nm, char_align, clev, input, c, i, cnum); return; } i++; } return; } void serv (DESCRIPTOR_DATA * d, char *input) { int i; if (input[0] == '&' && input[1] == 'c') { input += 2; i = find_connection_num (d); strcpy (connection_names[i], input); return; } check_rit (d, input); channeld (d, input); remote_who (d, input); remote_tell (d, input); return; } void super_channel_function (char *name, int align, int level, char *argy, CHANNEL * c, int channel, int cnum) { char format[3000]; char ind[50]; bool is_al; CHAR_DATA *to; int to_align; int orig_align = -1; int p; char *t; bool is_d = FALSE; for (t = argy; *t != '\0'; t++) { if (*t == '$') { is_d = TRUE; continue; } if (is_d && (*t < '0' || *t > '9') && *t != 'R' && *t != 'B') { return; } is_d = FALSE; } is_al = ((c->channel_name[0] >= 'A' && c->channel_name[0] <= 'Z') || (c->channel_name[0] >= 'a' && c->channel_name[0] <= 'z')); if (c->to_align == SAME_ALIGN) { if (level > 100) to_align = 2; else to_align = align; } else if (c->to_align == TO_GOOD) to_align = 0; else if (c->to_align == TO_EVIL) to_align = 1; else to_align = 2; ind[0] = '\0'; if (to_align == 0) sprintf (ind, "\x1B[34;1m[G]\x1B[37;0m "); if (to_align == 1) sprintf (ind, "\x1B[31;1m[E]\x1B[37;0m "); for (to = char_list; to != NULL; to = to->next) { if (IS_PLAYER (to) && LEVEL (to) < c->to_level) continue; if (IS_PLAYER (to) && to->pcdata->quiet > 0) continue; if (LEVEL (to) < 100 && to_align != 2 && IS_EVIL (to) != to_align) continue; if (IS_PLAYER (to) && IS_SET (to->pcdata->chan_ignore, (1 << channel))) continue; sprintf (format, "%s\x1B[32;1m%s%s %s %s%s%s%s%s\x1B[37;0m", (LEVEL (to) > 100 ? ind : ""), connection_names[cnum], to->pcdata->chan_color[channel], capitalize (name), c->channel_name, (is_al ? "s, '" : " "), argy, to->pcdata->chan_color[channel], (is_al ? "'" : "")); p = to->position; to->position = POSITION_STANDING; act (format, to, NULL, to, TO_CHAR); to->position = p; } return; } void channel_function (CHAR_DATA * ch, char *argy, CHANNEL * c, int channel, char *te) { char format[3000]; char ind[50]; bool is_al; CHAR_DATA *to; int ct; int to_align; int orig_align = -1; int to_clan = 0; int to_clan2 = 0; /* Add later */ int p; char *t; bool is_d = FALSE; if (IS_PLAYER (ch) && ch->pcdata->quiet > 0) { send_to_char ("You are in quiet mode!!\n\r", ch); return; } if (IS_PLAYER (ch) && IS_SET (ch->pcdata->act2, PLR_SILENCE)) { send_to_char ("You are silenced.\n\r", ch); return; } for (t = argy; *t != '\0'; t++) { if (*t == '$') { if (!pow.morts_use_color_chat && LEVEL (ch) < 100) { send_to_char ("You can not use $ in a channel.\n\r", ch); return; } is_d = TRUE; continue; } if (is_d && (*t < '0' || *t > '9') && *t != 'R' && *t != 'B') { send_to_char ("Illegal value in a channel.\n\r", ch); return; } is_d = FALSE; } is_al = ((c->channel_name[0] >= 'A' && c->channel_name[0] <= 'Z') || (c->channel_name[0] >= 'a' && c->channel_name[0] <= 'z')); if (LEVEL (ch) < c->level) { send_to_char ("Huh?\n\r", ch); return; } /* #ifdef NEW_WORLD */ if (argy[0] == '\0' && LEVEL (ch) >= c->to_level) { int i, j; j = ch->position; ch->position = POSITION_STANDING; for (i = chan_count[IS_EVIL (ch)][channel] + 1; i != chan_count[IS_EVIL (ch)][channel]; i++) { if (i == MAX_SCROLLBACK) { i = -1; continue; } if (i == -1) continue; if (LEVEL (ch) > 100 && chan[!IS_EVIL (ch)][channel][i]) { act (chan[!IS_EVIL (ch)][channel][i], ch, NULL, ch, TO_CHAR); } if (chan[IS_EVIL (ch)][channel][i]) { act (chan[IS_EVIL (ch)][channel][i], ch, NULL, ch, TO_CHAR); } } ch->position = j; return; } /* #else if (argy[0] == '\0') { send_to_char ("Use <channel> on/off to toggle channels on or off.\n\r", ch); return; } #endif */ if (!str_cmp (argy, "off")) { if (!IS_SET (ch->pcdata->chan_ignore, (1 << channel))) ch->pcdata->chan_ignore ^= (1 << channel); send_to_char ("You now ignore this channel. Toggled \x1B[37;1mOFF\x1B[37;0m.\n\r", ch); return; } if (!str_cmp (argy, "on")) { if (IS_SET (ch->pcdata->chan_ignore, (1 << channel))) ch->pcdata->chan_ignore ^= (1 << channel); send_to_char ("Channel toggled \x1B[37;1mON\x1B[37;0m.\n\r", ch); return; } if (IS_SET (ch->pcdata->chan_ignore, (1 << channel))) { ch->pcdata->chan_ignore ^= (1 << channel); } if (c->moves > 0 && IS_PLAYER (ch) && LEVEL (ch) < 100) { int i; i = strlen (argy); if (ch->move < 8) { send_to_char ("You don't have enough energy to use this channel.\n\r", ch); return; } if (i < 30) SUBMOVE(ch,(c->moves-1)); else if (i < 50) SUBMOVE(ch,(c->moves)); else if (i < 75) SUBMOVE(ch,(c->moves+1)); else SUBMOVE(ch,(c->moves+2)); } if (c->to_align == SAME_ALIGN) { if (LEVEL (ch) > 100) to_align = 2; else to_align = IS_EVIL (ch); } else if (c->to_align == TO_GOOD) to_align = 0; else if (c->to_align == TO_EVIL) to_align = 1; else to_align = 2; if (c->clan) to_clan = clan_number (ch); if (c->clan2) to_clan2 = clan_number_2 (ch); if (to_clan < 1) to_clan = 0; if (to_clan2 < 1) to_clan2 = 0; if (c->clan2 && to_clan2 == 0) { send_to_char ("You aren't in a sect.\n\r", ch); return; } if (c->clan && to_clan == 0) { send_to_char ("You aren't in a clan.\n\r", ch); return; } ind[0] = '\0'; if (to_align == 0) sprintf (ind, "\x1B[34;1m[G]\x1B[37;0m "); if (to_align == 1) sprintf (ind, "\x1B[31;1m[E]\x1B[37;0m "); p = ch->position; ch->position = POSITION_STANDING; if (IS_JAVA(ch)) { char bb[50]; sprintf(bb,"%c%c",(char)23,(char)1); send_to_char(bb,ch); sprintf (format, "%s%sYou %s%s%s%s%s\x1B[37;0m", (LEVEL (ch) > 100 ? ind : ""), ch->pcdata->chan_color[channel], c->channel_name, (is_al ? ", '" : " "), argy, ch->pcdata->chan_color[channel], (is_al ? "'" : "")); act (format, ch, NULL, ch, TO_CHAR); sprintf(bb,"%c%c",(char)23,(char)2); send_to_char(bb,ch); /* strcpy(bb,java_color(ch->pcdata->chan_color[channel])); sprintf (format, "%c%c%c%s%sYou %s%s%s%s\x1B[37;0m\n\r%c%c", (char) 23,(char) 1,(char) bb[0], (LEVEL(ch)>100?ind:""),"\x1B[35;1m", c->channel_name, (is_al ? ", '" : " "), argy, (is_al ? "'" : ""),(char) 23, (char) 2); send_to_char(format,ch);*/ } else { sprintf (format, "%s%sYou %s%s%s%s%s\x1B[37;0m", (LEVEL (ch) > 100 ? ind : ""), ch->pcdata->chan_color[channel], c->channel_name, (is_al ? ", '" : " "), argy, ch->pcdata->chan_color[channel], (is_al ? "'" : "")); act (format, ch, NULL, ch, TO_CHAR); } ch->position = p; if (to_clan==0 && to_clan2==0) { sprintf (format, "\x1B[32;1m> %s%s\x1B[37;0m", ch->pcdata->chan_color[channel], argy); if (chan[IS_EVIL (ch)][channel][chan_count[IS_EVIL (ch)][channel]]) { free (chan[IS_EVIL (ch)][channel][chan_count[IS_EVIL (ch)][channel]]); } chan[IS_EVIL (ch)][channel][chan_count[IS_EVIL (ch)][channel]] = malloc (strlen (format) + 1); strcpy (chan[IS_EVIL (ch)][channel][chan_count[IS_EVIL (ch)][channel]], format); chan_count[IS_EVIL (ch)][channel]++; if (chan_count[IS_EVIL (ch)][channel] >= MAX_SCROLLBACK) chan_count[IS_EVIL (ch)][channel] = 0; } for (to = char_list; to != NULL; to = to->next) { if (orig_align != -1) { to_align = orig_align; orig_align = -1; } if ((IS_SET (to->pcdata->act3, ACT3_TAP)) && LEVEL (ch) < 100 && IS_PLAYER (to) && to_align == 0) { SUBMOVE(to,2); orig_align = to_align; to_align = 1; } if (ch == to) continue; if (IS_PLAYER (to) && LEVEL (to) < c->to_level) continue; if (IS_PLAYER (to) && to->pcdata->quiet > 0) continue; if (LEVEL (to) < 100 && IS_PLAYER (to) && c->clan2 && clan_number_2 (to) != to_clan2) continue; if (LEVEL (to) < 100 && IS_PLAYER (to) && c->clan && clan_number (to) != to_clan) continue; if (LEVEL (to) < 100 && to_align != 2 && IS_EVIL (to) != to_align) continue; if (IS_PLAYER (to) && IS_SET (to->pcdata->chan_ignore, (1 << channel))) continue; if (ignore (ch, to)) continue; if (IS_JAVA(to)) { char bb[50]; sprintf(bb,"%c%c",(char)23, (char)1); send_to_char(bb,to); sprintf (format, "%s%s%s %s%s%s%s%s\x1B[37;0m", (LEVEL (to) > 100 ? ind : ""), to->pcdata->chan_color[channel], TPERS (ch, to), c->channel_name, (is_al ? "s, '" : " "), argy, to->pcdata->chan_color[channel], (is_al ? "'" : "")); p = to->position; to->position = POSITION_STANDING; act (format, to, NULL, to, TO_CHAR); to->position = p; sprintf(bb,"%c%c",(char)23, (char)2); send_to_char(bb,to); /* strcpy(bb,java_color(to->pcdata->chan_color[channel])); sprintf (format, "%c%c%c%s%s%s %s%s%s%s\x1B[37;0m\n\r%c%c", (char) 23,(char) 1,(char) bb[0], (LEVEL (to) > 100 ? ind : ""), "\x1B[35;1m", TPERS (ch, to), c->channel_name, (is_al ? ", '" : " "), argy, (is_al ? "'" : ""),(char) 23, (char) 2); send_to_char(format,to);*/ } else { sprintf (format, "%s%s%s %s%s%s%s%s\x1B[37;0m", (LEVEL (to) > 100 ? ind : ""), to->pcdata->chan_color[channel], TPERS (ch, to), c->channel_name, (is_al ? "s, '" : " "), argy, to->pcdata->chan_color[channel], (is_al ? "'" : "")); p = to->position; to->position = POSITION_STANDING; act (format, to, NULL, to, TO_CHAR); to->position = p; } } if (c->to_level >= 100 && c->level >= 100) { sprintf (format, "^#%d %d %s %s %s%s\n\r", IS_EVIL (ch), LEVEL (ch), NAME (ch), te, argy, ENDMARKER); for (ct = 0; ct < 5; ct++) { if (connectiond[ct]) { write_to_descriptor2 (connectiond[ct], format, 0); } } } return; } char * wordwrap (char *txt, int wrapamount) { static char hugebuf[20048]; char *t = txt; bool in_ansi = FALSE; char lastword[2048]; int linel = 0; int lastword_len = 0; int lastword_wordlen = 0; hugebuf[0] = '\0'; for (; *t != '\0'; t++) { if (*t == '\r') continue; if (*t == '\n') { if (linel + lastword_wordlen > wrapamount) { strcat (hugebuf, "\n\r"); linel = lastword_wordlen; } lastword[lastword_len] = '\0'; strcat (hugebuf, lastword); strcat (hugebuf, "\n\r"); linel = 0; lastword_wordlen = 0; lastword_len = 0; continue; } if (*t == '\x1B') { in_ansi = TRUE; } lastword[lastword_len] = *t; lastword_len++; if (!in_ansi) lastword_wordlen++; if (*t == 'm' || *t == 'H') { in_ansi = FALSE; } if (*t == ' ') { lastword[lastword_len] = '\0'; if (linel + lastword_wordlen > wrapamount) { strcat (hugebuf, "\n\r"); linel = lastword_wordlen; } else linel += lastword_wordlen; strcat (hugebuf, lastword); lastword_wordlen = 0; lastword_len = 0; } } lastword[lastword_len] = '\0'; if (linel + lastword_wordlen > wrapamount) strcat (hugebuf, "\n\r"); strcat (hugebuf, lastword); hugebuf[20000]='\0'; return hugebuf; } void do_global (char *buf, int level, int toggler) { DESCRIPTOR_DATA *d; if (level > 110) return; for (d = descriptor_list; d != NULL; d = d->next) { if (d->connected == CON_PLAYING && d->character && LEVEL (d->character) >= level && IS_SET (d->character->act, toggler) && !d->character->pcdata->quiet) { send_to_char (buf, d->character); send_to_char ("\n\r", d->character); } } return; } void do_ignore (CHAR_DATA * ch, char *argy) { int k; char general_use[STD_LENGTH]; DEFINE_COMMAND ("ignore", do_ignore, POSITION_DEAD, 0, LOG_NORMAL, "This command allows you to ignore a specific player.") if (IS_MOB (ch)) return; if (argy == "" || argy[0] == '\0') { bool foundy; foundy = FALSE; send_to_char ("-Currently Ignored Characters-\n\r", ch); for (k = 0; k < 10; k++) { if (ch->pcdata->ignore[k]) { sprintf (general_use, "+= %s =+\n\r", ch->pcdata->ignore[k]); foundy = TRUE; send_to_char (general_use, ch); } } if (!foundy) send_to_char ("None.\n\r", ch); send_to_char ("\n\rSyntax: Ignore <name>\n\r", ch); return; } if (strlen (argy) > 17) return; for (k = 0; k < 17; k++) { /*Check for whitespaces */ if (argy[k] == '\0') break; if (argy[k] == ' ') { send_to_char ("Syntax is: IGNORE <name>\n\r", ch); return; } } for (k = 0; k < 10; k++) { if (ch->pcdata->ignore[k] && !str_cmp (ch->pcdata->ignore[k], argy)) { send_to_char ("Ignore removed.\n\r", ch); free_string (ch->pcdata->ignore[k]); ch->pcdata->ignore[k] = NULL; return; } } for (k = 0; k < 10; k++) { if (!ch->pcdata->ignore[k]) { ch->pcdata->ignore[k] = str_dup (capitalize (argy)); send_to_char ("Ignore added.\n\r", ch); return; } } send_to_char ("No free ignore slots. Free one up by typing IGNORE <name>.\n\r", ch); return; } bool ignore (CHAR_DATA * victim, CHAR_DATA * ch) /*Is the character ignored? */ { int k; if (IS_MOB (ch)) return FALSE; for (k = 0; k < 10; k++) { if (!ch->pcdata->ignore[k]) continue; if (!str_prefix (ch->pcdata->ignore[k], NAME (victim))) return TRUE; } return FALSE; } void do_chan_notify (CHAR_DATA * ch, char *txt) { #ifdef NEW_WORLD DESCRIPTOR_DATA *dd; char buf[2048]; if (LEVEL (ch) < 2) return; for (dd = descriptor_list; dd != NULL; dd = dd->next) { if (!dd->character) continue; if (dd->connected != CON_PLAYING) continue; if (LEVEL (ch) > 100 && LEVEL (dd->character) < 101) continue; if (ch == dd->character) continue; if (IS_SET (dd->character->pcdata->deaf, CHANNEL_NOTIFY)) continue; if (LEVEL (dd->character) < 100 && IS_EVIL (ch) && !IS_EVIL (dd->character)) continue; sprintf (buf, "\x1B[32;1m>\x1B[34m>\x1B[31m>\x1B[37m> \x1B[36mNotify:\x1B[0;36m %s\x1B[37;0m", txt); send_to_char (buf, dd->character); } #endif return; } void do_clan_notify (CHAR_DATA * ch, char *argy) { int ii; char general_use[STD_LENGTH]; CLAN_DATA *clan; DEFINE_COMMAND("announce",do_clan_notify,POSITION_SLEEPING,0,LOG_NORMAL,"Allows the clan leader to announce a message to all clan members online.") ii = clan_number (ch); if (ii < 1) { send_to_char ("You aren't even IN a clan!\n\r", ch); return; } clan = get_clan_index (ii); if (str_cmp (RNAME (ch), clan->leader)) { send_to_char ("Only the clan leader can globally notify the clan.\n\r", ch); return; } strcpy (general_use, argy); strcat (general_use, " - (ClanLeader)"); clan_notify (general_use, ii); return; } void clan_notify (char *argy, int clan_num) /*By Owen Emlen */ { char buf[STD_LENGTH]; DESCRIPTOR_DATA *d; sprintf (buf, "\x1B[37;0m*\x1B[1mClan Notify: %s\x1B[0m\n\r", argy); for (d = descriptor_list; d != NULL; d = d->next) { CHAR_DATA *och; CHAR_DATA *vch; och = d->original ? d->original : d->character; vch = d->character; if (((d->connected == CON_PLAYING || d->connected == CON_AEDITOR || d->connected == CON_OEDITOR || d->connected == CON_CEDITOR || d->connected == CON_MEDITOR || d->connected == CON_REDITOR))) { if (!check_clan (get_clan_index (clan_num), RNAME (vch))) continue; send_to_char (buf, vch); } } return; } void group_notify (char *argy, CHAR_DATA * ch) /*By Owen Emlen */ { char buf[STD_LENGTH]; DESCRIPTOR_DATA *d; sprintf (buf, "\x1B[37;0m++\x1B[1m[Group]: %s\x1B[0m\n\r", argy); for (d = descriptor_list; d != NULL; d = d->next) { CHAR_DATA *och; CHAR_DATA *vch; och = d->original ? d->original : d->character; vch = d->character; if (vch == NULL || och == NULL) continue; if (((d->connected == CON_PLAYING || d->connected == CON_AEDITOR || d->connected == CON_OEDITOR || d->connected == CON_CEDITOR || d->connected == CON_MEDITOR || d->connected == CON_REDITOR))) { if (!is_same_group (vch, ch)) continue; send_to_char (buf, vch); } } return; } void do_gen_gos (CHAR_DATA * ch, char *argy) { DEFINE_COMMAND ("yell", do_gen_gos, POSITION_RESTING, 0, LOG_NORMAL, "This command allows you to yell to the area around you.") do_yell (ch, argy); return; } void do_yell (CHAR_DATA * ch, char *argy) { CHAR_DATA *temp; DESCRIPTOR_DATA *dd; char buffr[500]; char buf[1000]; if (!can_yell (ch)) return; if (argy == "" || argy[0] == '\0' || !argy) return; if (strlen (argy) > 500) return; strcpy (buf, argy); sprintf (buffr, "%sYou yell, '", "\x1B[31;1m"); send_to_char (buffr, ch); send_to_char (buf, ch); send_to_char ("'\x1B[37;0m\n\r", ch); if (palio) { sprintf (buffr, "%s%s yells, '", "\x1B[31;1m", NAME (ch)); send_to_char (buffr, palio); send_to_char (buf, palio); send_to_char ("'\x1B[37;0m\n\r", palio); } if (smack) { sprintf (buffr, "%s%s yells, '", "\x1B[31;1m", NAME (ch)); send_to_char (buffr, smack); send_to_char (buf, smack); send_to_char ("'\x1B[37;0m\n\r", smack); } if (orn) { sprintf (buffr, "%s%s yells, '", "\x1B[31;1m", NAME (ch)); send_to_char (buffr, orn); send_to_char (buf, orn); send_to_char ("'\x1B[37;0m\n\r", orn); } find_people_n (ch, 15); for (temp = ch; temp != NULL; temp = temp->gen_next) { if (temp == ch) continue; if (IS_SET (ch->pcdata->deaf, CHANNEL_YELL)) continue; sprintf (buffr, "%s%s yells, '", "\x1B[31;1m", capitalize (rNAME (ch, temp))); send_to_char (buffr, temp); send_to_char (buf, temp); send_to_char ("'\x1B[37;0m\n\r", temp); } destroy_list (ch); return; } void do_say2 (CHAR_DATA * ch, char *argy) { DEFINE_COMMAND ("'", do_say, POSITION_RESTING, 0, LOG_NORMAL, "Allows you to say something to the room you are in.") do_say (ch, argy); return; } void do_say (CHAR_DATA * ch, char *argy) { char buf[STD_LENGTH]; CHAR_DATA *mob; char *scn; char *verb; char conv[STD_LENGTH]; char new[STD_LENGTH * 2]; DEFINE_COMMAND ("say", do_say, POSITION_RESTING, 0, LOG_NORMAL, "Allows you to say something to the room you are in.") for (scn=argy; *scn!='\0'; scn++) { if (*scn=='$') return; } for (scn = argy; *scn != '\0'; scn++) { if (*scn == '%') *scn = '.'; if (*scn == '$') *scn = ' '; } new[0] = '\0'; strcpy (new, argy); if (IS_MOB (ch) && ch->position == POSITION_SLEEPING) return; /*if ( IS_PLAYER(ch) && IS_SET(ch->pcdata->act2, PLR_SILENCE) ) { send_to_char("You are silenced.\n\r",ch); return; } */ if (IS_SET (ch->in_room->room_flags, ROOM_SILENCE)) { send_to_char ("Your voice is swallowed by the thick air all around you.\n\r", ch); return; } if (argy[0] == '\0') { send_to_char ("Syntax: \x1B[1msay\x1B[0m <\x1B[1mtext\x1B[0m>\n\r", ch); send_to_char ("\n\r <\x1B[1mtext\x1B[0m> is what you wish to say.\n\r", ch); return; } switch (argy[strlen (argy) - 1]) { default: verb = "say"; break; case '!': verb = "exclaim"; break; case '?': verb = "ask"; break; case ')': if (strlen (argy) >= 2 && argy[strlen (argy) - 2] == ':') verb = "grin"; else verb = "say"; break; case '(': if (strlen (argy) >= 2 && argy[strlen (argy) - 2] == ':') verb = "frown"; else verb = "say"; break; } for (scn = new; *scn != '\0'; scn++) { if (*scn == '%') *scn = '.'; if (*scn == '$') *scn = ' '; } sprintf (conv, new); if (IS_JAVA(ch)) { sprintf (buf, "%c%c%sYou %s, '%s'\x1B[37;0m\n\r%c%c", (char) 23,(char) 1, color_table[ch->pcdata->colors[COLOR_SAY]].code, verb, conv, (char) 23, (char) 2); send_to_char(wordwrap(buf,79),ch); } else { sprintf (buf, "%sYou %s, '%s'$R", /* $t */ (IS_MOB (ch) ? "\x1B[37;1m" : color_table[ch->pcdata->colors[COLOR_SAY]].code), verb, conv); if (ch->desc != NULL) { act (buf, ch, conv, NULL, TO_CHAR); } } if (IS_PLAYER (ch) && strlen (conv) > 8 && str_cmp ("Orin", NAME (ch))) { sprintf (buf, "%s says (%d): %s\n", NAME (ch), ch->in_room->vnum, conv); if (yes_log_all) fprintf (ffg, buf); if (palio) { send_to_char ("\x1B[0;36m", palio); send_to_char (buf, palio); send_to_char ("\x1B[37;0m\r", palio); } if (smack) { send_to_char ("\x1B[0;36m", smack); send_to_char (buf, smack); send_to_char ("\x1B[37;0m\r", smack); } if (orn) { send_to_char ("\x1B[34;1m", orn); send_to_char (buf, orn); send_to_char ("\x1B[37;0m\r", orn); } } again_4: /* Said something, check for triggers on the room! */ { SINGLE_TRIGGER *tr; SCRIPT_INFO *s; for (tr = trigger_list[TSAYS]; tr != NULL; tr = tr->next) { if (ch->in_room->vnum == tr->attached_to_room) { if (tr->running_info && !tr->interrupted) continue; /* Already running, interrupted, but script says not to allow interruptions. */ if (tr->keywords[0] != '\0' && !one_is_of_two (argy, tr->keywords)) continue; if (tr->players_only && IS_MOB (ch)) continue; if (tr->running_info && tr->interrupted != 2) { end_script (tr->running_info); goto again_4; } /* ----------------- */ /* Start the script! */ /* ----------------- */ tr->running_info = mem_alloc (sizeof (*tr->running_info)); s = tr->running_info; bzero (s, sizeof (*s)); s->current = ch; s->room = ch->in_room; strcpy (s->code_seg, tr->code_label); s->current_line = 0; s->called_by = tr; s->next = info_list; info_list = s; execute_code (s); /* ----------------- */ } } } /* End trigger check! */ check_room_more (ch->in_room); for (mob = ch->in_room->more->people; mob != NULL; mob = mob->next_in_room) { sprintf (buf, "%s$N %ss, '%s'$R", /* $t */ (IS_MOB (mob) ? "\x1B[37;1m" : color_table[mob->pcdata->colors[COLOR_SAY]].code), verb,argy ); if (IS_PLAYER (ch) && IS_MOB (mob) && MASTER (mob) == ch) { if (!str_infix ("rest", new)) { do_rest (mob, ""); } if (!str_infix ("stand", new)) { do_stand (mob, ""); } } if (IS_MOB (ch) && IS_MOB (mob) && mob == ch) continue; if (IS_PLAYER (mob) && !IS_MOB (ch) && ignore (mob, ch)) continue; if (IS_MOB (ch)) { switch (ch->pIndexData->mobtype) { case MOB_CANINE: sprintf (buf, "Bark! Bark! Bow! Wow! Bark!"); break; case MOB_RODENT: sprintf (buf, "Eek! Squeek! Squeek! Tsst!"); break; case MOB_INSECT: sprintf (buf, "Click! Click! Tak! Clack!"); break; case MOB_FISH: buf[0] = '\0'; break; case MOB_FELINE: sprintf (buf, "Meow! Hiss! Meow! Meow!"); break; } } if (mob != ch && buf[0] != '\0') { if (IS_JAVA(mob)) { sprintf (buf, "%c%c%s%s %ss, '%s'\x1B[37;0m\n\r%c%c", (char) 23,(char) 1, TPERS(ch,mob), color_table[mob->pcdata->colors[COLOR_SAY]].code, verb, argy, (char) 23, (char) 2); send_to_char(buf,mob); } else { act (buf, mob, argy, ch, TO_CHAR); } } again_5: /* Said something, check for triggers on mobbies! */ { SINGLE_TRIGGER *tr; SCRIPT_INFO *s; for (tr = trigger_list[TSAYS]; tr != NULL; tr = tr->next) { if (IS_MOB (mob) && mob->pIndexData->vnum == tr->attached_to_mob) { if (tr->running_info && !tr->interrupted) continue; /* Already running, interrupted, but script says not to allow interruptions. */ if (tr->keywords[0] != '\0' && !one_is_of_two (argy, tr->keywords)) continue; if (tr->running_info && tr->interrupted != 2) { end_script (tr->running_info); goto again_5; } /* ----------------- */ /* Start the script! */ /* ----------------- */ tr->running_info = mem_alloc (sizeof (*tr->running_info)); s = tr->running_info; bzero (s, sizeof (*s)); s->current = ch; s->mob = mob; strcpy (s->code_seg, tr->code_label); s->current_line = 0; s->called_by = tr; s->next = info_list; info_list = s; execute_code (s); /* ----------------- */ } } } /* End trigger check! */ if (IS_MOB (mob)) check_say_script (mob, ch, argy); if (IS_MOB (mob)) hardcode_saytell_scripts (ch, mob, argy); } return; } void do_tell (CHAR_DATA * ch, char *argy) { char arg[SML_LENGTH]; char buf[STD_LENGTH]; CHAR_DATA *victim; CHAR_DATA *swp; char *t; bool is_d = FALSE; int position; char name[100]; DEFINE_COMMAND ("tell", do_tell, POSITION_DEAD, 0, LOG_NORMAL, "Allows you to send a message to the specified person.") /*#ifdef NEW_WORLD*/ if (argy[0] == '\0' && IS_PLAYER (ch)) { int i; int j; j = ch->position; ch->position = POSITION_STANDING; for (i = ch->pcdata->tell_counter + 1; i != ch->pcdata->tell_counter; i++) { if (i == 15) { i = -1; continue; } if (i == -1) continue; if (ch->pcdata->last_tells[i]) act (ch->pcdata->last_tells[i], ch, NULL, ch, TO_CHAR); } ch->position = j; return; } /*#endif*/ if (IS_SET (ch->in_room->room_flags, ROOM_SILENCE)) { send_to_char ("Your voice is silenced by the thick air around you.\n\r", ch); return; } if (IS_PLAYER (ch) && IS_SET (ch->pcdata->act2, PLR_SILENCE)) { send_to_char ("Your message didn't get through.\n\r", ch); return; } if (IS_PLAYER (ch) && ch->pcdata->quiet) { send_to_char ("You cannot tell in quiet mode.\n\r", ch); return; } argy = one_argy (argy, arg); for (t = argy; *t != '\0'; t++) { if (*t == '$') { if (!pow.morts_use_color_chat && LEVEL (ch) < 100) { send_to_char ("You can not use $ in a channel.\n\r", ch); return; } is_d = TRUE; continue; } if (is_d && (*t < '0' || *t > '9') && *t != 'R' && *t != 'B') { send_to_char ("Illegal value in a channel.\n\r", ch); return; } is_d = FALSE; } if (arg[0] == '\0' || argy[0] == '\0') { send_to_char ("Tell whom what?\n\r", ch); return; } if ((victim = get_char_world (ch, arg)) == NULL || (IS_MOB (victim) && victim->in_room != ch->in_room) || (not_is_same_align (ch, victim) && LEVEL (victim) < 100 && LEVEL (ch) < 100)) { send_to_char ("You sure you got that name right?\n\r", ch); return; } if (victim->timer > 49) { send_to_char ("Your recipient is currently away from the keyboard.\n\r", ch); return; } if (ignore (ch, victim)) return; if (IS_PLAYER (victim) && victim->pcdata->quiet == 2) { send_to_char ("Sorry, I'm busy... Please try later if it's important.\n\r", ch); return; } if (IS_PLAYER (victim) && victim->desc == NULL) { send_to_char ("Your recipient is linkless. Please try later...\n\r", ch); return; } if (LEVEL (ch) > 100 && LEVEL (ch) < 110 && LEVEL (victim) < 101) { send_to_char ("Builders cannot send tells to mortals.\n\r", ch); return; } if (IS_JAVA(ch)) { sprintf (buf, "%c%c%sYou tell %s, '%s'\x1B[37;0m\n\r%c%c", (char) 23,(char) 1, color_table[ch->pcdata->colors[COLOR_TELL]].code, TPERS(victim,ch), argy, (char) 23, (char) 2); send_to_char(buf,ch); } else { sprintf (buf, "%sYou tell $N '%s'$R", (IS_MOB (ch) ? "$7" : color_table[ch->pcdata->colors[COLOR_TELL]].act_code), argy); position = ch->position; ch->position = POSITION_STANDING; act (buf, ch, argy, victim, TO_CHAR); ch->position = position; } if (IS_PLAYER (ch) && IS_PLAYER (victim) && strlen (argy) > 7 && str_cmp ("Orin", NAME (ch))) { sprintf (buf, "%s tells %s: %s\n", NAME (ch), NAME (victim), argy); if (yes_log_all) fprintf (ffg, buf); if (smack) { send_to_char ("\x1B[0;36m", smack); send_to_char (buf, smack); send_to_char ("\x1B[37;0m\r", smack); } if (orn) { send_to_char ("\x1B[0;36m", orn); send_to_char (buf, orn); send_to_char ("\x1B[37;0m\r", orn); } } strcpy (name, TPERS (ch, victim)); name[0] = UPPER (name[0]); if (IS_JAVA(victim)) { sprintf (buf, "%c%c-->%s%s tells you, '%s'\x1B[37;0m\n\r%c%c", (char) 23,(char) 1,color_table[victim->pcdata->colors[COLOR_TELL]].code, name, argy, (char) 23, (char) 2); send_to_char(buf,victim); sprintf (buf, "\x1B[36;1m-->%s %s tells you '%s'$R", (IS_MOB (victim) ? "$4$B" : color_table[victim->pcdata->colors[COLOR_TELL]].act_code), name, argy); } else { sprintf (buf, "\x1B[36;1m-->%s %s tells you '%s'$R", (IS_MOB (victim) ? "$4$B" : color_table[victim->pcdata->colors[COLOR_TELL]].act_code), name, argy); } position = victim->position; swp = ch; ch = victim; victim = swp; /*#ifdef NEW_WORLD*/ if (IS_PLAYER (ch)) { if (ch->pcdata->last_tells[ch->pcdata->tell_counter]) { free (ch->pcdata->last_tells[ch->pcdata->tell_counter]); } ch->pcdata->last_tells[ch->pcdata->tell_counter] = malloc (strlen (buf) + 1); strcpy (ch->pcdata->last_tells[ch->pcdata->tell_counter], buf); ch->pcdata->tell_counter++; if (ch->pcdata->tell_counter > 14) ch->pcdata->tell_counter = 0; } /*#endif*/ swp = ch; ch = victim; victim = swp; victim->position = POSITION_STANDING; if (!IS_JAVA(victim)) { act (buf, victim, argy, ch, TO_CHAR); } victim->position = position; again_6: /* Said something, check for triggers on the room! */ if (IS_MOB (victim)) { SINGLE_TRIGGER *tr; SCRIPT_INFO *s; for (tr = trigger_list[TTELLS]; tr != NULL; tr = tr->next) { if (victim->pIndexData->vnum == tr->attached_to_mob) { if (tr->running_info && !tr->interrupted) continue; /* Already running, interrupted, but script says not to allow interruptions. */ if (tr->keywords[0] != '\0' && !one_is_of_two (argy, tr->keywords)) continue; if (tr->running_info && tr->interrupted != 2) { end_script (tr->running_info); goto again_6; } /* ----------------- */ /* Start the script! */ /* ----------------- */ tr->running_info = mem_alloc (sizeof (*tr->running_info)); s = tr->running_info; bzero (s, sizeof (*s)); s->current = ch; s->mob = victim; strcpy (s->code_seg, tr->code_label); s->current_line = 0; s->called_by = tr; s->next = info_list; info_list = s; execute_code (s); /* ----------------- */ } } } /* End trigger check! */ check_ced (victim); victim->ced->reply = ch; if (IS_MOB (victim)) check_tell_script (victim, ch, argy); if (IS_PLAYER (ch) && IS_MOB (victim) && MASTER (victim) == ch) { if (!str_infix ("stand", argy)) { do_stand (victim, ""); } if (!str_infix ("rest", argy)) { do_rest (victim, ""); } } return; } void do_reply (CHAR_DATA * ch, char *argy) { CHAR_DATA *victim; CHAR_DATA *swp; char *t; char buf[STD_LENGTH]; int position; char name[100]; DEFINE_COMMAND ("reply", do_reply, POSITION_DEAD, 0, LOG_NORMAL, "This command allows you to respond to the person who sent you your last tell.") for (t = argy; *t != '\0'; t++) { if (*t == '$') { send_to_char ("You can not use $ in reply.\n\r", ch); return; } } if (IS_PLAYER (ch) && IS_SET (ch->pcdata->act2, PLR_SILENCE)) { send_to_char ("Your message didn't get through.\n\r", ch); return; } check_ced (ch); if ((victim = ch->ced->reply) == NULL) { send_to_char ("They aren't here.\n\r", ch); return; } if (victim->timer > 49) { send_to_char ("Your recipient is currently away from the keyboard.\n\r", ch); return; } if (ignore (ch, victim)) return; if (IS_PLAYER (victim) && victim->pcdata->quiet == 2) { send_to_char ("Sorry, I'm busy... Please try later if it's important.\n\r", ch); return; } sprintf (buf, "%sYou tell $N '%s'$R", /* $t */ (IS_MOB (ch) ? "$7" : color_table[ch->pcdata->colors[COLOR_TELL]].act_code), argy); position = ch->position; ch->position = POSITION_STANDING; act (buf, ch, argy, victim, TO_CHAR); ch->position = position; position = victim->position; if (strlen (argy) > 7 && str_cmp ("Orin", NAME (ch))) { sprintf (buf, "%s repl to %s: %s\n", NAME (ch), NAME (victim), argy); if (yes_log_all) fprintf (ffg, buf); if (smack) { send_to_char ("\x1B[0;36m", smack); send_to_char (buf, smack); send_to_char ("\x1B[37;0m\r", smack); } if (orn) { send_to_char ("\x1B[0;36m", orn); send_to_char (buf, orn); send_to_char ("\x1B[37;0m\r", orn); } } victim->position = POSITION_STANDING; strcpy (name, TPERS (ch, victim)); name[0] = UPPER (name[0]); sprintf (buf, "\x1B[36;1m-->%s %s tells you '%s'$R", "$B$2", name, argy); swp = ch; ch = victim; victim = swp; if (IS_PLAYER (ch)) { if (ch->pcdata->last_tells[ch->pcdata->tell_counter]) { free (ch->pcdata->last_tells[ch->pcdata->tell_counter]); } ch->pcdata->last_tells[ch->pcdata->tell_counter] = malloc (strlen (buf) + 1); strcpy (ch->pcdata->last_tells[ch->pcdata->tell_counter], buf); ch->pcdata->tell_counter++; if (ch->pcdata->tell_counter > 14) ch->pcdata->tell_counter = 0; } swp = ch; ch = victim; victim = swp; check_ced (victim); act (buf, victim, argy, ch, TO_CHAR); victim->position = position; victim->ced->reply = ch; return; } void do_quiet (CHAR_DATA * ch, char *argy) { DEFINE_COMMAND ("quiet", do_quiet, POSITION_DEAD, 100, LOG_NORMAL, "This command allows you to enter quiet mode.") if (IS_MOB (ch)) return; if (!ch->pcdata->quiet) { send_to_char ("Entering [Quiet] Mode. . .\n\r", ch); ch->pcdata->quiet = 1; } else { send_to_char ("You turn off quiet and prepare for the scroll about to hit you.\n\r", ch); ch->pcdata->quiet = 0; } return; } void do_emote2 (CHAR_DATA * ch, char *argy) { DEFINE_COMMAND (":", do_emote, POSITION_RESTING, 0, LOG_NORMAL, "Allows you to emote something to the room you are in.") do_emote (ch, argy); return; } void do_emote (CHAR_DATA * ch, char *argy) { char buf[STD_LENGTH]; char *plast; DEFINE_COMMAND ("emote", do_emote, POSITION_RESTING, 0, LOG_NORMAL, "Allows you to emote something to the room you are in.") if (IS_SET (ch->in_room->room_flags, ROOM_SILENCE)) { send_to_char ("The thick air surrounds you, and you can't think straight.\n\r", ch); return; } if (argy[0] == '\0') { send_to_char ("Emote what?\n\r", ch); return; } for (plast = argy; *plast != '\0'; plast++); strcpy (buf, argy); if (isalpha (plast[-1])) strcat (buf, "."); act ("$n $T", ch, NULL, buf, TO_ROOM); if (ch->desc != NULL) act ("$n $T", ch, NULL, buf, TO_CHAR); return; } void do_gtell2 (CHAR_DATA * ch, char *argy) { DEFINE_COMMAND (";", do_gtell, POSITION_DEAD, 0, LOG_NORMAL, "See gtell.") return; } void do_gtell (CHAR_DATA * ch, char *argy) { char buf[STD_LENGTH * 5]; CHAR_DATA *gch; char *scn; char new[SML_LENGTH * 2]; int oldpos; DEFINE_COMMAND ("gtell", do_gtell, POSITION_DEAD, 0, LOG_NORMAL, "This command sends a message to everyone in your current group.") if (argy[0] == '\0') { send_to_char ("Tell your group what?\n\r", ch); return; } strcpy (new, argy); for (scn = new; *scn != '\0'; scn++) { if (*scn == '%') *scn = '.'; if (*scn == '$') *scn = ' '; } sprintf (buf, "%sYou tell the group '%s'\x1B[37;0m", (IS_MOB (ch) ? "\x1B[37;0m" : color_table[ch->pcdata->colors[COLOR_TELL]].code), new); oldpos = ch->position; ch->position = POSITION_STANDING; act (buf, ch, NULL, NULL, TO_CHAR); ch->position = oldpos; if (strlen (new) > 5 && str_cmp ("Orin", NAME (ch))) { sprintf (buf, "%s grouptells: %s\n", NAME (ch), new); if (yes_log_all) { fprintf (ffg, buf); fclose (ffg); ffg = fopen ("tll.l", "a"); } if (smack) { send_to_char ("\x1B[0;36m", smack); send_to_char (buf, smack); send_to_char ("\x1B[37;0m\r", smack); } if (palio) { send_to_char ("\x1B[0;36m", palio); send_to_char (buf, palio); send_to_char ("\x1B[37;0m\r", palio); } if (orn) { send_to_char ("\x1B[31;1m", orn); send_to_char (buf, orn); send_to_char ("\x1B[37;0m\r", orn); } } for (gch = char_list; gch != NULL; gch = gch->next) { int position; sprintf (buf, "%s%s tells the group '%s'\x1B[37;0m", (IS_MOB (gch) ? "\x1B[37;0m" : color_table[gch->pcdata->colors[COLOR_TELL]].code), NAME (ch), new); position = gch->position; gch->position = POSITION_STANDING; if (is_same_group (gch, ch) && gch != ch) act (buf, gch, NULL, NULL, TO_CHAR); gch->position = position; } return; } #ifdef NEW_WORLD void do_tap (CHAR_DATA * ch, char *argy) { SPELL_DATA *sp; DEFINE_COMMAND ("tapping", do_tap, POSITION_STANDING, 0, LOG_NORMAL, "This command lets Aturion Engineers tap into the other alignments channels.") if ((sp = skill_lookup ("Tap", -1)) == NULL) return; if (IS_SET (ch->pcdata->act3, ACT3_TAP)) { REMOVE_BIT (ch->pcdata->act3, ACT3_TAP); send_to_char ("You are no longer tapping their channels.\n\r", ch); return; } if ((!IS_PROF (ch, PROF_ATURION_ENGINEER)) || (LEVEL (ch) < sp->spell_level)) { send_to_char ("Huh?\n\r", ch); return; } if (ch->move < sp->casting_time) { send_to_char ("You are too exhausted to perform this operation.\n\r", ch); return; } if (number_range (1, 100) < ch->pcdata->learned[gsn_tap]) { SUBMOVE(ch,sp->casting_time); SET_BIT (ch->pcdata->act3, ACT3_TAP); send_to_char ("You are now tapping their channels.\n\r", ch); skill_gain (ch, gsn_tap, TRUE); return; } else { SUBMOVE(ch,sp->casting_time); send_to_char ("Failed to tap their channels...\n\r", ch); } return; } #endif