/* Mud.h installations */ /* In the declare do fun section someplace, just pop these in */ DECLARE_DO_FUN( do_transmit ); /* For Comlink Frequency Stuff */ DECLARE_DO_FUN( do_tune ); /* For Comlink Frequency Stuff */ DECLARE_DO_FUN( do_frequency ); /* For Comlink Frequency Stuff */ /* Where the channels are located, replace one or add it in at end. Change * as required. */ #define CHANNEL_TRANSMIT BV18 /* this bitvector may be taken, substitute an open one. */ /* Under the act_comm.c section in mud.h place this somewhere. */ char * com_freq args( ( OBJ_DATA *comlink ) ); /* In tables.c */ /* In DO_FUN *skill_function */ /* Under the 'f' Section */ if ( !str_cmp( name, "do_frequency" )) return do_frequency; /* Under the 't' Section */ if ( !str_cmp( name, "do_transmit" )) return do_transmit; if ( !str_cmp( name, "do_tune" )) return do_tune; /* In char *skill_name function * I'd recommend putting it in alphabetical order, more efficient. * But it can really just go near the end, before return "reserved"; */ if ( skill == do_frequency ) return "do_frequency"; if ( skill == do_transmit ) return "do_transmit"; if ( skill == do_tune ) return "do_tune"; /* This stuff should just be tagged to the end of act_comm.c */ /* Special Channel for Actual Transmissions, by Arcturus */ void do_transmit( CHAR_DATA *ch, char *argument ) { char arg[MAX_INPUT_LENGTH], buf[MAX_STRING_LENGTH]; OBJ_DATA *comlink, *obj, *comlink2; bool ch_comlink = FALSE; DESCRIPTOR_DATA *d; argument = one_argument(argument, arg); if( arg[0] == '\0' || argument[0] == '\0' ) { send_to_char("Syntax: transmit <comlink> <transmission>\n\r", ch); return; } if ( ( comlink = get_obj_carry( ch, arg ) ) == NULL ) { if( ( comlink = get_obj_wear( ch, arg ) ) == NULL ) { send_to_char("&RYou do not have that item.&w\n\r", ch ); return; } } if( comlink->item_type != ITEM_COMLINK ) { send_to_char("You can't transmit with that.\n\r", ch); return; } separate_obj(comlink); if ( IS_SET( ch->in_room->room_flags, ROOM_SILENCE ) ) { send_to_char( "You can't do that here.\n\r", ch ); return; } if ( IS_NPC( ch ) && IS_AFFECTED( ch, AFF_CHARM ) ) { if ( ch->master ) send_to_char( "I don't think so...\n\r", ch->master ); return; } if ( !IS_NPC(ch) && IS_SET(ch->act, PLR_SILENCE) ) { ch_printf( ch, "You can't transmit.\n\r"); return; } REMOVE_BIT(ch->deaf, CHANNEL_TRANSMIT); set_char_color( AT_GOSSIP, ch ); argument = drunk_speech( argument, ch ); set_char_color( AT_GOSSIP, ch ); argument = drunk_speech( argument, ch ); ch_printf( ch, "&w&z[>ransmission&Y&B %s&w&z]&O:&w %s&b\n\r", com_freq(comlink), argument); sprintf( buf, "&w&z[>ransmission&Y&B %s&w&z] &z{&c$n&z}&O:&w $t", com_freq(comlink) ); for ( d = first_descriptor; d; d = d->next ) { CHAR_DATA *och; CHAR_DATA *vch; och = d->original ? d->original : d->character; vch = d->character; if ( d->connected == CON_PLAYING && vch != ch && !IS_SET(och->deaf, CHANNEL_TRANSMIT) ) { char *sbuf = argument; ch_comlink = FALSE; { if ( IS_IMMORTAL( och ) ) ch_comlink = TRUE; else { for ( obj = och->last_carrying; obj; obj = obj->prev_content ) { if (obj->item_type == ITEM_COMLINK) { if( comlink->value[0] == obj->value[0] ) { ch_comlink = TRUE; break; } } } } } if ( !ch_comlink ) continue; if ( !knows_language( vch, ch->speaking, ch ) && (!IS_NPC(ch) || ch->speaking != 0) ) sbuf = scramble(argument, ch->speaking); act( AT_GOSSIP, buf, ch, sbuf, vch, TO_VICT ); } } return; } /* Tuning, by Arcturus, modified from SWFotE */ void do_tune( CHAR_DATA *ch, char *argument ) { char buf[MAX_STRING_LENGTH]; char arg[MAX_INPUT_LENGTH]; OBJ_DATA *comlink; int frequency; argument = one_argument(argument, arg); if(IS_NPC(ch)) return; if( argument[0] == '\0' || arg[0] == '\0' ) { send_to_char("Usage: 'tune <obj> ###.###'.\n\r", ch); return; } if( (strlen(argument) != 7) || isalpha(argument[0]) || isalpha(argument[1]) || isalpha(argument[2]) || (argument[3] != '.') || isalpha(argument[4]) || isalpha(argument[5]) || isalpha(argument[6])) { send_to_char("Usage: 'tune <obj> ###.###'.\n\r", ch); return; } if ( ( comlink = get_obj_carry( ch, arg ) ) == NULL ) { if ( (comlink = get_obj_wear(ch, arg) ) == NULL ) { send_to_char("&RYou do not have that item.&w\n\r", ch ); return; } } if( comlink->item_type != ITEM_COMLINK ) { send_to_char("You can't tune that.\n\r", ch); return; } separate_obj(comlink); ch_printf(ch, "&wYou precisely tune your comlink, and it displays &z(&gFrequency:&G %s&z)&w.\n\r", argument); frequency = number_argument( argument, buf ); frequency *= 1000; frequency += atoi(buf); comlink->value[0] = frequency; return; } /* Comlink Frequency, by Arcturus */ char *com_freq(OBJ_DATA *comlink) { char buf[7]; static char buf_new[7]; sprintf(buf, "%3.3d.%3.3d", comlink->value[0]/1000, comlink->value[0]%1000 ); strcpy(buf_new, buf); return buf_new; } /* Comlink Frequency Check, by Arcturus */ void do_frequency(CHAR_DATA *ch, char *argument ) { OBJ_DATA *comlink; if ( ( comlink = get_obj_carry( ch, argument ) ) == NULL ) { if ( (comlink = get_obj_wear( ch, argument ) ) == NULL ) { send_to_char("&RYou do not have that item.&w\n\r", ch ); return; } } if( comlink->item_type != ITEM_COMLINK && comlink->item_type != ITEM_CARMOR ) { send_to_char("You can't check the frequency on that.\n\r", ch); return; } separate_obj(comlink); ch_printf(ch, "It is set to: &z(&gFrequency:&G %s&z)&w.", com_freq(comlink) ); return; }