Gangien /* This is prolly the hardest snippet of mine to put in.. * And I wouldn't attempt to do this unless you know what you're doing.. * You have to add this to act_wiz.c and change all the log_string's * to monitor_chan.. ie * to_channel( log_buf, CHANNEL_MONITOR, "Monitor", ch->level ); * TO: monitor_chan( log_buf, MONITOR_CONNECT, get_trust( ch ) ); * * Also change the log_string function to the following..: void log_string_plus( const char *str, sh_int log_type, sh_int level ) { char *strtime; int offset; strtime = ctime( ¤t_time ); strtime[strlen(strtime)-1] = '\0'; fprintf( stderr, "%s :: %s\n", strtime, str ); if ( strncmp( str, "Log ", 4 ) == 0 ) offset = 4; else offset = 0; if ( level == MAX_LEVEL + 1) return; switch( log_type ) { default: monitor_chan( str, MONITOR_GEN_IMM, level); break; case LOG_BUILD: monitor_chan( str, MONITOR_BUILD, level); break; case LOG_COMM: monitor_chan( str, MONITOR_CONNECT, level); break; case LOG_WARN: to_channel (str + offset, CHANNEL_WARN, "Warn", level ); break; case LOG_ALL: monitor_chan( str, MONITOR_LOG, level); break; } return; } * one last thing.. you have to give bv's to the channels.. so in mud.h add * em for all the monitors.. */ /* You could add this part to mud.h but, I like it here so I can see it all at * the same time -Gangien */ struct monitor_type { char *name; int channel; int min_level; char *col; /* Could prolly take this out too.. but I'm just to lazy.. */ char *id; char *on_name; char *off_name; }; /* You'll have to change the levels here.. like in the first one.. it says * { "connection", MONITOR_CONNECT, 101, "&G", "&BMON_CON&G", * change ^ this to prolly 51.. or whatever level * you want.. you should modify all of depending on how you trust your imms ;) * -Gangien */ struct monitor_type monitor_table[] = { { "connection", MONITOR_CONNECT, 101, "&G", "MON_CON", "&c[&C CONNECTION &c]&G Shows details of players connecting to the mud.\n\r", "&c[&z connection &c]&G Not showing details of players connecting.\n\r" }, { "area_update", MONITOR_AREA_UPDATE, 106, "&G", "AREA_UPD", "&c[&C AREA_UPDATE &c]&G Informs you of ALL area updates.\n\r", "&c[&z area_update &c]&G You are not informed of area updates.\n\r" }, { "area_bugs", MONITOR_AREA_BUGS, 105, "&G", "AREA_BUG", "&c[&C AREA_BUGS &c]&G Notifies you of any errors within areas.\n\r", "&c[&z area_bugs &c]&G You are not told of errors within areas.\n\r" }, { "area_save", MONITOR_AREA_SAVING, 105, "&G", "AREA_SAVE", "&c[&C AREA_SAVE &c]&G You get told of all area saving.\n\r", "&c[&z area_save &c]&G You don't get told of all area saves.\n\r" }, { "objects", MONITOR_OBJ, 105, "&G", "MON_OBJ", "&c[&C OBJECTS &c]&G You are told of problems relating to objects.\n\r", "&c[&z objects &c]&G You are not told of object-related problems.\n\r" }, { "mobile", MONITOR_MOB, 107, "&G", "MON_MOB", "&c[&C MOBILE &c]&G Watching mobile/player problems.\n\r", "&c[&z mobile &c]&G Not watching problems with mobiles/players\n\r" }, { "room", MONITOR_ROOM, 103, "&G", "MON_ROOM", "&c[&C ROOM &c]&G You are informed of problems involved with rooms.\n\r", "&c[&z room &c]&G Not informed of problems with rooms.\n\r" }, { "magic", MONITOR_MAGIC, 101, "&G", "MON_MAG", "&c[&C MAGIC &c]&G You are informed of various spell casting info.\n\r", "&c[&z magic &c]&G Not informed of spell casting info.\n\r" }, { "imm_general", MONITOR_GEN_IMM, 108, "&G", "IMM_GEN", "&c[&C IMM_GENERAL &c]&G You are notified of use of logged immortal commands.\n\r", "&c[&z imm_general &c]&G You are not told of the use of logged immortal commands.\n\r" }, { "mort_general", MONITOR_GEN_MORT, 106, "&G", "MORT_GEN", "&c[&C MORT_GENERAL &c]&G You are notified of use of logged mortal commands.\n\r", "&c[&z mort_general &c]&G You are not told of the use of logged mortal commands.\n\r" }, { "combat", MONITOR_COMBAT, 104, "&G", "MON_COMBAT", "&c[&C COMBAT &c]&G You are monitoring problems in combat.\n\r", "&c[&z combat &c]&G Not monitoring any combat problems.\n\r" }, { "hunting", MONITOR_HUNTING, 104, "&G", "MON_HUNT", "&c[&C HUNTING &c]&G You are told of all mobile hunting.\n\r", "&c[&z hunting &c]&G Not told about mobiles hunting players.\n\r" }, { "build", MONITOR_BUILD, 109, "&G", "MON_BUILD", "&c[&C BUILD &c]&G You receive logged building commands.\n\r", "&c[&z build &c]&G You don't monitor logged building commands.\n\r" }, { "clan", MONITOR_CLAN, 105, "&G", "MON_CLAN", "&c[&C CLAN &c]&G You are informed of use of certain clan commands.\n\r", "&c[&z clan &c]&G You are not told of use of certain clan commands.\n\r" }, { "debug", MONITOR_DEBUG, 113, "&G", "MON_DEBUG", "&c[&C DEBUG &c]&G You are watching code debugging info!\n\r", "&c[&z debug &c]&G Not watching code debugging info.\n\r" }, { "system", MONITOR_SYSTEM, 113, "&G", "MON_SYS", "&c[&C SYSTEM &c]&G You are told of system messages.\n\r", "&c[&z system &c]&G Not told of system messages.\n\r" }, { "logs", MONITOR_LOG, 110, "&G", "MON_LOG", "&c[&C LOGS &c]&G You are told of logged players' actions.\n\r", "&c[&z logs &c]&G You are not told of logged players' actions\n\r", }, { NULL, 0, 0, NULL, NULL } }; void do_monitor( CHAR_DATA *ch, char *argument ) { int a; bool found = FALSE; char buf[MAX_STRING_LENGTH]; buf[0] = '\0'; if ( argument[0] == '\0' ) { send_to_char( "Monitor Channel Details:\n\r\n\r", ch ); for ( a = 0; monitor_table[a].min_level != 0; a++ ) { if ( monitor_table[a].min_level > get_trust( ch ) ) continue; if ( IS_SET( ch->pcdata->monitor, monitor_table[a].channel ) ) sprintf(buf,"%s",monitor_table[a].on_name ); else sprintf(buf, "%s", monitor_table[a].off_name); send_to_char( buf, ch ); } send_to_char( "\n\rMONITOR toggles the monitor channels.\n\r", ch ); return; } /* Search for monitor channel to turn on/off */ for ( a = 0; monitor_table[a].min_level != 0; a++ ) { if ( !strcmp( argument, monitor_table[a].name ) ) { found = TRUE; if ( IS_SET( ch->pcdata->monitor, monitor_table[a].channel ) ) REMOVE_BIT( ch->pcdata->monitor, monitor_table[a].channel ); else SET_BIT( ch->pcdata->monitor, monitor_table[a].channel ); break; } } if ( !found ) { do_monitor( ch, "" ); return; } send_to_char( "Ok, monitor channel toggled.\n\r",ch ); return; } void monitor_chan( const char *message, int channel, sh_int level_mon ) { char buf[MAX_STRING_LENGTH]; char buf3[MAX_STRING_LENGTH]; DESCRIPTOR_DATA *d; int a; int level = MAX_LEVEL; for ( a = 0; monitor_table[a].min_level != 0; a++ ) if ( monitor_table[a].channel == channel ) { level = monitor_table[a].min_level; break; } sprintf( buf, "%s&G[&B%s&G]&B&W %s\n\r", monitor_table[a].col, monitor_table[a].id, message); sprintf( buf2, "[%s] %s\n\r", monitor_table[a].id, message); log_string_plus( buf3, LOG_BUILD, MAX_LEVEL + 1); /* You could write to the log file directly but I think it is just easier to * do it through smaug's function.. * -Gangien */ for ( d = first_descriptor; d; d = d->next ) { if ( d->connected == CON_PLAYING && !IS_NPC( d->character ) && IS_SET( d->character->pcdata->monitor, channel ) && level_mon <= get_trust( d->character ) ) { send_to_char( buf, d->character ); } } return; }