/*
	Snippet for Rom2.4b6
	
	This code was written by Michael J. Wyatt (Tsudanosh) of Some Nameless Mud -
	telnet://mud.houseofszat.com:3500.  It is in a working and finished state as
	of this release, however the Poobah (Top Combatants) function is not yet 
	implemented.  The next release will have it up and running, probably via a
	mySQL interface.  
	
	It's a pretty indepth installation and should be done only by an experienced
	implementor.  BACK UP ALL YOUR FILES BEFORE INSTALLING THIS CODE!
	
	The code comes as-is and offers no guarantee that it will work properly on 
	your mud.  Please install it at your own risk.  It has been tested on a
	stand-alone Rom2.4b6 install and works fine.  I will offer simple technical
	assistance on this installation.  Please send me an email with any errors
	you get and a gdb core dump if possible.  Also send me a detailed description
	of what was going on when the error occurred.
	
	Features:
	
	- Customizable battlegrounds, add to it as you like!  Prizes and Areas!
	- Records the hp/mana/moves/location of all players prior to entering the battleground.
	- Upon winning/losing/quitting, players are returned to their original location.
	- Immortals w/ trust level to utilize the "load" command can set the prize as any
	  item in their inventory.  If an immortal does not have sufficient trust, a random
	  item from the prize database will be used.  
	- Immortals have the options to issue the following commands:
	  1. start <minlevel> <maxlevel> <prize> <area>
	  (I just now realized that you can't select an area without specifying an item-prize.
	  I'll fix this later!)
	  2. cancel (this cancels a battleground that is about to begin)
	  3. change (this changes the settings for a battleground that is about to begin)
	  4. purge (this cancels and kicks all players out of a battleground in progress)
	- Pretty stable(TM).  Don't take my word for it, but no segmentation faults for me!
	
	Hope you enjoy the code -- stay tuned for the next version!
	
	Contact: Michael J. Wyatt (Tsudanosh)
	Mud: mud.houseofszat.com port 3500
	Email: tsudanosh@houseofszat.com
	AIM: Tsudanosh

*/


// In your /area directory, add: bgrounds.are to the area.lst file

// act_comm.c

In do_quit function, find:

    if ( ch->position  < POS_STUNNED  )
    {
        send_to_char( "You're not DEAD yet.\n\r", ch );
        return;
    }

After it, add:

    if ( IS_SET(ch->act, PLR_BATTLEGROUND ))
    {
        if(IS_SET(ch->in_room->room_flags, ROOM_BATTLEGROUND))
        {
            do_function(ch, &do_battleground, "leave");
            REMOVE_BIT(ch->act, PLR_BATTLEGROUND); /* REMOVE_BIT is in "battleground leave", just another 'just in case' scenario */
        }
        else
            REMOVE_BIT(ch->act, PLR_BATTLEGROUND);
    }
    else if(IS_SET(ch->in_room->room_flags, ROOM_BATTLEGROUND)) /* Just in case someone gets stuck in there... */
    {
        ROOM_INDEX_DATA *pRoomIndex = get_room_index(ROOM_VNUM_TEMPLE);
        char_from_room(ch);
        char_to_room(ch, pRoomIndex);
        send_to_char("Unsure how you got here without joining the battleground.  Moving you to the temple.\n\r", ch);
        do_look(ch,"auto");
    }

// const.c

At the end of the file, add:

/*
 * Battleground Areas
 * You will need to create a single area as the battleground area.  This table basically creates areas
 * within the overall area to use for the battlegrounds.  I have it setup in my mud so the overall area
 * is just called Battle Grounds (bgrounds.are) and it includes vnums 400 - 499.  
 */
const   struct  battleground_type       battleground_area_table [] =
{
   {    "Annihilation",         400,            400     },
   {    "Tower",                401,            420     },
   {    "Chessboard",           421,            484     },
   {    NULL,                     0,              0     }
};

// db.c

Somewhere in the Globals. section, add:

BATTLEGROUND_DATA       battleground_info;

In the boot_db() function:

Find:

    /*
     * Init random number generator.
     */
    {
        init_mm( );
    }

After it, add:

    battleground_info.ticks     = 0;
    battleground_info.min_lvl   = 0;
    battleground_info.max_lvl   = 0;
    battleground_info.prize     = NULL;
    battleground_info.area      = 0;
    battleground_info.in_progress = FALSE;
    battleground_info.about_to_start = FALSE;

// fight.c

In the is_safe function:

Find:

            if (!is_clan(ch))

Before it, add:

            if (IS_SET(ch->act, PLR_BATTLEGROUND) && IS_SET(victim->act, PLR_BATTLEGROUND) \
            && IS_SET(ch->in_room->room_flags, ROOM_BATTLEGROUND) && IS_SET(victim->in_room->room_flags, ROOM_BATTLEGROUND))
                return FALSE;

In the bool damage function:

Find: 

    /*
     * Payoff for killing things.
     */
    if ( victim->position == POS_DEAD )
    {
        group_gain( ch, victim );

	if ( !IS_NPC(victim) )
	{
	
Replace with:

    /*
     * Payoff for killing things.
     */
    if ( victim->position == POS_DEAD )
    {
        group_gain( ch, victim );

        if ( !IS_NPC(victim) && !IS_SET(ch->act, PLR_BATTLEGROUND) && !IS_SET(victim->act, PLR_BATTLEGROUND) \
            && !IS_SET(ch->in_room->room_flags, ROOM_BATTLEGROUND) && !IS_SET(victim->in_room->room_flags, ROOM_BATTLEGROUND))
        {

Find:

            {
            sprintf( log_buf, "%s got toasted by %s at %s [room %d]",
            (IS_NPC(victim) ? victim->short_descr : victim->name),
            (IS_NPC(ch) ? ch->short_descr : ch->name),
            ch->in_room->name, ch->in_room->vnum);
            if (IS_NPC(victim))
                wiznet(log_buf,NULL,NULL,WIZ_MOBDEATHS,0,0);
            else
                wiznet(log_buf,NULL,NULL,WIZ_DEATHS,0,0);
            }
            
Replace with:

        if(!IS_SET(ch->act, PLR_BATTLEGROUND) && !IS_SET(victim->act, PLR_BATTLEGROUND) \
            && !IS_SET(ch->in_room->room_flags, ROOM_BATTLEGROUND) && !IS_SET(ch->in_room->room_flags, ROOM_BATTLEGROUND))
            {
            sprintf( log_buf, "%s got toasted by %s at %s [room %d]",
            (IS_NPC(victim) ? victim->short_descr : victim->name),
            (IS_NPC(ch) ? ch->short_descr : ch->name),
            ch->in_room->name, ch->in_room->vnum);
            if (IS_NPC(victim))
                wiznet(log_buf,NULL,NULL,WIZ_MOBDEATHS,0,0);
            else
                wiznet(log_buf,NULL,NULL,WIZ_DEATHS,0,0);
            }
        else
        {
            char buf[MAX_STRING_LENGTH];

            sprintf(buf,"%s just defeated %s in the battleground.\n\r", ch->name, victim->name);
            info_channel(buf);
            --battleground_info.players;
        }
        
In the raw_kill function:

Find:

    death_cry( victim );

After it, add:

    if ( !IS_NPC(victim) && IS_SET(victim->act, PLR_BATTLEGROUND) && IS_SET(victim->in_room->room_flags, ROOM_BATTLEGROUND))
    {
        REMOVE_BIT(victim->act, PLR_BATTLEGROUND);
        victim->hit = victim->pcdata->bg_hp_store;
        victim->mana = victim->pcdata->bg_mn_store;
        victim->move = victim->pcdata->bg_mv_store;
        update_pos(victim);
        char_from_room(victim);
        char_to_room(victim, victim->pcdata->bg_room_store);
        do_look(victim,"auto");
        return;
    }

// handler.c

In the *act_bit_name function:

Find:

        if (act_flags & PLR_KILLER      ) strcat(buf, " killer");

After it, add:

        if (act_flags & PLR_BATTLEGROUND) strcat(buf, " battleground");
        
// interp.c

In the command table:

Find: 

    /*
     * Miscellaneous commands.
     */

Somewhere in there, add:

    { "battleground",   do_battleground,POS_DEAD,        1,  LOG_NORMAL, 1 },

// interp.h

Find:

DECLARE_DO_FUN( do_bash         );

After it, add:

DECLARE_DO_FUN( do_battleground );

// Makefile

O_FILES = act_comm.o act_enter.o act_info.o act_move.o act_obj.o act_wiz.o \
          alias.o ban.o comm.o const.o db.o db2.o effects.o fight.o flags.o \
          handler.o healer.o interp.o note.o lookup.o magic.o magic2.o \
          music.o recycle.o save.o scan.o skills.o special.o tables.o \
          update.o battleground.o <-- Add that at the end!

// merc.h

Find:

/*
 * Structure types.
 */
typedef struct  affect_data             AFFECT_DATA;
typedef struct  area_data               AREA_DATA;
typedef struct  ban_data                BAN_DATA;

After it, add:

typedef struct  battleground_data       BATTLEGROUND_DATA;

Find:

struct  class_type
{
    char *      name;                   /* the full name of the class */

Before it, add:

struct  battleground_type
{
    char *      name;
    sh_int      first_vnum;
    sh_int      last_vnum;
};

Find:

#define PULSE_AREA                (120 * PULSE_PER_SECOND)

After it, add:

#define PULSE_BATTLEGROUND        (10 * PULSE_PER_SECOND )

Find:

/*
 * Room flags.
 * Used in #ROOMS.
 */

At the end of that section, add:

#define ROOM_BATTLEGROUND       (B)

/* Where B is the next available bit.  It is important to use Ivan's OLC Editor and login after installing
the area and set each room as ROOM_BATTLEGROUND if you use a bit other than B.  Otherwise you can change the 
values by hand in the bgrounds.are file.

Ex.

#ROOMS
#400
You are in room of total annihilation.~
~
0 B 0 <--- this is the bit that needs to be set.  Change B to whatever bit you set it as.
S

*/

Find:

/*
 * Data which only PC's have.
 */

At the end of the struct, add:

    sh_int              bg_hp_store;
    sh_int              bg_mn_store;
    sh_int              bg_mv_store;
    ROOM_INDEX_DATA *   bg_room_store;

Find:

#define OBJ_VNUM_WHISTLE           2116

After it, add:

#define OBJ_VNUM_BG_FIRST_PRIZE 400 /* Where 400 is the first prize item vnum available for bgrounds */
#define OBJ_VNUM_BG_LAST_PRIZE 410 /* Where 410 is the final prize item vnum available for bgrounds */

Find:

/*
 * ACT bits for players.
 */

At the end of that section, add:

#define PLR_BATTLEGROUND        (ee)

/* Where ee is the next available bit */

Find:

/* memory settings */
#define MEM_CUSTOMER    A
#define MEM_SELLER      B
#define MEM_HOSTILE     C
#define MEM_AFRAID      D

After it, add:

/* Battleground Information */
struct battleground_data
{
    sh_int      ticks;
    sh_int      min_lvl;
    sh_int      max_lvl;
    OBJ_DATA *  prize;
    sh_int      area;
    bool        in_progress;
    bool        about_to_start;
    sh_int      players;
};

Find:

extern  const   struct  weapon_type     weapon_table    [];

Before it, add:

extern  const   struct  battleground_type battleground_area_table [];

Find:

extern          WEATHER_DATA            weather_info;

After it, add:

extern          BATTLEGROUND_DATA       battleground_info;

Find:

/* ban.c */
bool    check_ban       args( ( char *site, int type) );

After it, add:

/* battleground.c */
void    info_channel    args( ( char *argument ) );
int     command_lookup  args(( const char *name ));
int     battleground_lookup args(( const char *name ));
void    do_bgstart      args((CHAR_DATA *ch, char *argument));
void    update_battleground args( ( void ) );

// tables.c ** This change is only needed if you're running Ivan's OLC **

In const struct flag_type room_flags[]

Find:

    {   NULL,                   0,                      0       }


Before it, add:

    {   "battleground",         ROOM_BATTLEGROUND,      TRUE    },

// update.c

In update_handler function:

Find:

    static  int     pulse_area;
    
Before it, add:

    static  int	    pulse_battleground;
    
Find:

    if ( --pulse_area     <= 0 )
    {
        pulse_area      = PULSE_AREA;
        /* number_range( PULSE_AREA / 2, 3 * PULSE_AREA / 2 ); */
        area_update     ( );
    }

Before it, add:

    if ( --pulse_battleground        <= 0 )
    {
        pulse_battleground   = PULSE_BATTLEGROUND;
        update_battleground( );
    }

------------------------------------------- Begin battleground.c ----------------------------------------

/***************************************************************************
 *  Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer,        *
 *  Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe.   *
 *                                                                         *
 *  Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael          *
 *  Chastain, Michael Quan, and Mitchell Tse.                              *
 *                                                                         *
 *  In order to use any part of this Merc Diku Mud, you must comply with   *
 *  both the original Diku license in 'license.doc' as well the Merc       *
 *  license in 'license.txt'.  In particular, you may not remove either of *
 *  these copyright notices.                                               *
 *                                                                         *
 *  Much time and thought has gone into this software and you are          *
 *  benefitting.  We hope that you share your changes too.  What goes      *
 *  around, comes around.                                                  *
 ***************************************************************************/

/***************************************************************************
*	ROM 2.4 is copyright 1993-1996 Russ Taylor			   *
*	ROM has been brought to you by the ROM consortium		   *
*	    Russ Taylor (rtaylor@efn.org)				   *
*	    Gabrielle Taylor						   *
*	    Brian Moore (zump@rom.org)					   *
*	By using this code, you have agreed to follow the terms of the	   *
*	ROM license, in the file Rom24/doc/rom.license			   *
***************************************************************************/

/***************************************************************************
 * Battleground v1.0 Created by Michael Wyatt (tsudanosh@houseofszat.com)  * 
 * of Some Nameless Mud (telnet://mud.houseofszat.com:3500)                *
 *                                                                         *
 * In order to use this code or any derivatives in your mud, you must keep *
 * this header intact and leave mention of me in the coinciding help file. *
 *                                                                         *
 * Please feel free to email me if you find any bugs or have comments on   *
 * the program.  I will offer simple technical support regarding install-  *
 * ation of this code.  Please send me the error information, gdb core     *
 * dump, and/or any other relevant information about the error.		   *
 *                                                                         *
 *                                                                         *
 * Enjoy!                                                                  *
 * Michael Wyatt - Tsudanosh, Implementor of Some Nameless Mud             *
 **************************************************************************/

#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "merc.h"
#include "interp.h"
#include "recycle.h"
#include "tables.h"
#include "lookup.h"
/* Uncomment this portion if you are running Maestro Note System 
#include "act_note.h"
*/

void info_channel( char *argument );

/*
 * Lookup a command by name.
 */
int command_lookup( const char *name )
{
    int cmd;

    for(cmd = 0; cmd_table[cmd].name[0] != '\0'; cmd++ )
    {
        if(cmd_table[cmd].name == NULL )
            break;
        if(LOWER(name[0]) == LOWER(cmd_table[cmd].name[0])
        &&  !str_prefix( name, cmd_table[cmd].name ) )
            return cmd;
    }

    return -1;
}

/*
 * Lookup a battleground area by name.
 */
int battleground_lookup( const char *name )
{
    int area;

    for(area = 0; battleground_area_table[area].name != '\0'; area++ )
    {
	if(battleground_area_table[area].name == NULL)
	    break;
	if(LOWER(name[0]) == LOWER(battleground_area_table[area].name[0])
	&& !str_prefix( name, battleground_area_table[area].name))
	    return area;
    }

    return -1;
}

void info_channel( char *argument )
{
    char buf[MAX_STRING_LENGTH];
    DESCRIPTOR_DATA *d;

    sprintf(buf, "[INFO]: %s", argument);

    for ( d = descriptor_list; d != NULL; d = d->next )
    {
      CHAR_DATA *victim;

      victim = d->original ? d->original : d->character;

      /* Uncomment this portion if you are running Maestro Note System 
      if (IS_SET( victim->note_config, NOTE_CONFIG_CURRENTLY_NOTING) && !IS_NPC(victim))
      {
          sprintf( buf, "[INFO]: %s\n\r", argument);
          add_buf( victim->pcdata->buffer, buf );
      }
      */
      if ( d->connected == CON_PLAYING )
          send_to_char(buf, victim);
    }

}

void do_battleground(CHAR_DATA *ch, char *argument)
{
    char buf[MAX_STRING_LENGTH];
    char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
    char arg3[MAX_INPUT_LENGTH], arg4[MAX_INPUT_LENGTH];
    char arg5[MAX_INPUT_LENGTH];
    DESCRIPTOR_DATA *d;
    CHAR_DATA	*victim;
    int plr_count = 0, bg_prize = 0, i = 0, vnum = 0;
    OBJ_DATA * obj;
    OBJ_INDEX_DATA *pObjIndex;
    bool found = FALSE;

    argument = one_argument(argument, arg1);
    argument = one_argument(argument, arg2);
    argument = one_argument(argument, arg3);
    argument = one_argument(argument, arg4);
    argument = one_argument(argument, arg5);

    if(arg1[0] == '\0' && IS_IMMORTAL(ch))
    {
        send_to_char("+================================================================+\n\r", ch);
	send_to_char("                       BATTLEGROUND OPTIONS		        \n\r", ch);
	send_to_char("+================================================================+\n\r", ch);
	send_to_char("Start : battleground start <min lvl> <max lvl> <prize> <area>     \n\r", ch);
	send_to_char("Change: battleground change <min lvl> <max lvl> <prize> <area>    \n\r", ch);
	send_to_char("Cancel: battleground cancel					\n\r", ch);
        send_to_char("Purge : battleground purge					\n\r\n\r", ch);
	send_to_char("Show Prizes : battleground show prizes				\n\r", ch);
	send_to_char("Show Areas  : battleground show areas				\n\r\n\r", ch);
	send_to_char("Poobah List : battleground poobah                                 \n\r", ch);
	send_to_char("NOTE: If <prize> or <area> isn't stated.  Random values apply.    \n\r", ch);
	send_to_char("+================================================================+\n\r", ch);
        if(battleground_info.in_progress == TRUE)
	    send_to_char("There is a battleground in progress.  			        \n\r", ch);
	else if(battleground_info.about_to_start == TRUE)
	{
	    sprintf(buf, "There is a battleground about to start in %d ticks.                   \n\r", battleground_info.ticks);
	    send_to_char(buf, ch);
	}
	else
	    send_to_char("There is no battleground in progress or about to start.		\n\r", ch);
	send_to_char("+================================================================+\n\r", ch);
	return;
    }
    else if(arg1[0] == '\0')
    {
        send_to_char("+================================================================+\n\r", ch);
	send_to_char("                       BATTLEGROUND OPTIONS		        \n\r", ch);
	send_to_char("+================================================================+\n\r", ch);
	send_to_char("Join  : battleground join (join the current battleground)         \n\r", ch);
	send_to_char("Leave : battleground leave (cancel your join or leave, if inside) \n\r", ch);
	send_to_char("Poobah: battleground poobah (view the top battleground records    \n\r", ch);
	send_to_char("+================================================================+\n\r", ch);
        if(battleground_info.in_progress == TRUE)
	    send_to_char("There is a battleground in progress.  			        \n\r", ch);
	else if(battleground_info.about_to_start == TRUE)
	{
	    sprintf(buf, "There is a battleground about to start for levels %d - %d.        \n\r", battleground_info.min_lvl, battleground_info.max_lvl);
	    send_to_char(buf, ch);
	}
	else
	    send_to_char("There is no battleground in progress or about to start.		\n\r", ch);
	send_to_char("+================================================================+\n\r", ch);
	return;
    }

    if(!IS_IMMORTAL(ch) && (!str_cmp(arg1,"join")))
    {
	if(IS_SET(ch->act, PLR_BATTLEGROUND) && battleground_info.in_progress == TRUE)
	{
	    send_to_char("You're in a world of hurt if you don't even realize you're in the battleground...\n\r", ch);
	    return;
	}
	else if(IS_SET(ch->act, PLR_BATTLEGROUND) && battleground_info.about_to_start == TRUE)
	{
	    send_to_char("You've already sent your request to join the battleground.  To cancel, type: battleground leave.\n\r", ch);
	    return;
	}
	if(battleground_info.in_progress == TRUE)
	{
	    send_to_char("There is a battleground underway.  You'll just have to wait for the next one.\n\r", ch);
	    return;
	}

	if(battleground_info.about_to_start == FALSE)
	{
	    send_to_char("There is no battleground going on at the moment.\n\r", ch);
	    return;
        }

        if(ch->level < battleground_info.min_lvl || ch->level > battleground_info.max_lvl)
	{
	    sprintf(buf, "You are not able to participate in this battleground.  It is for levels %d through %d only.\n\r", battleground_info.min_lvl, battleground_info.max_lvl);
	    send_to_char(buf, ch);
	    return;
        }

        SET_BIT(ch->act, PLR_BATTLEGROUND);
	send_to_char("You have joined in on the battleground.  To cancel your invitation or leave the battlegrounds at any time, type: battleground leave.\n\r", ch);
	return;
    }

    if(!str_cmp(arg1,"poobah"))
    {
        send_to_char("+==============================================================================+\n\r", ch);
	send_to_char("                       The Battleground Poobah Listing                      \n\r", ch);
	send_to_char("+==============================================================================+\n\r", ch);
        send_to_char(" Rank Name         Class            Religion     Kills Deaths Wins Total Points \n\r", ch);
	send_to_char("--------------------------------------------------------------------------------\n\r", ch);
        send_to_char("             The Poobah List has not been created yet! -- HANG TIGHT!           \n\r", ch);
	send_to_char("+==============================================================================+\n\r", ch);
	return;
    }
 
    if(!IS_IMMORTAL(ch) && (!str_cmp(arg1,"leave")))
    {
	if(IS_SET(ch->act, PLR_BATTLEGROUND) && battleground_info.in_progress == TRUE)
	{
	    send_to_char("Awwwww coward! You probably would have lost anyway.  Cowards never get very far in anything.\n\r", ch);
	    REMOVE_BIT(ch->act, PLR_BATTLEGROUND);
	    battleground_info.players--;
	    /* Restore pre-bg position in the world and their hp/mana/mv and affects */
	    ch->hit         = ch->pcdata->bg_hp_store;
	    ch->mana        = ch->pcdata->bg_mn_store;
            ch->move        = ch->pcdata->bg_mv_store;
	    char_from_room(ch);
	    char_to_room(ch, ch->pcdata->bg_room_store);
	    sprintf(buf,"%s the coward has fled from the battleground like a cowardly dog!\n\r", ch->name);
	    info_channel( buf );
	    act("Two bulky arena guardians throw $n onto the ground in front of you.", ch, NULL, NULL, TO_ROOM);
	    return;
	}
   
	if(IS_SET(ch->act, PLR_BATTLEGROUND) && battleground_info.about_to_start == TRUE)
	{
	    send_to_char("You will no longer be participating in the battleground.\n\r", ch);
	    REMOVE_BIT(ch->act, PLR_BATTLEGROUND);
	    return;
	}

	if(battleground_info.in_progress == TRUE)
	{
	    send_to_char("There is a battleground underway.  You'll just have to wait for the next one.\n\r", ch);
	    return;
	}

	if(battleground_info.about_to_start == FALSE)
	{
	    send_to_char("There is no battleground going on at the moment.\n\r", ch);
	    return;
        }	     
    }

    if(IS_IMMORTAL(ch) && (!str_cmp(arg1,"purge")))
    {
	if(battleground_info.in_progress == FALSE)
	{
	    send_to_char("There isn't a battleground to purge.\n\r", ch);
	    return;
	}

	if(battleground_info.about_to_start == TRUE)
	{
	    send_to_char("There is a battleground about to start.  If you wish to cancel it, use: battleground cancel - (type: 'battleground' for more information.)\n\r", ch);
	    return;
	}

	for(d = descriptor_list; d != NULL; d = d->next)
	{
	    victim = d->character;
	    if(IS_NPC(victim) || IS_IMMORTAL(victim) || !IS_SET(victim->act, PLR_BATTLEGROUND))
		continue;
	    send_to_char("A powerful gust of wind blows you out of the arena and back to where you came from.\n\r", victim);
	    REMOVE_BIT(victim->act, PLR_BATTLEGROUND);
	    /* Restore pre-bg position in the world and their hp/mana/mv and affects */
	    victim->hit         = ch->pcdata->bg_hp_store;
	    victim->mana        = ch->pcdata->bg_mn_store;
            victim->move        = ch->pcdata->bg_mv_store;
	    char_from_room(victim);
	    char_to_room(victim, victim->pcdata->bg_room_store);
	    act("$n has just arrived with a confused look on $s face.", victim, NULL, NULL, TO_ROOM);
	}
        battleground_info.ticks          = 0; /* The number of ticks until the battleground begins */
        battleground_info.min_lvl        = 0;
        battleground_info.max_lvl        = 0;
        battleground_info.prize          = NULL;
        battleground_info.area           = 0; 
	battleground_info.about_to_start = FALSE;
	battleground_info.in_progress    = FALSE;
	battleground_info.players	 = 0;
	sprintf(buf, "The battleground has been shut down by The Immortals, all contestants were sent home.\n\r");
        info_channel( buf );	    
	return;
    }

    if(IS_IMMORTAL(ch) && (!str_cmp(arg1,"cancel")))
    {
	if(battleground_info.in_progress == TRUE)
	{
	    send_to_char("There is a battleground underway.  To halt it and purge the battleground area of players, use: battleground purge - (type: 'battleground' for more information.)\n\r", ch);
	    return;
	}

	if(battleground_info.about_to_start == FALSE)
	{
	    send_to_char("There is no battleground beginning, to start one, use: battleground start - (type: 'battleground' for more information.)\n\r", ch);
	    return;
        }

	for(d = descriptor_list; d != NULL; d = d->next)
	{
	    victim = d->character;
	    if(IS_NPC(victim) || IS_IMMORTAL(victim))
	   	continue;

	    if(IS_SET(victim->act, PLR_BATTLEGROUND))
		REMOVE_BIT(victim->act, PLR_BATTLEGROUND);
	}

        battleground_info.ticks          = 0; /* The number of ticks until the battleground begins */
        battleground_info.min_lvl        = 0;
        battleground_info.max_lvl        = 0;
        battleground_info.prize          = NULL;
        battleground_info.area           = 0; 
	battleground_info.about_to_start = FALSE;
	battleground_info.in_progress    = FALSE;
	battleground_info.players	 = 0;
	sprintf(buf, "The battleground has been cancelled by The Immortals. ** cry **");
        info_channel( buf );
	return;
    }

    if(IS_IMMORTAL(ch) && (!str_cmp(arg1,"show")))
    {
	if(arg2[0] == '\0')
  	{
	    send_to_char("Please specify what you would like to show.  Syntax: battleground show <prizes|areas>\n\r", ch);
	    return;
	}

	if(!str_cmp(arg2,"prizes"))
	{
	    for(vnum = OBJ_VNUM_BG_FIRST_PRIZE; vnum <= OBJ_VNUM_BG_LAST_PRIZE; vnum++)
	    {
	        if( ( pObjIndex = get_obj_index( vnum ) ) != NULL)
	        {
		    found = TRUE;
		    sprintf(buf, "[%5d] %s\n\r", pObjIndex->vnum, pObjIndex->short_descr );
	            send_to_char(buf, ch);
	        }
	    }
	    if(!found)
	    {
		sprintf(buf,"There are currently no battleground prizes created.  Please create items %d through %d.", OBJ_VNUM_BG_FIRST_PRIZE, OBJ_VNUM_BG_LAST_PRIZE);
		send_to_char(buf, ch);
	    }
	    return;
	}

	if(!str_cmp(arg2,"areas"))
	{
            for(i = 0; battleground_area_table[i].name != '\0'; i++)
            {
		if(battleground_area_table[i].name != '\0')
		{
		    found = TRUE;
                    sprintf(buf, "[%3d - %3d] %s\n\r", 
		    battleground_area_table[i].first_vnum,
		    battleground_area_table[i].last_vnum,
		    battleground_area_table[i].name);
                    send_to_char(buf, ch);
		}
            }
	    if(!found)
	    {
		send_to_char("There are currently no battleground areas created.\n\r", ch);
		send_to_char("Please create one and add it to the table in const.c to utilize it.\n\r", ch);
	    }
	    return;
	}
    }

    if(IS_IMMORTAL(ch) && (!str_cmp(arg1,"start") || !str_cmp(arg1,"change")))
    {
	if(battleground_info.about_to_start == FALSE && !str_cmp(arg1,"change"))
	{
	    send_to_char("There is no battleground beginning, to start one, use: battleground start - (type: 'battleground' for more information.)\n\r", ch);
	    return;
        }
        if(battleground_info.about_to_start == TRUE && !str_cmp(arg1,"start"))
        {
	    send_to_char("There is currently a countdown to begin a battleground.\n\r", ch);
	    send_to_char("To change the current battleground, use: battleground change - (type: 'battleground' for more information.)\n\r", ch);
	    return;
        }

        if(atoi(arg2) <= 0 || atoi(arg3) >= LEVEL_IMMORTAL)
        {
	    sprintf(buf, "Levels must be between 1 and %d\n\r", LEVEL_IMMORTAL - 1);
	    send_to_char(buf, ch);
	    return;
        }

        /* Some crude error checking - Make Sure <min lvl> is less than or equal too <max lvl>*/
        if(atoi(arg2) > atoi(arg3))
        {
	    send_to_char("The minimum level must be less than or equal to the maximum level.\n\r", ch);
	    return;
        }

        for(d = descriptor_list; d != NULL; d = d->next)
        {
            victim = d->character;  
	    if(IS_NPC(victim) || IS_IMMORTAL(victim))
	        continue;
	
	    plr_count++;
	    /* Just to be safe in case someone was disconnected in a previous battleground */
	    if(IS_SET(victim->act, PLR_BATTLEGROUND))
	        REMOVE_BIT(victim->act, PLR_BATTLEGROUND);
        }

        if(plr_count <= 1)
        {
	    if(!str_cmp(arg1,"start"))
	        send_to_char("There are not enough players online to start a battleground.\n\r", ch);
	    else if(!str_cmp(arg1,"change"))
	    {
		send_to_char("There are not enough players online now to run a battleground.\n\r", ch);
		do_function(ch, &do_battleground,"cancel");
	    }
	    return;
        }

        if(arg4[0] == '\0')
        {
	    /* Lazy Battleground Prize Select */
            for(vnum = OBJ_VNUM_BG_FIRST_PRIZE; vnum <= OBJ_VNUM_BG_LAST_PRIZE; vnum++)
            {
                if( ( pObjIndex = get_obj_index( vnum ) ) != NULL)
                    found = TRUE;
	        if( ( pObjIndex = get_obj_index( vnum )) == NULL)
		    found = FALSE;
            }
            if(!found) /* Protect from segmentation fault if item gets deleted for whatever reason */
            {
                sprintf(buf,"There are missing items in the prize definitions.  Please make sure items %d through %d exist.\n\r", OBJ_VNUM_BG_FIRST_PRIZE, OBJ_VNUM_BG_LAST_PRIZE);
                send_to_char(buf, ch);
		return;
            }

	    bg_prize = number_range(OBJ_VNUM_BG_FIRST_PRIZE, OBJ_VNUM_BG_LAST_PRIZE);
	    obj = create_object( get_obj_index(bg_prize), 0 );
        }

        /* Make sure Immortals without "load" access can't reward held items */
        else if( get_trust(ch) < cmd_table[command_lookup("load")].level)
        {
	    send_to_char("You do not have the required trust to reward held items.  Default values used.\n\r", ch);
            for(vnum = OBJ_VNUM_BG_FIRST_PRIZE; vnum <= OBJ_VNUM_BG_LAST_PRIZE; vnum++)
            {
                if( ( pObjIndex = get_obj_index( vnum ) ) != NULL)
                    found = TRUE;
                if( ( pObjIndex = get_obj_index( vnum )) == NULL)
                    found = FALSE;
            }
            if(!found) /* Protect from segmentation fault if item gets deleted for whatever reason */
            {
                sprintf(buf,"There are missing items in the prize definitions.  Please make sure items %d through %d exist.", OBJ_VNUM_BG_FIRST_PRIZE, OBJ_VNUM_BG_LAST_PRIZE);
                send_to_char(buf, ch);
                return;
            }
            bg_prize = number_range(OBJ_VNUM_BG_FIRST_PRIZE, OBJ_VNUM_BG_LAST_PRIZE);
	    obj = create_object( get_obj_index(bg_prize), 1 );
        }

        else if( (obj = get_obj_carry( ch, arg4, ch )) == NULL )
        {
	    send_to_char("You aren't carrying that item.\n\r", ch);
	    return;
        }
	else
	{
	    send_to_char("Item extracted from your inventory and set as the battleground prize.\n\r", ch);
	    obj_from_char( obj );
        }

        if(arg5[0] == '\0')
        {
	    /* Lazy Battleground Area Select */
	    for(i = 0; battleground_area_table[i].name != '\0'; i++)
	    {
		if(battleground_area_table[i].name == NULL)
		    break;

		found = TRUE;	
	    }
	    if(!found)
	    {
		send_to_char("There are currently no battleground areas created.  Please create one and add it the table in const.c to utilize it.\n\r", ch);
		return;
	    }
	    battleground_info.area = number_range(0,i-1);
        }

        else if(battleground_lookup(arg5) < 0)
        {
            for(i = 0; battleground_area_table[i].name != '\0'; i++)
            {
		if(battleground_area_table[i].name == NULL)
		    break;

		found = TRUE;
	        sprintf(buf, "| %s |", battleground_area_table[i].name);
	        send_to_char(buf, ch);
            }	
	    if(!found)
                send_to_char("There are currently no battleground areas created.  Please create one and add it the table in const.c to utilize it.\n\r", ch);
	    else
	        send_to_char("\n\rThat is not a valid battleground area.  Select an area from this list above or leave blank to use a random one.\n\r", ch);
	    return;
        }
        else
	    battleground_info.area	  = battleground_lookup(arg5);

        battleground_info.ticks   	  = 3; /* The number of ticks until the battleground begins */
        battleground_info.min_lvl 	  = atoi(arg2);
        battleground_info.max_lvl 	  = atoi(arg3);
        battleground_info.prize   	  = obj;
        battleground_info.about_to_start  = TRUE;
	battleground_info.in_progress	  = FALSE;
	battleground_info.players	  = 0;

	if(!str_cmp(arg1,"start"))
            sprintf(buf, "A battleground for levels: %d - %d will begin shortly.  The winner shall receive %s.  To join, type 'battleground join'!\n\r", 
	        battleground_info.min_lvl, battleground_info.max_lvl, battleground_info.prize->short_descr);
	else
	{
	    sprintf(buf, "The battleground has been CHANGED - Levels: %d - %d.  The winner shall receive %s.  Please REJOIN!\n\r",
                         battleground_info.min_lvl, battleground_info.max_lvl, battleground_info.prize->short_descr);
	}
        info_channel( buf );
	sprintf(buf, "COUNT: %d AREA: %s (%d - %d)\n\r", i, battleground_area_table[battleground_info.area].name,
	battleground_area_table[battleground_info.area].first_vnum, battleground_area_table[battleground_info.area].last_vnum);
	send_to_char(buf, ch);
    }
    else
    {
	send_to_char("Invalid battleground command.\n\r", ch);
	return;
    }
}

void update_battleground(void)
{
    char buf[MAX_STRING_LENGTH];
    DESCRIPTOR_DATA *d;
    CHAR_DATA   *victim;
    ROOM_INDEX_DATA *pRoomIndex;
    OBJ_DATA *obj;
    int drop_room = 0;
    
    if(battleground_info.about_to_start == TRUE)
    {
        if(--battleground_info.ticks == 0)
	{
	    battleground_info.about_to_start = FALSE;
	    battleground_info.in_progress = TRUE;
            for(d = descriptor_list; d != NULL; d = d->next)
            {
                victim = d->character;
                if(IS_NPC(victim) || IS_IMMORTAL(victim))
                    continue;

                if(IS_SET(victim->act, PLR_BATTLEGROUND))
	        {
		    battleground_info.players++;
		    victim->pcdata->bg_hp_store = victim->hit;
		    victim->pcdata->bg_mn_store = victim->mana;
		    victim->pcdata->bg_mv_store	= victim->move;
		    victim->pcdata->bg_room_store = victim->in_room;
		    send_to_char("You have enter the battleground.  Defend yourself!\n\r", victim);
		    act("$n has been escorted to the battleground.", victim, NULL, NULL, TO_ROOM);
		    char_from_room(victim);
		    drop_room = number_range(battleground_area_table[battleground_info.area].first_vnum, battleground_area_table[battleground_info.area].last_vnum);
		    pRoomIndex = get_room_index( drop_room );
		    char_to_room(victim, pRoomIndex);
		    act("$n has entered the battleground.\n\r", victim, NULL, NULL, TO_ROOM);
		    do_look(victim,"auto");		    		    
		}
	    }
	    if(battleground_info.players == 0)
	    {
		sprintf(buf, "No one joined the battleground, %s has been lost.\n\r", battleground_info.prize->short_descr);
		info_channel( buf );
                battleground_info.ticks          = 0; /* The number of ticks until the battleground begins */
                battleground_info.min_lvl        = 0;
                battleground_info.max_lvl        = 0;
                battleground_info.prize          = NULL;
                battleground_info.area           = 0;
                battleground_info.about_to_start = FALSE;
                battleground_info.in_progress    = FALSE;
                battleground_info.players        = 0;
                return;
	    }
	    else
	    {
                sprintf(buf, "Time is up to join the battleground.  Let the contest begin!\n\r");
	        info_channel( buf );
	    }
	}
	else
	{
            sprintf(buf, "A battleground for levels: %d - %d will begin shortly.  The winner shall receive %s.  To join, type 'battleground join'!\n\r",
                battleground_info.min_lvl, battleground_info.max_lvl, battleground_info.prize->short_descr);
	    info_channel( buf );
	}
	return;
    }
    if(battleground_info.in_progress == TRUE)
    {
        if(battleground_info.players == 1)
	{
            for(d = descriptor_list; d != NULL; d = d->next)
            {
                victim = d->character;
                if(IS_NPC(victim) || IS_IMMORTAL(victim))
                    continue;

                if(IS_SET(victim->act, PLR_BATTLEGROUND))
                {
	    	    sprintf(buf, "%s is the sole survivor of the battleground and has been awarded %s.  Congratulations %s!\n\r",
			victim->name, battleground_info.prize->short_descr, victim->name);
	    	    info_channel( buf );
		    sprintf(buf, "%s suddenly appears in your inventory!\n\r", battleground_info.prize->short_descr);
		    send_to_char(buf, victim);
		    obj = battleground_info.prize;
		    obj_to_char(obj,victim);
		    REMOVE_BIT(victim->act, PLR_BATTLEGROUND);
		    victim->hit  = victim->pcdata->bg_hp_store;
		    victim->mana = victim->pcdata->bg_mn_store;
		    victim->move = victim->pcdata->bg_mv_store;
		    char_from_room(victim);
		    char_to_room(victim, victim->pcdata->bg_room_store);
		    do_look(victim,"auto");
		    act("$n arrives with a proud look on $s face.\n\r", victim, NULL, NULL, TO_ROOM);
            	    battleground_info.ticks          = 0; /* The number of ticks until the battleground begins */
            	    battleground_info.min_lvl        = 0;
            	    battleground_info.max_lvl        = 0;
            	    battleground_info.prize          = NULL;
            	    battleground_info.area           = 0;
            	    battleground_info.about_to_start = FALSE;
            	    battleground_info.in_progress    = FALSE;
             	    battleground_info.players        = 0;
	    	}
	    }
	    return;
        }
	if(battleground_info.players == 0)
	{
	    sprintf(buf, "There was no survivor in the battleground.  The prize, %s, was lost.\n\r", battleground_info.prize->short_descr);
	    info_channel( buf );
            battleground_info.ticks          = 0; /* The number of ticks until the battleground begins */
            battleground_info.min_lvl        = 0;
            battleground_info.max_lvl        = 0;
            battleground_info.prize          = NULL;
            battleground_info.area           = 0;
            battleground_info.about_to_start = FALSE;
            battleground_info.in_progress    = FALSE;
            battleground_info.players        = 0;
	    return;
	}
    }   
}

--------------------------------------------- End battleground.c ----------------------------------------

--------------------------------------------- Begin bgrounds.are ----------------------------------------

#AREA
bground.are~
Battle Grounds~
{ 5 10} Tsudanosh  Battle Grounds~
300 399

#MOBILES
#0


#OBJECTS
#400
water flask~
a water flask~
A water flask is lying on the ground.~
unknown~
drink 0 A0
10 10 'water' 0 0
0 0 150 P
#401
giant ration~
a giant ration~
A giant ration is molding on the ground.~
unknown~
food 0 A0
DF EG 0 0 0
0 0 500 P
#402
yarrow potion~
a yarrow potion~
A yarrow potion is lying on the ground.~
unknown~
potion 0 AG
1 'restore mana' 'reserved' 'reserved' 'reserved'
0 0 1000 P
#403
zarynithium potion~
a zarynithium potion~
A zarynithium potion is lying on the ground.~
unknown~
potion 0 A0
30 'kusamotu' 'reserved' 'reserved' 'reserved'
0 1 10000 P
#404
glow stone glowstone~
a glowstone~
A glowstone is illuminating the room here.~
unknown~
light A AQG
0 0 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef 0 0
0 0 500 P
#405
500 gold coins~
500 gold coins~
500 gold coins is sitting on the ground.~
unknown~
money 0 A0
CEFGHI 0 0 0 0
0 0 0 P
#406
1000 gold coins~
1,000 gold coins~
1,000 gold coins are sitting on the ground.~
unknown~
money 0 A0
DFGHIJ 0 0 0 0
0 0 0 P
#407
Robe~
some robes~
Some robes are piled up in the corner.~
unknown~
armor S AD ABCDEF
B B B ABCD0
1 1 500 P
#408
Leather Cuirass~
a leather cuirass~
A leather cuirass is lying on the ground.~
unknown~
armor S ADBCDE
AC AC AC BD 0
5 1 1500 P
#409
scroll gimotu~
scroll of gimotu~
A scroll of gimotu is lying on the ground.~
unknown~
scroll 0 A0
40 'gimotu' 'gimotu' 'gimotu' 'gimotu'
0 0 0 P
#410
scroll modoki small~
a scroll of modoki~
A small scroll is rolled up on the ground.~
unknown~
scroll P A0
16 'modoki' 'reserved' 'reserved' 'reserved'
0 0 0 P
#0



#ROOMS
#400
You are in room of total annihilation.~
~
0 B 0
S
#401
You are on the first floor of the tower.~
~
0 B 0
D0
~
~
0 0 402
D1
~
~
0 0 408
D4
~
~
0 0 412
S
#402
You are on the first floor of the tower.~
~
0 B 0
D0
~
~
0 0 403
D1
~
~
0 0 409
D2
~
~
0 0 401
S
#403
You are on the first floor of the tower.~
~
0 B 0
D1
~
~
0 0 404
D2
~
~
0 0 402
D4
~
~
0 0 410
S
#404
You are on the first floor of the tower.~
~
0 B 0
D1
~
~
0 0 405
D2
~
~
0 0 409
D3
~
~
0 0 403
S
#405
You are on the first floor of the tower.~
~
0 B 0
D2
~
~
0 0 406
D3
~
~
0 0 404
D4
~
~
0 0 416
S
#406
You are on the first floor of the tower.~
~
0 B 0
D0
~
~
0 0 405
D2
~
~
0 0 407
D3
~
~
0 0 409
S
#407
You are on the first floor of the tower.~
~
0 B 0
D0
~
~
0 0 406
D3
~
~
0 0 408
D4
~
~
0 0 414
S
#408
You are on the first floor of the tower.~
~
0 B 0
D0
~
~
0 0 409
D1
~
~
0 0 407
D3
~
~
0 0 401
S
#409
You are on the first floor of the tower.~
~
0 B 0
D0
~
~
0 0 404
D1
~
~
0 0 406
D2
~
~
0 0 408
D3
~
~
0 0 402
S
#410
You are on the second floor of the tower.~
~
0 B 0
D1
~
~
0 0 417
D2
~
~
0 0 411
D5
~
~
0 0 403
S
#411
You are on the second floor of the tower.~
~
0 B 0
D0
~
~
0 0 410
D1
~
~
0 0 418
D2
~
~
0 0 412
S
#412
You are on the second floor of the tower.~
~
0 B 0
D0
~
~
0 0 411
D1
~
~
0 0 413
D5
~
~
0 0 401
S
#413
You are on the second floor of the tower.~
~
0 B 0
D0
~
~
0 0 418
D1
~
~
0 0 414
D3
~
~
0 0 412
S
#414
You are on the second floor of the tower.~
~
0 B 0
D0
~
~
0 0 415
D3
~
~
0 0 413
D5
~
~
0 0 407
S
#415
You are on the second floor of the tower.~
~
0 B 0
D0
~
~
0 0 416
D2
~
~
0 0 414
D3
~
~
0 0 418
S
#416
You are on the second floor of the tower.~
~
0 B 0
D2
~
~
0 0 415
D3
~
~
0 0 417
D5
~
~
0 0 405
S
#417
You are on the second floor of the tower.~
~
0 B 0
D1
~
~
0 0 416
D2
~
~
0 0 418
D3
~
~
0 0 410
S
#418
You are on the second floor of the tower.~
~
0 B 0
D0
~
~
0 0 417
D1
~
~
0 0 415
D2
~
~
0 0 413
D3
~
~
0 0 411
D4
~
~
0 0 419
S
#419
You are on the top floor of the tower.~
~
0 B 0
D2
~
~
0 0 420
D5
~
~
0 0 418
S
#420
You are on the top floor of the tower.~
~
0 B 0
D0
~
~
0 0 419
S
#421
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 429
D1
~
~
0 0 422
S
#422
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 430
D1
~
~
0 0 423
D3
~
~
0 0 421
S
#423
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 431
D1
~
~
0 0 424
D3
~
~
0 0 422
S
#424
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 432
D1
~
~
0 0 425
D3
~
~
0 0 423
S
#425
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 433
D1
~
~
0 0 426
D3
~
~
0 0 424
S
#426
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 434
D1
~
~
0 0 427
D3
~
~
0 0 425
S
#427
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 435
D1
~
~
0 0 428
D3
~
~
0 0 426
S
#428
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 436
D3
~
~
0 0 427
S
#429
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 437
D1
~
~
0 0 430
D2
~
~
0 0 421
S
#430
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 438
D1
~
~
0 0 431
D2
~
~
0 0 422
D3
~
~
0 0 429
S
#431
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 439
D1
~
~
0 0 432
D2
~
~
0 0 423
D3
~
~
0 0 430
S
#432
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 440
D1
~
~
0 0 433
D2
~
~
0 0 424
D3
~
~
0 0 431
S
#433
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 441
D1
~
~
0 0 434
D2
~
~
0 0 425
D3
~
~
0 0 432
S
#434
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 442
D1
~
~
0 0 435
D2
~
~
0 0 426
D3
~
~
0 0 433
S
#435
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 443
D1
~
~
0 0 436
D2
~
~
0 0 427
D3
~
~
0 0 434
S
#436
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 444
D2
~
~
0 0 428
D3
~
~
0 0 435
S
#437
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 445
D1
~
~
0 0 438
D2
~
~
0 0 429
S
#438
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 446
D1
~
~
0 0 439
D2
~
~
0 0 430
D3
~
~
0 0 437
S
#439
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 447
D1
~
~
0 0 440
D2
~
~
0 0 431
D3
~
~
0 0 438
S
#440
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 448
D1
~
~
0 0 441
D2
~
~
0 0 432
D3
~
~
0 0 439
S
#441
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 449
D1
~
~
0 0 442
D2
~
~
0 0 433
D3
~
~
0 0 440
S
#442
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 450
D1
~
~
0 0 443
D2
~
~
0 0 434
D3
~
~
0 0 441
S
#443
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 451
D1
~
~
0 0 444
D2
~
~
0 0 435
D3
~
~
0 0 442
S
#444
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 452
D2
~
~
0 0 436
D3
~
~
0 0 443
S
#445
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 453
D1
~
~
0 0 446
D2
~
~
0 0 437
S
#446
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 454
D1
~
~
0 0 447
D2
~
~
0 0 438
D3
~
~
0 0 445
S
#447
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 455
D1
~
~
0 0 448
D2
~
~
0 0 439
D3
~
~
0 0 446
S
#448
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 456
D1
~
~
0 0 449
D2
~
~
0 0 440
D3
~
~
0 0 447
S
#449
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 457
D1
~
~
0 0 450
D2
~
~
0 0 441
D3
~
~
0 0 448
S
#450
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 458
D1
~
~
0 0 451
D2
~
~
0 0 442
D3
~
~
0 0 449
S
#451
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 459
D1
~
~
0 0 452
D2
~
~
0 0 443
D3
~
~
0 0 450
S
#452
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 460
D2
~
~
0 0 444
D3
~
~
0 0 451
S
#453
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 461
D1
~
~
0 0 454
D2
~
~
0 0 445
S
#454
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 462
D1
~
~
0 0 455
D2
~
~
0 0 446
D3
~
~
0 0 453
S
#455
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 463
D1
~
~
0 0 456
D2
~
~
0 0 447
D3
~
~
0 0 454
S
#456
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 464
D1
~
~
0 0 457
D2
~
~
0 0 448
D3
~
~
0 0 455
S
#457
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 465
D1
~
~
0 0 458
D2
~
~
0 0 449
D3
~
~
0 0 456
S
#458
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 466
D1
~
~
0 0 459
D2
~
~
0 0 450
D3
~
~
0 0 457
S
#459
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 467
D1
~
~
0 0 460
D2
~
~
0 0 451
D3
~
~
0 0 458
S
#460
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 468
D2
~
~
0 0 452
D3
~
~
0 0 459
S
#461
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 469
D1
~
~
0 0 462
D2
~
~
0 0 453
S
#462
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 470
D1
~
~
0 0 463
D2
~
~
0 0 454
D3
~
~
0 0 461
S
#463
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 471
D1
~
~
0 0 464
D2
~
~
0 0 455
D3
~
~
0 0 462
S
#464
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 472
D1
~
~
0 0 465
D2
~
~
0 0 456
D3
~
~
0 0 463
S
#465
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 473
D1
~
~
0 0 466
D2
~
~
0 0 457
D3
~
~
0 0 464
S
#466
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 474
D1
~
~
0 0 467
D2
~
~
0 0 458
D3
~
~
0 0 465
S
#467
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 475
D1
~
~
0 0 468
D2
~
~
0 0 459
D3
~
~
0 0 466
S
#468
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 476
D2
~
~
0 0 460
D3
~
~
0 0 467
S
#469
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 477
D1
~
~
0 0 470
D2
~
~
0 0 461
S
#470
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 478
D1
~
~
0 0 471
D2
~
~
0 0 462
D3
~
~
0 0 469
S
#471
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 479
D1
~
~
0 0 472
D2
~
~
0 0 463
D3
~
~
0 0 470
S
#472
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 480
D1
~
~
0 0 473
D2
~
~
0 0 464
D3
~
~
0 0 471
S
#473
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 481
D1
~
~
0 0 474
D2
~
~
0 0 465
D3
~
~
0 0 472
S
#474
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 482
D1
~
~
0 0 475
D2
~
~
0 0 466
D3
~
~
0 0 473
S
#475
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 483
D1
~
~
0 0 476
D2
~
~
0 0 467
D3
~
~
0 0 474
S
#476
You are on a life-sized chessboard.~
~
0 B 0
D0
~
~
0 0 484
D2
~
~
0 0 468
D3
~
~
0 0 475
S
#477
You are on a life-sized chessboard.~
~
0 B 0
D1
~
~
0 0 478
D2
~
~
0 0 469
S
#478
You are on a life-sized chessboard.~
~
0 B 0
D1
~
~
0 0 479
D2
~
~
0 0 470
D3
~
~
0 0 477
S
#479
You are on a life-sized chessboard.~
~
0 B 0
D1
~
~
0 0 480
D2
~
~
0 0 471
D3
~
~
0 0 478
S
#480
You are on a life-sized chessboard.~
~
0 B 0
D1
~
~
0 0 481
D2
~
~
0 0 472
D3
~
~
0 0 479
S
#481
You are on a life-sized chessboard.~
~
0 B 0
D1
~
~
0 0 482
D2
~
~
0 0 473
D3
~
~
0 0 480
S
#482
You are on a life-sized chessboard.~
~
0 B 0
D1
~
~
0 0 483
D2
~
~
0 0 474
D3
~
~
0 0 481
S
#483
You are on a life-sized chessboard.~
~
0 B 0
D1
~
~
0 0 484
D2
~
~
0 0 475
D3
~
~
0 0 482
S
#484
You are on a life-sized chessboard.~
~
0 B 0
D2
~
~
0 0 476
D3
~
~
0 0 483
S
#0



#SPECIALS
S



#RESETS
S



#SHOPS
0

#$

-------------------------------------------------- End bgrounds.are -------------------------------------