/* ************************************************************************ * File: act.comm.c Part of CircleMUD * * Usage: Player-level communication commands * * * * All rights reserved. See license.doc for complete information. * * * * Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * * CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * ************************************************************************ */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include "structs.h" #include "utils.h" #include "comm.h" #include "interpreter.h" #include "handler.h" #include "db.h" #include "screen.h" #include "awake.h" void perform_tell(struct char_data *, struct char_data *, char *); extern void respond(struct char_data *ch, struct char_data *mob, char *str); /* extern variables */ extern struct room_data *world; extern struct descriptor_data *descriptor_list; extern struct char_data *character_list; /* Functions needed by check_lar */ ACMD(do_say); ACMD(do_gen_comm); ACMD(do_echo); ACMD(do_broadcast); ACMD(do_ooc); ACMD(do_osay); ACMD(do_wiztell); ACMD(do_wizfeel); extern int ANTI_LAR; extern int LAREXCEPT; /* * Anti 'Lar' code, by FJ */ /* Ch is the offending character that should be shot */ /* Str is the string to check, and channel is where to convey the response */ /* Works on titles too, but instead of responding on a channel, it changes */ /* thier title for them, and notitle's them automatically. */ bool check_lar( char_data *ch, char *str, int channel ) { char say_str[100]; char emote_str[100]; char chk_str[MAX_INPUT_LENGTH]; int i = 0; /* If it's not enabled */ if ( !ANTI_LAR ) return FALSE; /* So words are able to be exceptions without making an infinate loop */ if ( LAREXCEPT ) { LAREXCEPT = 0; return FALSE; } strcpy( chk_str, str ); for ( i = 0; chk_str[i] != '\0'; i++ ) chk_str[i] = tolower(chk_str[i]); sprintf(say_str,"I'm a complete idiot who greatly enjoys giving rim jobs to fat, elderly, balding men."); sprintf(emote_str,"is a complete idiot who greatly enjoys giving rim jobs to fat, elderly, balding men."); /* President level or higher are immune */ if ( GET_LEVEL(ch) >= 8 ) return FALSE; /* If it isn't found, return false so that the parent function can continue */ if ( (!strstr(chk_str,"lar") && !strstr(chk_str,"keke") && !strstr(chk_str,"l4r") && !strstr(chk_str,"l a r") && !strstr(chk_str,"k e k e") && !strstr(chk_str,"l@r") && !strstr(chk_str,"k3k3") && !strstr(chk_str,"k 3 k 3") && !strstr(chk_str,"l 4 r") && !strstr(chk_str,"l @ r") && !strstr(chk_str,"l-a-r") && !strstr(chk_str,"l-ar") && !strstr(chk_str,"k-e-k-e") && !strstr(chk_str,"ke-ke") && !strstr(chk_str,"k-eke") && !strstr(chk_str,"la-r") && !strstr(chk_str,"l-4-r") && !strstr(chk_str,"l-4r") && !strstr(chk_str,"l-@-r") && !strstr(chk_str,"l-@r") && !strstr(chk_str,"l@-r")) || /* Exceptions to the lar cases (no ! on the strstr() for these) */ (strstr(chk_str,"tarislar") || strstr(chk_str,"regular") || strstr(chk_str,"Larry") || strstr(chk_str,"hilarious") || strstr(chk_str,"skylarke") || strstr(chk_str,"vocabulary") || strstr(chk_str,"lard") || strstr(chk_str,"angular") || strstr(chk_str,"triangular") || strstr(chk_str,"large") || strstr(chk_str,"rectangular") || strstr(chk_str,"salary") || strstr(chk_str,"particular") || strstr(chk_str,"similar") || strstr(chk_str,"largly") || strstr(chk_str,"solaris") )) return FALSE; /* * If we want to add words that are exceptions, we have to redo this function so that * it doesn't use the functions that called this one. */ /* Set LAREXCEPT to 1 so that it doesn't infinate loop, so it doesn't check the 2nd time * around */ LAREXCEPT = 1; /* If it gets past there, it is found, and punnishment needs to be dealt */ /* Definitions for channel are in handler.h */ switch ( channel ) { case CHAN_SAY: do_say( ch, say_str, 0, 0 ); break; case CHAN_EMOTE: do_echo( ch, emote_str, find_command("emote"), SCMD_EMOTE ); break; case CHAN_NEWBIE: do_gen_comm( ch, say_str, find_command("newbie"), SCMD_NEWBIE ); break; case CHAN_RADIO: if ( GET_LEVEL(ch) >= 2 ) do_broadcast( ch, "all I'm a complete idiot who greatly enjoys giving rim jobs to fat, elderly, balding men.", 0, 0 ); else do_broadcast( ch, say_str, 0, 0 ); break; case CHAN_OOC: do_gen_comm( ch, say_str, find_command("ooc"), SCMD_OOC ); break; case CHAN_OSAY: do_say( ch, say_str, find_command("osay"), SCMD_OSAY ); break; case CHAN_WT: do_wiztell( ch, say_str, 0, 0 ); break; case CHAN_WF: do_wizfeel( ch, "emote is a complete idiot who greatly enjoys giving rim jobs to fat, elderly, balding men.", 0, 0 ); break; case CHAN_SHOUT: do_gen_comm( ch, say_str, find_command("shout"), SCMD_SHOUT ); break; case CHAN_TELL: case CHAN_WHISPER: case CHAN_TITLE: /* only a CHAN to keep consistant */ default: set_title( ch, "the rim job boy!" ); PLR_TOG_CHK( ch, PLR_NOTITLE ); send_to_char("If yas wants to be an idiot, others shall know!\n\r",ch); } return TRUE; } ACMD(do_say) { skip_spaces(&argument); if (!*argument) send_to_char(ch, "Yes, but WHAT do you want to say?\r\n"); else { /* Twink check */ if ( check_lar( ch, argument, CHAN_SAY ) ) return; /** new code by WASHU **/ if(subcmd == SCMD_OSAY) sprintf(buf,"$n says ^mOOCly^n, \"%s^n\"",argument); else sprintf(buf, "$n says, \"%s^n\"", argument); act(buf, FALSE, ch, 0, 0, TO_ROOM); /** Comment **/ if (PRF_FLAGGED(ch, PRF_NOREPEAT)) send_to_char(OK, ch); else { delete_doubledollar(argument); if(subcmd == SCMD_OSAY) send_to_char(ch, "You say ^mOOCly^n, \"%s^n\"\r\n", argument); else send_to_char(ch, "You say, \"%s^n\"\r\n", argument); } } } ACMD(do_exclaim) { skip_spaces(&argument); if (!*argument) send_to_char(ch, "Yes, but WHAT do you like to exclaim?\r\n"); else { /* Twink Check */ if ( check_lar( ch, argument, CHAN_SAY ) ) return; sprintf(buf, "$n exclaims, \"%s!^n\"", argument); act(buf, FALSE, ch, 0, 0, TO_ROOM); if (PRF_FLAGGED(ch, PRF_NOREPEAT)) send_to_char(OK, ch); else { send_to_char(ch, "You exclaim, \"%s!^n\"\r\n", argument); } } } ACMD(do_gsay) { struct char_data *k; struct follow_type *f; bool found = FALSE; struct obj_data *obj; skip_spaces(&argument); if (!IS_AFFECTED(ch, AFF_GROUP)) { send_to_char("But you are not the member of a group!\r\n", ch); return; } if (!*argument) send_to_char("Yes, but WHAT do you want to group-say?\r\n", ch); else { for (obj = ch->cyberware; (obj && !found); obj = obj->next_content) if (GET_OBJ_VAL(obj, 2) == 2) found = TRUE; for (obj = ch->carrying; (obj && !found); obj = obj->next_content) if (GET_OBJ_TYPE(obj) == ITEM_RADIO) found = TRUE; if (!found && (!IS_NPC(ch) && GET_LEVEL(ch) < LVL_LEGEND)) { send_to_char("You need a radio to communicate on such a scale.\r\n", ch); return; } if (ch->master) k = ch->master; else k = ch; /* make color and non-color argument */ sprintf(buf, "^g\\$n/[24 kHz]: %s^n", argument); /* check for leader first */ if (IS_AFFECTED(k, AFF_GROUP) && (k != ch)) { if (GET_LEVEL(k) < LVL_LEGEND) { found = FALSE; for (obj = k->cyberware; (obj && !found); obj = obj->next_content) if (GET_OBJ_VAL(obj, 2) == 2 || GET_OBJ_VAL(obj, 2) == 3) found = TRUE; for (obj = k->carrying; (obj && !found); obj = obj->next_content) if (GET_OBJ_TYPE(obj) == ITEM_RADIO) found = TRUE; } if (IS_NPC(k) || (!IS_NPC(k) && (GET_LEVEL(k) >= LVL_LEGEND || found))) act(buf, FALSE, ch, 0, k, TO_VICT); } for (f = k->followers; f; f = f->next) if (IS_AFFECTED(f->follower, AFF_GROUP) && (f->follower != ch)) { if (GET_LEVEL(f->follower) < LVL_LEGEND) { found = FALSE; for (obj = f->follower->cyberware; (obj && !found); obj = obj->next_content) if (GET_OBJ_VAL(obj, 2) == 2 || GET_OBJ_VAL(obj, 2) == 3) found = TRUE; for (obj = f->follower->carrying; (obj && !found); obj = obj->next_content) if (GET_OBJ_TYPE(obj) == ITEM_RADIO) found = TRUE; } if (IS_NPC(f->follower) || (!IS_NPC(f->follower) && (GET_LEVEL(f->follower) >= LVL_LEGEND || found))) act(buf, FALSE, ch, 0, f->follower, TO_VICT); } if (PRF_FLAGGED(ch, PRF_NOREPEAT)) send_to_char(OK, ch); else act(buf, FALSE, ch, 0, 0, TO_CHAR); } } int ok_hit(struct char_data *mob) { SPECIAL(shop_keeper); SPECIAL(receptionist); SPECIAL(taxi); if ((!GET_MOB_SPEC(mob) || (GET_MOB_SPEC(mob) != shop_keeper && GET_MOB_SPEC(mob) != receptionist && GET_MOB_SPEC(mob) != taxi)) && GET_POS(mob) > POS_SLEEPING && !FIGHTING(mob)) { if (GET_POS(mob) < POS_STANDING) GET_POS(mob) = POS_STANDING; return 1; } else return 0; } void perform_tell(struct char_data *ch, struct char_data *vict, char *arg) { struct obj_data *obj; int fvict = 0, fch = 0, i; bool found = FALSE; /* Twink check */ if ( check_lar( ch, arg, CHAN_TELL ) ) return; if (GET_POS(vict) < POS_RESTING || GET_POS(ch) < POS_RESTING) return; if (!IS_PROJECT(ch)) { if (IS_NPC(ch) || GET_LEVEL(ch) >= LVL_LEGEND) fch = 1; else { for (obj = ch->cyberware; obj && !fch; obj = obj->next_content) if (GET_OBJ_VAL(obj, 2) == 4) fch = 1; for (i = 0; !fch && i < (NUM_WEARS - 1); i++) if (GET_EQ(ch, i) && GET_OBJ_TYPE(GET_EQ(ch, i)) == ITEM_PHONE) fch = 1; for (obj = ch->carrying; obj && !fch; obj = obj->next_content) if (GET_OBJ_TYPE(obj) == ITEM_PHONE) fch = 1; for (obj = world[ch->in_room].contents; obj; obj = obj->next_content) if (GET_OBJ_TYPE(obj) == ITEM_PHONE && !CAN_WEAR(obj, ITEM_WEAR_TAKE)) fch = 1; } if (IS_NPC(vict) || IS_NPC(ch) || GET_LEVEL(vict) >= LVL_LEGEND || GET_LEVEL(ch) >= LVL_LEGEND) fvict = 1; else { for (obj = vict->cyberware; obj && !fvict; obj = obj->next_content) if (GET_OBJ_VAL(obj, 2) == 4) fvict = 1; for (i = 0; !fvict && i < NUM_WEARS; i++) if (GET_EQ(vict, i) && GET_OBJ_TYPE(GET_EQ(vict, i)) == ITEM_PHONE) fvict = 1; for (obj = vict->carrying; obj && !fvict; obj = obj->next_content) if (GET_OBJ_TYPE(obj) == ITEM_PHONE) fvict = 1; for (obj = world[vict->in_room].contents; obj; obj = obj->next_content) if (GET_OBJ_TYPE(obj) == ITEM_PHONE && !CAN_WEAR(obj, ITEM_WEAR_TAKE)) fvict = 1; } if (!fch || !fvict) { if (!fch) send_to_char("How can you call someone without a phone?\r\n", ch); else act("$N can't hear your attempt to communicate.", FALSE, ch, 0, vict, TO_CHAR); return; } } sprintf(buf, "^r$n tells you, '%s^r'^n", arg); act(buf, FALSE, ch, 0, vict, TO_VICT); if (PRF_FLAGGED(ch, PRF_NOREPEAT)) send_to_char(OK, ch); else { sprintf(buf, "^rYou tell $N, '%s'^n", arg); act(buf, FALSE, ch, 0, vict, TO_CHAR); } if (!IS_NPC(ch)) GET_LAST_TELL(vict) = GET_IDNUM(ch); else GET_LAST_TELL(vict) = NOBODY; } /* * Yes, do_tell probably could be combined with whisper and ask, but * called frequently, and should IMHO be kept as tight as possible. */ ACMD(do_tell) { struct char_data *vict = NULL; SPECIAL(johnson); half_chop(argument, buf, buf2); if (!*buf || !*buf2) send_to_char("Who do you wish to tell what??\r\n", ch); else if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOTELL)) send_to_char("You can't tell other people while you have notell on.\r\n", ch); else if (ROOM_FLAGGED(ch->in_room, ROOM_SOUNDPROOF)) send_to_char("The walls seem to absorb your words.\r\n", ch); else if (IS_PERSONA(ch)) send_to_char("You can't do that while connected.\r\n", ch); else if (!(vict = get_player_vis(ch, buf, 0))) { if (!(vict = get_char_vis(ch, buf)) || GET_RACE(vict) != CLASS_HUMANOID) // search for player first, then mob send_to_char(NOPERSON, ch); } if (!vict || (IS_NPC(vict) && GET_RACE(vict) != CLASS_HUMANOID)) return; if (ch == vict) send_to_char("You try to tell yourself something.\r\n", ch); else if (IS_PROJECT(ch) && !(IS_ASTRAL(vict) || PLR_FLAGGED(vict, PLR_PERCEIVE))) send_to_char("You can only communicate with astral beings.\r\n", ch); else if (IS_PERSONA(vict) || IS_ASTRAL(vict)) send_to_char(NOPERSON, ch); else if (GET_POS(vict) < POS_RESTING || PRF_FLAGGED(vict, PRF_NOTELL) || ROOM_FLAGGED(vict->in_room, ROOM_SOUNDPROOF)) act("$E can't hear you.", FALSE, ch, 0, vict, TO_CHAR); else if (IS_NPC(vict) && !vict->desc) { sprintf(buf, "^r$n tells you, '%s^r'^n", buf2); act(buf, FALSE, ch, 0, vict, TO_VICT); if (PRF_FLAGGED(ch, PRF_NOREPEAT)) send_to_char(OK, ch); else { sprintf(buf, "^rYou tell $N, '%s'^n", buf2); act(buf, FALSE, ch, 0, vict, TO_CHAR); } if (GET_MOB_SPEC(vict) == johnson); else if (!GET_MOB_SPEC(vict) || !(GET_MOB_SPEC(vict) (ch, vict, cmd, buf2))) respond(ch, vict, buf2); } else if (!IS_NPC(vict) && !vict->desc) /* linkless */ act("$E's linkless at the moment.", FALSE, ch, 0, vict, TO_CHAR); else if (PLR_FLAGGED(vict, PLR_WRITING) || PLR_FLAGGED(vict, PLR_MAILING)) act("$E's writing a message right now; try again later.", FALSE, ch, 0, vict, TO_CHAR); else if (PRF_FLAGGED(vict, PRF_AFK)) act("$E's afk at the moment.", FALSE, ch, 0, vict, TO_CHAR); else if (PLR_FLAGGED(vict, PLR_EDITING)) act("$E's editing right now, try again later.", FALSE, ch, 0, vict, TO_CHAR); else perform_tell(ch, vict, buf2); } ACMD(do_reply) { struct char_data *tch = character_list; skip_spaces(&argument); if (GET_LAST_TELL(ch) == NOBODY) send_to_char("You have no-one to reply to!\r\n", ch); else if (!*argument) send_to_char("What is your reply?\r\n", ch); else { /* Make sure the person you're replying to is still playing by searching * for them. Note, this will break in a big way if I ever implement some * scheme where it keeps a pool of char_data structures for reuse. */ for (; tch != NULL; tch = tch->next) if (!IS_NPC(tch) && GET_IDNUM(tch) == GET_LAST_TELL(ch)) break; if (tch == NULL || (tch && GET_IDNUM(tch) != GET_LAST_TELL(ch))) send_to_char("They are no longer playing.\r\n", ch); else perform_tell(ch, tch, argument); } } ACMD(do_ask) { skip_spaces(&argument); if (!*argument) send_to_char(ch, "Yes, but WHAT do you like to ask?\r\n"); else { sprintf(buf, "$n asks, \"%s?^n\"", argument); act(buf, FALSE, ch, 0, 0, TO_ROOM); if (PRF_FLAGGED(ch, PRF_NOREPEAT)) send_to_char(OK, ch); else { send_to_char(ch, "You ask, \"%s?^n\"\r\n", argument); } } } ACMD(do_spec_comm) { struct char_data *vict; char *action_sing, *action_plur, *action_others; if (subcmd == SCMD_WHISPER) { action_sing = "whisper to"; action_plur = "whispers to"; action_others = "$n whispers something to $N."; } else { action_sing = "ask"; action_plur = "asks"; action_others = "$n asks $N something."; } /* Twink check */ if ( check_lar( ch, argument, CHAN_WHISPER ) ) return; half_chop(argument, buf, buf2); if (!*buf || !*buf2) { sprintf(buf, "Whom do you want to %s... and what??\r\n", action_sing); send_to_char(buf, ch); } else if (!(vict = get_char_room_vis(ch, buf))) send_to_char(NOPERSON, ch); else if (vict == ch) send_to_char("You can't get your mouth close enough to your ear...\r\n", ch); else if (IS_ASTRAL(ch) && !(IS_ASTRAL(vict) || PLR_FLAGGED(vict, PLR_PERCEIVE) || IS_DUAL(vict))) send_to_char("That is most assuredly not possible.\r\n", ch); else { sprintf(buf, "$n %s you, \"%s%s^n\"", action_plur, buf2, (subcmd == SCMD_WHISPER) ? "" : "?"); act(buf, FALSE, ch, 0, vict, TO_VICT); if (PRF_FLAGGED(ch, PRF_NOREPEAT)) send_to_char(OK, ch); else { sprintf(buf, "You %s %s, \"%s%s^n\"", action_sing, GET_NAME(vict), buf2, (subcmd == SCMD_WHISPER) ? "" : "?"); act(buf, FALSE, ch, 0, 0, TO_CHAR); } act(action_others, FALSE, ch, 0, vict, TO_NOTVICT); } } ACMD(do_page) { struct descriptor_data *d; struct char_data *vict; half_chop(argument, arg, buf2); if (IS_NPC(ch)) send_to_char("Monsters can't page.. go away.\r\n", ch); else if (!*arg) send_to_char("Whom do you wish to page?\r\n", ch); else { sprintf(buf, "\007\007*%s* %s", GET_NAME(ch), buf2); if ((vict = get_char_vis(ch, arg)) != NULL) { if (vict == ch) { send_to_char("What's the point of that?\r\n", ch); return; } act(buf, FALSE, ch, 0, vict, TO_VICT); if (PRF_FLAGGED(ch, PRF_NOREPEAT)) send_to_char(OK, ch); else act(buf, FALSE, ch, 0, vict, TO_CHAR); return; } else send_to_char("There is no such person in the game!\r\n", ch); } } ACMD(do_radio) { struct obj_data *obj, *radio = NULL; char *one, *two; int i, cyberware = 0; for (obj = ch->carrying; !radio && obj; obj = obj->next_content) if (GET_OBJ_TYPE(obj) == ITEM_RADIO) radio = obj; for (i = 0; !radio && i < NUM_WEARS; i++) if (GET_EQ(ch, i) && GET_OBJ_TYPE(GET_EQ(ch, i)) == ITEM_RADIO) radio = GET_EQ(ch, i); for (obj = ch->cyberware; !radio && obj; obj = obj->next_content) if (GET_OBJ_VAL(obj, 2) == 2 || GET_OBJ_VAL(obj, 3)) { radio = obj; cyberware = 1; } if (!radio) { send_to_char("You have to have a radio to do that!\r\n", ch); return; } one = new char[80]; two = new char[80]; any_one_arg(any_one_arg(argument, one), two); if (!*one) { act("$p:", FALSE, ch, radio, 0, TO_CHAR); if (GET_OBJ_VAL(radio, (cyberware ? 3 : 0)) == -1) send_to_char(" Mode: scan\r\n", ch); else if (!GET_OBJ_VAL(radio, (cyberware ? 3 : 0))) send_to_char(" Mode: off\r\n", ch); else send_to_char(ch, " Mode: center @ %d kHz\r\n", GET_OBJ_VAL(radio, (cyberware ? 3 : 0))); if (GET_OBJ_VAL(radio, (cyberware ? 6 : 3))) send_to_char(ch, " Crypt: on (level %d)\r\n", GET_OBJ_VAL(radio, (cyberware ? 5 : 2))); else send_to_char(" Crypt: off\r\n", ch); return; } else if (!str_cmp(one, "off")) { act("You turn $p off.", FALSE, ch, radio, 0, TO_CHAR); GET_OBJ_VAL(radio, (cyberware ? 3 : 0)) = 0; } else if (!str_cmp(one, "scan")) { act("You set $p to scanning mode.", FALSE, ch, radio, 0, TO_CHAR); GET_OBJ_VAL(radio, (cyberware ? 3 : 0)) = -1; } else if (!str_cmp(one, "center")) { i = atoi(two); if (i > 300) act("$p cannot center a frequency higher than 300 kHz.", FALSE, ch, radio, 0, TO_CHAR); else if (i < 225) act("$p cannot center a frequency lower than 225 kHz.", FALSE, ch, radio, 0, TO_CHAR); else { sprintf(buf, "$p is now centered at %d kHz.", i); act(buf, FALSE, ch, radio, 0, TO_CHAR); GET_OBJ_VAL(radio, (cyberware ? 3 : 0)) = i; } } else if (!str_cmp(one, "crypt")) { if (!str_cmp(two, "on")) { if (GET_OBJ_VAL(radio, (cyberware ? 6 : 3))) act("$p's crypt mode is already enabled.", FALSE, ch, radio, 0, TO_CHAR); else { send_to_char("Crypt mode enabled.\r\n", ch); GET_OBJ_VAL(radio, (cyberware ? 6 : 3)) = 1; } } else if (!str_cmp(two, "off")) { if (!GET_OBJ_VAL(radio, (cyberware ? 6 : 3))) act("$p's crypt mode is already disabled.", FALSE, ch, radio, 0, TO_CHAR); else { send_to_char("Crypt mode disabled.\r\n", ch); GET_OBJ_VAL(radio, (cyberware ? 6 : 3)) = 0; } } else send_to_char("Crypt mode must be either 'on' or 'off'.\r\n", ch); } else send_to_char("That's not a valid option.\r\n", ch); } ACMD(do_broadcast) { struct obj_data *obj, *radio = NULL; struct descriptor_data *d; int i, j, frequency, to_room, cyberware = 0, crypt, decrypt; if ( IS_ASTRAL(ch) ) { send_to_char("You can't manipulate electronics from the astral plane.\n\r",ch); return; } for (obj = ch->carrying; !radio && obj; obj = obj->next_content) if (GET_OBJ_TYPE(obj) == ITEM_RADIO) radio = obj; for (i = 0; !radio && i < NUM_WEARS; i++) if (GET_EQ(ch, i) && GET_OBJ_TYPE(GET_EQ(ch, i)) == ITEM_RADIO) radio = GET_EQ(ch, i); for (obj = ch->cyberware; !radio && obj; obj = obj->next_content) if (GET_OBJ_VAL(obj, 2) == 2 || GET_OBJ_VAL(obj, 2) == 3) { radio = obj; cyberware = 1; } if (IS_NPC(ch) || GET_LEVEL(ch) >= LVL_LEGEND) { argument = any_one_arg(argument, arg); if (!str_cmp(arg,"all") && !IS_NPC(ch)) frequency = -1; else { frequency = atoi(arg); if (frequency < 225 || frequency > 300) { send_to_char("Frequency must range between 225 and 300.\r\n", ch); return; } } } else if (!radio) { send_to_char("You have to have a radio to do that!\r\n", ch); return; } else if (!GET_OBJ_VAL(radio, (cyberware ? 3 : 0))) { act("$p must be on in order to broadcast.", FALSE, ch, radio, 0, TO_CHAR); return; } else if (GET_OBJ_VAL(radio, (cyberware ? 3 : 0)) == -1) { act("$p can't broadcast while scanning.", FALSE, ch, radio, 0, TO_CHAR); return; } else frequency = GET_OBJ_VAL(radio, (cyberware ? 3 : 0)); if (PLR_FLAGGED(ch, PLR_NOSHOUT)) { send_to_char("You aren't allowed to broadcast!\r\n", ch); return; } skip_spaces(&argument); if (!*argument) { send_to_char("What do you want to broadcast?\r\n", ch); return; } /* Twink check */ if ( check_lar( ch, argument, CHAN_RADIO ) ) return; if ( frequency > 0 ) { sprintf(buf, "^y\\$n/[%d kHz]: %s^N", frequency, argument); sprintf(buf1, "^y\\$N/[%d kHz]: %s^N", frequency, argument); } else { sprintf(buf, "^y\\$n/[All Frequencies]: %s^N", argument); sprintf(buf1, "^y\\$N/[All Frequencies]: %s^N", argument); } if (radio && GET_OBJ_VAL(radio, (cyberware ? 6 : 3)) == 1) crypt = GET_OBJ_VAL(radio, (cyberware ? 5 : 2)); else crypt = 0; if (PRF_FLAGGED(ch, PRF_NOREPEAT)) send_to_char(OK, ch); else act(buf, FALSE, ch, 0, 0, TO_CHAR); for (d = descriptor_list; d; d = d->next) { if (!d->connected && d != ch->desc && d->character && !PLR_FLAGGED(d->character, PLR_WRITING | PLR_MAILING | PLR_EDITING) && !IS_PERSONA(d->character) && !IS_PROJECT(d->character) && !ROOM_FLAGGED(d->character->in_room, ROOM_SOUNDPROOF) && !ROOM_FLAGGED(d->character->in_room, ROOM_SENT)) { if (!IS_NPC(d->character) && GET_LEVEL(d->character) < LVL_LEGEND) { radio = NULL; cyberware = 0; for (obj = d->character->cyberware; obj && !radio; obj = obj->next_content) if (GET_OBJ_VAL(obj, 2) == 2 || GET_OBJ_VAL(obj, 2) == 3) { radio = obj; cyberware = 1; } for (obj = d->character->carrying; obj && !radio; obj = obj->next_content) if (GET_OBJ_TYPE(obj) == ITEM_RADIO) radio = obj; for (i = 0; !radio && i < NUM_WEARS; i++) if (GET_EQ(d->character, i) && GET_OBJ_TYPE(GET_EQ(d->character, i)) == ITEM_RADIO) radio = GET_EQ(ch, i); for (obj = world[d->character->in_room].contents; obj && !radio; obj = obj->next_content) if (GET_OBJ_TYPE(obj) == ITEM_RADIO && !CAN_WEAR(obj, ITEM_WEAR_TAKE)) radio = obj; if (radio) { if (CAN_WEAR(radio, ITEM_WEAR_EAR) || cyberware) to_room = 0; else to_room = 1; i = GET_OBJ_VAL(radio, (cyberware ? 3 : 0)); j = GET_OBJ_VAL(radio, (cyberware ? 4 : 1)); decrypt = GET_OBJ_VAL(radio, (cyberware ? 5 : 2)); if (decrypt >= crypt && (i == -1 || frequency == -1 || (frequency >= (i - j) && frequency <= (i + j)))) { if (to_room) { act(buf, FALSE, ch, 0, d->character, TO_VICT); act(buf1, FALSE, d->character, 0, ch, TO_NOTVICT); SET_BIT(ROOM_FLAGS(d->character->in_room), ROOM_SENT); } else act(buf, FALSE, ch, 0, d->character, TO_VICT); } } } else if (!PRF_FLAGGED(d->character, PRF_NORADIO)) act(buf, FALSE, ch, 0, d->character, TO_VICT); } } for (d = descriptor_list; d; d = d->next) if (!d->connected && d->character && ROOM_FLAGGED(d->character->in_room, ROOM_SENT)) REMOVE_BIT(ROOM_FLAGS(d->character->in_room), ROOM_SENT); } /********************************************************************** * generalized communication func, originally by Fred C. Merkel (Torg) * *********************************************************************/ ACMD(do_gen_comm) { struct descriptor_data *i; static int channels[] = { PRF_DEAF, PRF_NONEWBIE, PRF_NOOOC }; /* * com_msgs: [0] Message if you can't perform the action because of noshout * [1] name of the action * [2] message if you're not on the channel * [3] a color string. */ static const char *com_msgs[][5] = { {"You cannot shout!!\r\n", "shout", "Turn off your noshout flag first!\r\n", "^Y", B_YELLOW}, {"You can't use the newbie channel!\r\n", "newbie", "You've turned that channel off!\r\n", "^G", B_GREEN}, {"You can't use the ooc channel!\r\n", "ooc", "^m", KMAG} }; /* to keep pets, etc from being ordered to shout */ if (!ch->desc && !MOB_FLAGGED(ch, MOB_SPEC)) return; if (IS_PERSONA(ch)) { send_to_char("You cannot communicate loudly while decking.\r\n", ch); return; } if (IS_ASTRAL(ch)) { send_to_char(ch, "Astral beings cannot %s.\r\n", com_msgs[subcmd][1]); return; } if (PLR_FLAGGED(ch, PLR_NOSHOUT)) { send_to_char(com_msgs[subcmd][0], ch); return; } if (ROOM_FLAGGED(ch->in_room, ROOM_SOUNDPROOF)) { send_to_char("The walls seem to absorb your words.\r\n", ch); return; } /* make sure the char is on the channel */ if (PRF_FLAGGED(ch, channels[subcmd])) { send_to_char(com_msgs[subcmd][2], ch); return; } if (subcmd == SCMD_NEWBIE) { if (IS_NPC(ch)) { send_to_char("No.\r\n", ch); return; } else if (GET_LEVEL(ch) == 1 && !PLR_FLAGGED(ch, PLR_NEWBIE)) { send_to_char("You are too experienced to use the newbie channel.\r\n", ch); return; } } skip_spaces(&argument); /* make sure that there is something there to say! */ if (!*argument) { sprintf(buf1, "Yes, %s, fine, %s we must, but WHAT???\r\n", com_msgs[subcmd][1], com_msgs[subcmd][1]); send_to_char(buf1, ch); return; } if (PRF_FLAGGED(ch, PRF_NOREPEAT)) send_to_char(OK, ch); else if (subcmd == SCMD_SHOUT) { /* Twink check */ if ( check_lar( ch, argument, CHAN_SHOUT ) ) return; sprintf(buf, "%s$n shouts, '%s'^N", com_msgs[subcmd][3], argument); sprintf(buf1, "%sYou shout, '%s'^N", com_msgs[subcmd][3], argument); act(buf1, FALSE, ch, 0, 0, TO_CHAR); } else if(subcmd == SCMD_OOC) { /* Twink check */ if ( check_lar( ch, argument, CHAN_OOC ) ) return; sprintf(buf, "%s$n [OOC], \"%s\"^N", com_msgs[subcmd][3], argument); act(buf, FALSE, ch, 0, 0, TO_CHAR | TO_SLEEP); /* added so they can see it in their sleep */ } else { /* Twink check */ if ( check_lar( ch, argument, CHAN_NEWBIE ) ) return; sprintf(buf, "%s$n |]newbie[| %s^N", com_msgs[subcmd][3], argument); act(buf, FALSE, ch, 0, 0, TO_CHAR); } /* now send all the strings out */ for (i = descriptor_list; i; i = i->next) { if (!i->connected && i != ch->desc && i->character && !PRF_FLAGGED(i->character, channels[subcmd]) && !IS_PERSONA(i->character) && !PLR_FLAGGED(i->character, PLR_WRITING | PLR_MAILING | PLR_EDITING) && !IS_PROJECT(i->character) && !ROOM_FLAGGED(i->character->in_room, ROOM_SOUNDPROOF)) { if (subcmd == SCMD_SHOUT && ((world[ch->in_room].zone != world[i->character->in_room].zone) || GET_POS(i->character) < POS_RESTING) ) continue; /* don't let them shout cab to cab */ if ( subcmd == SCMD_SHOUT && (world[ch->in_room].number/100) == 6 && ch->in_room != i->character->in_room ) continue; if (subcmd == SCMD_SHOUT || IS_NPC(i->character) || GET_LEVEL(i->character) >= LVL_LEGEND || PLR_FLAGGED(i->character, PLR_NEWBIE)) act(buf, FALSE, ch, 0, i->character, TO_VICT); else if ( subcmd == SCMD_OOC ) act(buf, FALSE, ch, 0, i->character, TO_VICT | TO_SLEEP); } } } ACMD(do_qcomm) { struct descriptor_data *i; bool found = FALSE; struct obj_data *obj; if (!PRF_FLAGGED(ch, PRF_QUEST)) { send_to_char("You aren't even part of the quest!\r\n", ch); return; } skip_spaces(&argument); if (!*argument) { sprintf(buf, "%s? Yes, fine, %s we must, but WHAT??\r\n", CMD_NAME, CMD_NAME); CAP(buf); send_to_char(buf, ch); } else { for (obj = ch->cyberware; (obj && !found); obj = obj->next_content) if (GET_OBJ_VAL(obj, 2) == 2) found = TRUE; for (obj = ch->carrying; (obj && !found); obj = obj->next_content) if (GET_OBJ_TYPE(obj) == ITEM_RADIO) found = TRUE; if (!found && !IS_NPC(ch) && GET_LEVEL(ch) < LVL_LEGEND) { send_to_char("You need a radio to communicate on such a scale.\r\n", ch); return; } if (PRF_FLAGGED(ch, PRF_NOREPEAT)) send_to_char(OK, ch); else { if (subcmd == SCMD_QSAY) sprintf(buf, "\\$n/[50 kHz]: %s", argument); else strcpy(buf, argument); act(buf, FALSE, ch, 0, argument, TO_CHAR); } if (subcmd == SCMD_QSAY) sprintf(buf, "\\$n/[50 kHz]: %s", argument); else strcpy(buf, argument); for (i = descriptor_list; i; i = i->next) if (!i->connected && i != ch->desc && PRF_FLAGGED(i->character, PRF_QUEST)) { if (GET_LEVEL(i->character) < LVL_LEGEND) { found = FALSE; for (obj = i->character->cyberware; (obj && !found); obj = obj->next_content) if (GET_OBJ_VAL(obj, 2) == 2 || GET_OBJ_VAL(obj, 2) == 3) found = TRUE; for (obj = i->character->carrying; (obj && !found); obj = obj->next_content) if (GET_OBJ_TYPE(obj) == ITEM_RADIO) found = TRUE; } if (IS_NPC(i->character) || (!IS_NPC(i->character) && (GET_LEVEL(i->character) >= LVL_LEGEND || found))) act(buf, 0, ch, 0, i->character, TO_VICT); } } }