Arena v1.1
(This is the basic Arena that LrdElder coverted to SMAUG, you may notice in his snippet
he does not give you the instructions you need to fully get it working. This is what this
snippet if for. You will need to change several files so make backup copies in case something
goes wrong.

=================Version Upgrade Note=====================
= This is version 1.1, what I have added in this version =
= is Wins/Losses in the score command. Its nothing big   =
= but some people might like the thought.                =
==========================================================
= Everything else can be installed the way it is listed. =
==========================================================

=================Version Upgrade Note=====================
= This is version 1.2, what I have added in this version =
= is an opponent variable to allow a better winning      =
= message when the arena is over. Also I have added the  =
= feature of letting immortals participate.              =
==========================================================

cp <filename>.c <filename>.c.bak or whatever you prefer

IMPORTANT: You will need to have ROOM_FLAGS2 in your MUD, but if you don't thats ok too,
you will just need to cycle through this and any reference to room_flags2 you will need to
change to room_flags.

Also, this was extracted from SW:FotE 1.0 FUSS, mainly because its bug free, or hopefully it is,
a lot of people like arena and there isn't a snippet for it for Star Wars!!!

What this does:

	This will add a gladiator style arena to your Star Wars MUD. Its basically OOC
because you cannot be killed but its a fun test of strength. People can also bet money on
whoever they think will win to gain more credits. Some find that non-roleplay to gain money
in an OOC arena. But its fun, you can set the amount of credits maximum for betting so they
can't go overboard with winning. Also, you do not need to worry about making an arena, if
you still have the stock limbo.are file, it should already have a 14 room arena, it may need
some adjustments, but thats it.

What you will need to change:

Makefile
act_comm.c
act_info.c
build.c
fight.c    <-- v1.1
handler.c
mud.h
newarena.c <-- needs to be created, v1.1  [VERSION 1.3]
player.c   <-- v1.1
save.c     <-- v1.1
tables.c
swskills.c
update.c

system directory needs to have halloffame.lst created

-------------------------------------------------------------------------------------------------

Makefile

Add,

newarena.c somewhere in there

-------------------------------------------------------------------------------------------------

act_comm.c

Find,

void send_control_page_to_char(CHAR_DATA * ch, char page);

Below it add,

void sportschan(char *);

Find,

void do_quit( CHAR_DATA *ch, char *argument )

Then find,

    int level;

Below this part add,

    char qbuf[MAX_INPUT_LENGTH];
    CHAR_DATA *fch;

Find, this is in the do_quit code

act( AT_BYE, "$n has left the game.", ch, NULL, NULL, TO_ROOM );
set_char_color( AT_GREY, ch);

Below this part add,

    if ( ch->challenged )
    {
      sprintf(qbuf,"%s has quit! Challenge is void!",ch->name);
      ch->challenged=NULL;
      sportschan(qbuf);
    }

    for ( fch = first_char; fch; fch = fch->next )
    {
	if(IS_NPC(fch))
	  continue;

	if(fch->challenged && fch->challenged == ch)
	  fch->challenged=NULL;
    }

-------------------------------------------------------------------------------------------------

act_info.c

Find,

	send_to_char( !IS_SET(ch->deaf, CHANNEL_NEWBIE)
	      	? " +NEWBIE"
		: " -newbie",
		ch );

Below it add,

	send_to_char( !IS_SET(ch->deaf, CHANNEL_SPORTS)
	      	? " +SPORTS"
		: " -sports",
		ch );

Find,

        else if ( !str_cmp( arg+1, "wartalk"  ) ) bit = CHANNEL_WARTALK;

Below it add,

        else if ( !str_cmp( arg+1, "sports"   ) ) bit = CHANNEL_SPORTS;

Find,

            REMOVE_BIT (ch->deaf, CHANNEL_YELL);

Below it add,

            REMOVE_BIT (ch->deaf, CHANNEL_SPORTS);

-------------------------------------------------------------------------------------------------

build.c

Find,

char * const	r_flags2 [] =

Below in the next blank spot add,

"arena"

Find,

void do_redit( CHAR_DATA *ch, char *argument )

Then find the "flags2" part and add arena in there somewhere so your builders know they can
set flags2 to arena.

Hint: You will only have one arena, vnums 29-43 are originally an arena so just set those
rooms with the flag2 arena.

-------------------------------------------------------------------------------------------------

fight.c

Find,

/* From Skills.c */
int ris_save( CHAR_DATA *ch, int chance, int ris );

Below it add,

/* From newarena.c */
void lost_arena(CHAR_DATA *ch);

Find,

    if (dam > 10 && dt != TYPE_UNDEFINED )

Change it to look like this,

    if (dam > 10 && dt != TYPE_UNDEFINED && !IS_SET( ch->in_room->room_flags2, ROOM_ARENA))

Find,

    if (!IS_NPC(victim) && NOT_AUTHED(victim) && victim->hit < 1)
	victim->hit = 1;

Below it add,

    if ( victim->hit < 1 && !IS_NPC(victim) && IS_SET(victim->in_room->room_flags2, ROOM_ARENA))
     {
        char_from_room(victim);
        char_to_room(victim,victim->pcdata->roomarena);
        victim->hit = victim->max_hit;
        victim->mana = victim->max_mana;
	victim->arenaloss += 1;  /* v1.1 Diablo */
        if( num_in_arena() == 1)
          find_game_winner();
        do_look(victim, "auto");
        stop_fighting( victim, TRUE );
        lost_arena(victim);
        return rNONE;
     }

Find,

    return URANGE ( -1000, 
                     (int) ( gch->alignment - victim->alignment/5 ),
                     1000 );

Above it add,

      if(IS_SET( gch->in_room->room_flags2, ROOM_ARENA ))
        return 0;

In the command, do_murder, locate this,

    char arg[MAX_INPUT_LENGTH];

Below it add,

    char logbuf[MAX_STRING_LENGTH];

Locate this part of the code in the same command, do_murder

    WAIT_STATE( ch, 1 * PULSE_VIOLENCE );
    multi_hit( ch, victim, TYPE_UNDEFINED );
    return;

Above it add,

    if((!ch->in_room->area || !in_arena(ch)) || !IS_NPC(ch) || !IS_NPC(victim))
    {
      sprintf( logbuf, "%s: murder %s", ch->name, argument);
      log_string(logbuf);
    }

Below do_murder there should be a code for in_arena, but if there is not, add this,

bool in_arena( CHAR_DATA *ch )
{

if ( !str_cmp( ch->in_room->area->filename, "arena.are" ) )
  return TRUE;

if ( ch->in_room->vnum < 29 || ch->in_room->vnum > 43 )
  return FALSE;

return TRUE;
}

-------------------------------------------------------------------------------------------------

handler.c

Find,

/*
 * Extract a char from the world.
 */
void extract_char( CHAR_DATA *ch, bool fPull )

Somewhere in there, under the mounted part usually, add this,

    if (IS_SET(ch->in_room->room_flags2, ROOM_ARENA))
    {
        ch->hit = ch->max_hit;
        ch->mana = ch->max_mana;
        ch->move = ch->max_move;
    }

Find,

CHAR_DATA *get_char_world( CHAR_DATA *ch, char *argument )

Below this code you need to add this,

/* Find a character by name, no PERS */
CHAR_DATA *get_char_world_ooc( CHAR_DATA *ch, char *argument )
{
    char arg[MAX_INPUT_LENGTH];
    CHAR_DATA *wch;
    int number, count, vnum;

    number = number_argument( argument, arg );
    count  = 0;
    if ( !str_cmp( arg, "self" ) )
	return ch;

    /*
     * Allow reference by vnum for saints+			-Thoric
     */
    if ( get_trust(ch) >= LEVEL_SAVIOR && is_number( arg ) )
	vnum = atoi( arg );
    else
	vnum = -1;

    /* check the room for an exact match */
    for ( wch = ch->in_room->first_person; wch; wch = wch->next_in_room )
	if ( (nifty_is_name( arg, wch->name ) || 
		(IS_NPC(ch) && (nifty_is_name(arg, wch->name)))
		||  (IS_NPC(wch) && vnum == wch->pIndexData->vnum))
		 && is_wizvis(ch,wch))	
	{
	    if ( number == 0 && !IS_NPC(wch) )
		return wch;
	    else
	    if ( ++count == number )
		return wch;
	}

    count = 0;

    /* check the world for an exact match */
    for ( wch = first_char; wch; wch = wch->next )
	if ( (nifty_is_name( arg, wch->name ) || (IS_NPC(ch) && (nifty_is_name(arg, wch->name)))
	||  (IS_NPC(wch) && vnum == wch->pIndexData->vnum)) && is_wizvis(ch,wch) )
	{
	    if ( number == 0 && !IS_NPC(wch) )
		return wch;
	    else
	    if ( ++count == number  )
		return wch;
	}

    /* bail out if looking for a vnum match */
    if ( vnum != -1 )
	return NULL;

    /*
     * If we didn't find an exact match, check the room for
     * for a prefix match, ie gu == guard.
     * Added by Narn, Sept/96
     */
    count  = 0;
    for ( wch = ch->in_room->first_person; wch; wch = wch->next_in_room )
    {
	if ( !nifty_is_name_prefix( arg, wch->name ) || (IS_NPC(ch) && (!nifty_is_name_prefix(arg, wch->name))) )
	    continue;
	if ( number == 0 && !IS_NPC(wch) && is_wizvis(ch,wch))
	    return wch;
	else
	if ( ++count == number  && is_wizvis(ch, wch) )
	    return wch;
    }

    /*
     * If we didn't find a prefix match in the room, run through the full list
     * of characters looking for prefix matching, ie gu == guard.
     * Added by Narn, Sept/96
     */
    count  = 0;
    for ( wch = first_char; wch; wch = wch->next )
    {
	if ( !nifty_is_name_prefix( arg, wch->name ) || (IS_NPC(ch) && (!nifty_is_name(arg, wch->name))))
	    continue;
	if ( number == 0 && !IS_NPC(wch) && is_wizvis(ch, wch) )
	    return wch;
	else
	if ( ++count == number  && is_wizvis(ch, wch) )
	    return wch;
    }

    return NULL;
}

-------------------------------------------------------------------------------------------------

mud.h

Find,

/*
 * Accommodate old non-Ansi compilers.
 */

Under all of these declarations add this,

/* Stuff from newarena.c */
void show_jack_pot();
void do_game();
int num_in_arena();
void find_game_winner();
void do_end_game();
void start_game();
void silent_end();
void write_fame_list(void);
void load_hall_of_fame(void);

Find,

#define PULSE_TAXES               ( 60 * PULSE_MINUTE)

Below it add,

#define PULSE_ARENA               ( 30 * PULSE_PER_SECOND)

Find your section where your flags2 are declared and make sure you set one to look like this,
ROOM_ARENA      BV?? <-- the ?? should be a number from 00 - 31, depending on which spot you
set it in build.c,
i.e. - if in build.c you used the first one, make it BV00, if it was the second one, make it
BV01, etc.

Find,

#define CHANNEL_103		   BV27

Below it add,

#define CHANNEL_SPORTS             BV28

Find,

struct	pc_data

Somewhere in there add,

    ROOM_INDEX_DATA *   roomarena;

Find,

struct	char_data

Somewhere in there add,

    CHAR_DATA           *opponent; //VERSION 1.3 UPGRADE
    CHAR_DATA           *challenged;
    CHAR_DATA *         betted_on;
    int                 bet_amt;
    sh_int              arenawin;      /* v1.1 Diablo */
    sh_int              arenaloss;     /* v1.1 Diablo */

Find,

DECLARE_DO_FUN( do_setplanet    );

Below it add these, or you can do them alphabetically

DECLARE_DO_FUN( do_aaccept      );
DECLARE_DO_FUN( do_adecline     );
DECLARE_DO_FUN( do_ahall        );
DECLARE_DO_FUN( do_arena        );
DECLARE_DO_FUN( do_awho         );
DECLARE_DO_FUN( do_bet          );
DECLARE_DO_FUN( do_challenge    );
DECLARE_DO_FUN( do_chaos        );

Find,

void    raw_kill        args( ( CHAR_DATA *ch, CHAR_DATA *victim ) );

Below this there should be a reference to in_arena, but if there is not, add this,

bool	in_arena	args( ( CHAR_DATA *ch ) );

At the very bottom of mud.h, add this

#define GET_BETTED_ON(ch)    ((ch)->betted_on)
#define GET_BET_AMT(ch) ((ch)->bet_amt)
#define IN_ARENA(ch)            (IS_SET((ch)->in_room->room_flags2, ROOM_ARENA))

-------------------------------------------------------------------------------------------------

newarena.c

Either copy and paste everything into a file called newarena.c or use ftp to transfer it
to your SRC directory in your shell.

v1.1

In the void find_game_winner() function,

Find this,

          i->challenged=NULL;

Below it add,

          i->arenawin += 1;

-------------------------------------------------------------------------------------------------

player.c

Find,

    send_to_char( "\n\r", ch );
    ch_printf( ch, "WANTED ON: %s\n\r",
             flag_string(ch->pcdata->wanted_flags, planet_flags) );

Below it add,

      send_to_char( "----------------------------------------------------------------------------\n\r", ch);
      ch_printf(ch, "CHALLENGES:   Wins: %d   Losses: %d\n\r",
             ch->arenawin, ch->arenaloss );

-------------------------------------------------------------------------------------------------

save.c

Find,

    fprintf( fp, "MGlory       %d\n",   ch->pcdata->quest_accum );

Below it add,

    fprintf( fp, "ArenaWin     %d\n",   ch->arenawin            );
    fprintf( fp, "ArenaLoss    %d\n",   ch->arenaloss           );

Find,

            KEY( "Alignment",   ch->alignment,          fread_number( fp ) );

Below it add,

            KEY( "ArenaWin",    ch->arenawin,           fread_number( fp ) );
            KEY( "ArenaLoss",   ch->arenaloss,          fread_number( fp ) );

-------------------------------------------------------------------------------------------------

tables.c

Find,

DO_FUN *skill_function( char *name )
{
    switch( name[3] )
    {
    case 'a':

Below it add, or do alphabetically

        if ( !str_cmp( name, "do_aaccept" ))            return do_aaccept;
        if ( !str_cmp( name, "do_ahall" ))              return do_ahall;
        if ( !str_cmp( name, "do_arena" ))              return do_arena;
        if ( !str_cmp( name, "do_awho" ))               return do_awho;
	if ( !str_cmp( name, "do_adecline" ))		return do_adecline;

Find,

    case 'b':

Below it add, or do alphabetically

        if ( !str_cmp( name, "do_bet" ))                return do_bet;

Find,

    case 'c':

Below it add, or do alphabetically

        if ( !str_cmp( name, "do_challenge" ))          return do_challenge; 
        if ( !str_cmp( name, "do_chaos" ))              return do_chaos;

Find,

char *skill_name( DO_FUN *skill )
{ 

Below it add, or do alphabetically

    if ( skill == do_aaccept )           return "do_aaccept";
    if ( skill == do_ahall )            return "do_ahall";
    if ( skill == do_arena )            return "do_arena";
    if ( skill == do_awho )             return "do_awho";
    if ( skill == do_bet )              return "do_bet";
    if ( skill == do_challenge )        return "do_challenge";
    if ( skill == do_chaos )            return "do_chaos";
    if ( skill == do_adecline )          return "do_adecline";

-------------------------------------------------------------------------------------------------

swskills.c

Find,

   medpac = get_eq_char( ch, WEAR_HOLD );
   if ( !medpac || medpac->item_type != ITEM_MEDPAC )
   {
         send_to_char( "You need to be holding a medpac.\n\r",ch );
         return;
   }

Below it add, if you prefer,

   if ( IS_SET(ch->in_room->room_flags2, ROOM_ARENA) )
   {
	send_to_char("Medpacs in the arena? There's no honor in that!\n\r", ch);
	return;
   }

-------------------------------------------------------------------------------------------------

update.c

Find,

#include "mud.h"

Below it add,

/* From newarena.c -- Tawnos */
extern void start_arena();
extern void do_game();
extern int in_start_arena;
extern int ppl_in_arena;
extern int ppl_challenged;
extern int num_in_arena();

Find,

void update_handler( void )
{

Below it add,

    static  int     pulse_start_arena = PULSE_ARENA;
    static  int     pulse_arena = PULSE_ARENA;

Find,

    if ( --pulse_violence <= 0 )
    {
	pulse_violence	= PULSE_VIOLENCE;
	violence_update	( );
    }

Below it add,

    if(in_start_arena || ppl_challenged)
    if( --pulse_start_arena <= 0)
    {
      pulse_start_arena = PULSE_ARENA;
      start_arena();
    }

    if(ppl_in_arena)
    if(( --pulse_arena <= 0) || (num_in_arena()==1))
    {
      pulse_arena = PULSE_ARENA;
      do_game();
    }

-------------------------------------------------------------------------------------------------

make clean
make (you may experiance an error or two, I am not entirely sure, email me any problems)
copyover/reboot your mud
cedit
cedit aaccept create do_aaccept
cedit ahall create do_ahall
cedit arena create do_arena
cedit awho create do_awho
cedit bet create do_bet
cedit challenge create do_challenge
cedit chaos create do_chaos
cedit adecline do_adecline

cedit aaccept level 5
cedit ahall level 5
cedit arena level 5
cedit challenge level 5
cedit bet level 5
cedit chaos level 104
cedit awho level 5
cedit adecline level 5

cedit save

-------------------------------------------------------------------------------------------------

This should be it, but like all snippets you may find a bug or something missing, I include my
email address on all of my snippets so people can email me telling me if I left anything out
and I can add/fix whatever I missed and re-submit the snippet.

This snippet allows for space for upgrades and what not. You can add something to do_score to
allow players to see how many wins/losses they have.

-,,,.,,,,-
_'Diablo'_ Star Wars Development
  ''''''

[*]------------------------------------------------[*]
||| If you have any problems please contact me at: |||
|||           crazy_mike_316@hotmail.com           |||
[*]------------------------------------------------[*]