// The arena viewing room snippet is by Feydrex. // Most of the code comes from a loop in Lope's act_new() // function from his colour code. (I needed to have a // copy of the act processing loop, but to execute it // under different parameters. The original loop is // also still needed after this arena viewing loop.) // You'll need to change ARENA_START and ARENA_END to // be the room vnums of the starting and ending rooms // in the arena. If you have a pre-fight room or post- // fight rooms, you may want to leave those out of the // range. You'll also need to create a room to be the // viewing room. Change ARENA_VIEW to be the vnum of // the viewing room that you create. // Add the following into the act_new function in comm.c // right after the other declarations unsigned int ARENA_START = 5400; unsigned int ARENA_END = 5418; unsigned int ARENA_VIEW = 5422; bool in_arena = FALSE; ROOM_INDEX_DATA *pArenaView = NULL; // Add the following two blocks into the act_new function in // comm.c in between the following lines (where the ---> is) // /* discard null rooms and chars */ // if( !ch || !ch->in_room ) // return; // ---> // to = ch->in_room->people; if( ch->in_room && (ch->in_room->vnum >= ARENA_START && ch->in_room->vnum <= ARENA_END) ) { in_arena = TRUE; pArenaView = get_room_index(ARENA_VIEW); } if( in_arena && pArenaView->people && (type == TO_ROOM || type == TO_NOTVICT)) { to = pArenaView->people; for ( ; to ; to = to->next_in_room ) { if ( (!IS_NPC(to) && to->desc == NULL ) || ( IS_NPC(to)) || to->position < min_pos ) continue; point = buf; str = format; while( *str ) { if( *str != '$' && *str != '{' ) { *point++ = *str++; continue; } i = NULL; switch( *str ) { case '$': fColour = TRUE; ++str; i = " <@@@> "; if ( !arg2 && *str >= 'A' && *str <= 'Z' && *str != 'G' ) { bug( "Act: missing arg2 for code %d.", *str ); i = " <@@@> "; } else { switch ( *str ) { default: bug( "Act: bad code %d.", *str ); i = " <@@@> "; break; case 't': i = (char *) arg1; break; case 'T': i = (char *) arg2; break; case 'n': i = PERS( ch, to ); break; case 'N': i = PERS( vch, to ); break; case 'e': i = he_she [URANGE(0, ch ->sex, 2)]; break; case 'E': i = he_she [URANGE(0, vch ->sex, 2)]; break; case 'm': i = him_her [URANGE(0, ch ->sex, 2)]; break; case 'M': i = him_her [URANGE(0, vch ->sex, 2)]; break; case 'o' : sprintf( buf2, "%s", olc_ed_name(ch) ); i = buf2; break; case 'O' : sprintf( buf2, "%s", olc_ed_vnum(ch) ); i = buf2; break; case 's': i = his_her [URANGE(0, ch ->sex, 2)]; break; case 'S': i = his_her [URANGE(0, vch ->sex, 2)]; break; case 'p': i = can_see_obj( to, obj1 ) ? obj1->short_descr : "something"; break; case 'P': i = can_see_obj( to, obj2 ) ? obj2->short_descr : "something"; break; case 'd': if ( !arg2 || ((char *) arg2)[0] == '\0' ) { i = "door"; } else { one_argument( (char *) arg2, fname ); i = fname; } break; case 'G': if ( ch->alignment < 0 ) { i = "Tribunal"; } else { i = "Galactus"; } break; } } break; case '{': fColour = FALSE; ++str; i = NULL; if( IS_SET( to->act, PLR_COLOUR ) ) { i = colour( *str, to ); } break; default: fColour = FALSE; *point++ = *str++; break; } ++str; if( fColour && i ) { fixed[0] = '\0'; i2 = fixed; if( IS_SET( to->act, PLR_COLOUR ) ) { for( i2 = fixed ; *i ; i++ ) { if( *i == '{' ) { i++; strcat( fixed, colour( *i, to ) ); for( i2 = fixed ; *i2 ; i2++ ) ; continue; } *i2 = *i; *++i2 = '\0'; } *i2 = '\0'; i = &fixed[0]; } else { for( i2 = fixed ; *i ; i++ ) { if( *i == '{' ) { i++; if( *i != '{' ) { continue; } } *i2 = *i; *++i2 = '\0'; } *i2 = '\0'; i = &fixed[0]; } } if( i ) { while( ( *point = *i ) != '\0' ) { ++point; ++i; } } } *point++ = '\n'; *point++ = '\r'; *point = '\0'; buf[0] = UPPER( buf[0] ); if (to->desc && (to->desc->connected == CON_PLAYING)) write_to_buffer( to->desc, buf, point - buf ); } /* end of for-loop */ } /* end of if check for arena viewers */ // Please also add the following small help topic into your helps // area file (such as help.are) 0 arenaview~ Arena viewing room code snippet by Feydrex. Feydrex's snippets can be found at: http://www.geocities.com/feydrex/code.html ~ // Enjoy :)